Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/prometheus/common
/ functions
Functions
800 in github.com/prometheus/common
⨍
Functions
800
◇
Types & classes
130
↓ 93 callers
Method
String
()
model/value_type.go:24
↓ 51 callers
Method
Equal
Equal reports whether two Times represent the same instant.
model/time.go:70
↓ 50 callers
Method
Error
Error implements the error interface.
expfmt/text_parse.go:47
↓ 47 callers
Method
Get
Get registers a new GET route.
route/route.go:93
↓ 32 callers
Method
Close
()
expfmt/encode.go:98
↓ 26 callers
Function
NewClientFromConfig
NewClientFromConfig returns a new HTTP client configured for the given config.HTTPClientConfig and config.HTTPClientOption. The name is used as go-con
config/http_config.go:604
↓ 25 callers
Method
Add
Add returns the Time t + d.
model/time.go:85
↓ 25 callers
Method
WriteByte
(c byte)
expfmt/text_create.go:36
↓ 22 callers
Method
WriteString
(s string)
expfmt/text_create.go:35
↓ 19 callers
Method
Set
Set updates the logging level with the validation.
promslog/slog.go:101
↓ 14 callers
Function
LoadHTTPConfigFile
LoadHTTPConfigFile parses the given YAML file into a HTTPClientConfig.
config/http_config.go:317
↓ 14 callers
Method
parseError
parseError sets p.err to a ParseError at the current line with the given message.
expfmt/text_parse.go:689
↓ 13 callers
Method
Fetch
(ctx context.Context)
config/http_config.go:771
↓ 13 callers
Method
WithEscapingScheme
WithEscapingScheme returns a copy of Format with the specified escaping scheme appended to the end. If an escaping scheme already exists it is removed
expfmt/expfmt.go:203
↓ 12 callers
Method
Decode
(*dto.MetricFamily)
expfmt/decode.go:32
↓ 12 callers
Method
IsValidMetricName
IsValidMetricName returns whether metricName is valid according to s.
model/metric.go:153
↓ 12 callers
Method
Len
()
model/value.go:293
↓ 12 callers
Function
NewDecoder
NewDecoder returns a new decoder based on the given input format. Metric names are validated based on the provided Format -- if the format requires es
expfmt/decode.go:103
↓ 11 callers
Method
IsValid
IsValid returns true iff the name matches the pattern of LabelNameRE when NameValidationScheme is set to LegacyValidation, or valid UTF-8 if NameValid
model/labels.go:112
↓ 10 callers
Method
Redirect
Redirect takes an absolute path and sends an internal HTTP redirect for it, prefixed by the router's path prefix. Note that this method does not inclu
route/route.go:130
↓ 10 callers
Method
Unix
Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC.
model/time.go:101
↓ 9 callers
Method
CloseIdleConnections
()
config/http_config.go:66
↓ 9 callers
Method
Encode
(*dto.MetricFamily)
expfmt/encode.go:87
↓ 9 callers
Method
Put
Put registers a new PUT route.
route/route.go:108
↓ 9 callers
Method
ServeHTTP
ServeHTTP implements http.Handler.
route/route.go:135
↓ 8 callers
Method
IsValidLabelName
IsValidLabelName returns whether labelName is valid according to s.
model/metric.go:176
↓ 8 callers
Function
ParseDuration
ParseDuration parses a string into a time.Duration, assuming that a year always has 365d, a week always has 7d, and a day always has 24h. Negative dur
model/time.go:227
↓ 8 callers
Function
TimeFromUnixNano
TimeFromUnixNano returns the Time equivalent to the Unix Time t provided in nanoseconds.
model/time.go:65
↓ 8 callers
Function
parseOpenMetricsFloat
(s string)
expfmt/openmetrics_parse.go:1016
↓ 7 callers
Method
Before
Before reports whether the Time t is before o.
model/time.go:75
↓ 7 callers
Method
Clone
Clone returns a copy of the Metric.
model/metric.go:260
↓ 7 callers
Function
NegotiateAccept
NegotiateAccept returns the Content-Type based on the given Accept header and the list of accepted Formats provided by the caller, in order of prefere
expfmt/encode.go:140
↓ 7 callers
Function
New
New returns a new Router.
route/route.go:53
↓ 7 callers
Function
NewEncoder
NewEncoder returns a new encoder based on content type negotiation. All Encoder implementations returned by NewEncoder also implement Closer, and call
expfmt/encode.go:232
↓ 7 callers
Method
TextToMetricFamilies
TextToMetricFamilies reads 'in' as the simple and flat text-based exchange format and creates MetricFamily proto messages. It returns the MetricFamily
expfmt/text_parse.go:116
↓ 7 callers
Function
cloneRequest
cloneRequest returns a clone of the provided *http.Request. The clone is a shallow copy of the struct and its Header map.
config/http_config.go:1238
↓ 7 callers
Method
handle
handle turns a HandlerFunc into an httprouter.Handle.
route/route.go:76
↓ 7 callers
Function
newTestServer
(handler func(w http.ResponseWriter, r *http.Request))
config/http_config_test.go:146
↓ 7 callers
Function
writeFloat
writeFloat is equivalent to fmt.Fprint with a float64 argument but hardcodes a few common cases for increased efficiency. For non-hardcoded cases, it
expfmt/text_create.go:476
↓ 7 callers
Function
writeOpenMetricsNameAndLabelPairs
writeOpenMetricsNameAndLabelPairs works like writeOpenMetricsSample but formats the float in OpenMetrics style.
expfmt/openmetrics_create.go:457
↓ 7 callers
Function
writeUint
writeUint is like writeInt just for uint64.
expfmt/openmetrics_create.go:682
↓ 6 callers
Method
FormatType
FormatType deduces an overall FormatType for the given format.
expfmt/expfmt.go:152
↓ 6 callers
Function
JoinDir
JoinDir joins dir and path if path is relative. If path is empty or absolute, it is returned unchanged.
config/config.go:75
↓ 6 callers
Function
New
New returns a new slog.Logger. Each logged line will be annotated with a timestamp. The output always goes to stderr.
promslog/slog.go:260
↓ 6 callers
Function
NewRoundTripperFromConfig
NewRoundTripperFromConfig returns a new HTTP RoundTripper configured for the given config.HTTPClientConfig and config.HTTPClientOption. The name is us
config/http_config.go:621
↓ 6 callers
Method
RoundTrip
RoundTrip implements the http.RoundTrip interface.
config/http_config.go:1579
↓ 6 callers
Function
hashNew
hashNew initializes a new fnv64a hash value.
model/fnv.go:24
↓ 6 callers
Method
skipBlankTab
skipBlankTab reads (and discards) bytes from p.buf until it encounters a byte that is neither ' ' nor '\t'. That byte is left in p.currentByte.
expfmt/text_parse.go:698
↓ 6 callers
Function
writeEscapedString
(w enhancedWriter, v string, includeDoubleQuote bool)
expfmt/text_create.go:466
↓ 6 callers
Function
writeOpenMetricsFloat
writeOpenMetricsFloat works like writeFloat but appends ".0" if the resulting number would otherwise contain neither a "." nor an "e".
expfmt/openmetrics_create.go:655
↓ 5 callers
Function
LabelsToSignature
LabelsToSignature returns a quasi-unique signature (i.e., fingerprint) for a given label set. (Collisions are possible but unlikely if the number of l
model/signature.go:31
↓ 5 callers
Function
MetricFamilyToOpenMetrics
MetricFamilyToOpenMetrics converts a MetricFamily proto message into the OpenMetrics text format and writes the resulting lines to 'out'. It returns t
expfmt/openmetrics_create.go:98
↓ 5 callers
Function
MetricFamilyToOpenMetrics20
MetricFamilyToOpenMetrics20 converts a MetricFamily proto message into the OpenMetrics text format version 2.0.0 and writes the resulting lines to 'ou
expfmt/openmetrics_2_0_create.go:47
↓ 5 callers
Function
MetricFamilyToText
MetricFamilyToText converts a MetricFamily proto message into text format and writes the resulting lines to 'out'. It returns the number of bytes writ
expfmt/text_create.go:78
↓ 5 callers
Function
NewLevel
NewLevel returns a new Level.
promslog/slog.go:58
↓ 5 callers
Function
NewTLSConfig
NewTLSConfig creates a new tls.Config from the given TLSConfig.
config/http_config.go:1262
↓ 5 callers
Function
NewTextParser
NewTextParser returns a new TextParser with the provided nameValidationScheme.
expfmt/text_parse.go:89
↓ 5 callers
Function
Param
Param returns param p for the context, or the empty string when param does not exist in context.
route/route.go:32
↓ 5 callers
Method
String
()
model/time.go:294
↓ 5 callers
Method
ToEscapingScheme
ToEscapingScheme returns an EscapingScheme depending on the Format. IFF the Format contains an escaping=allow-utf-8 term, it will select NoEscaping. I
expfmt/expfmt.go:227
↓ 5 callers
Method
UnmarshalJSON
([]byte)
model/util127_test.go:64
↓ 5 callers
Method
Validate
Validate validates the TLSConfig to check that only one of the inlined or file-based fields for the TLS CA, client certificate, and client key are use
config/http_config.go:1382
↓ 5 callers
Function
assertProtoEqual
(t *testing.T, want, got proto.Message, msgAndArgs ...any)
expfmt/openmetrics_parse_test.go:60
↓ 5 callers
Function
decodeOpenMetrics20ToMap
(r io.Reader, format Format)
expfmt/openmetrics_2_0_parse_test.go:32
↓ 5 callers
Function
genSampleHistogram
()
model/value_histogram_test.go:258
↓ 5 callers
Function
hashAdd
hashAdd adds a string to a fnv64a hash value, returning the updated hash.
model/fnv.go:29
↓ 5 callers
Function
hashAddByte
hashAddByte adds a byte to a fnv64a hash value, returning the updated hash.
model/fnv.go:38
↓ 5 callers
Function
unescapeOpenMetricsString
(s string)
expfmt/openmetrics_parse.go:1009
↓ 5 callers
Function
writeName
writeName writes a string as-is if it complies with the legacy naming scheme, or escapes it in double quotes if not.
expfmt/text_create.go:512
↓ 5 callers
Function
writeProtoTimestamp
(w enhancedWriter, ts *timestamppb.Timestamp)
expfmt/openmetrics_2_0_create.go:1165
↓ 4 callers
Method
Decode
Decode calls the Decode method of the wrapped Decoder and then extracts the samples from the decoded MetricFamily into the provided model.Vector.
expfmt/decode.go:263
↓ 4 callers
Method
Fingerprint
Fingerprint returns a unique hash for the alert. It is equivalent to the fingerprint of the alert's label set.
model/alert.go:51
↓ 4 callers
Function
IsValidLegacyMetricName
IsValidLegacyMetricName is similar to IsValidMetricName but always uses the legacy validation scheme regardless of the value of NameValidationScheme.
model/metric.go:319
↓ 4 callers
Function
NewInlineSecret
(text string)
config/http_config.go:780
↓ 4 callers
Function
NewOAuth2RoundTripper
NewOAuth2RoundTripper returns a round tripper that performs OAuth2 authentication. The opts variadic parameter accepts any HTTPClientOption (e.g. With
config/http_config.go:958
↓ 4 callers
Function
Now
Now returns the current time as a Time.
model/time.go:53
↓ 4 callers
Method
ResolvedAt
ResolvedAt returns true iff the activity interval ended before the given timestamp.
model/alert.go:70
↓ 4 callers
Method
RoundTrip
(*http.Request)
config/http_config_test.go:1769
↓ 4 callers
Method
UnixNano
UnixNano returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC.
model/time.go:107
↓ 4 callers
Method
Version
Version returns the version parameter without validating whether it is supported. It returns an empty string if the parameter is absent or the Content
expfmt/expfmt.go:143
↓ 4 callers
Function
WithSecretManager
WithSecretManager allows setting the secret manager.
config/http_config.go:590
↓ 4 callers
Function
benchmarkLabelToSignature
(b *testing.B, l map[string]string, e uint64)
model/signature_test.go:191
↓ 4 callers
Function
benchmarkMetricToFastFingerprint
(b *testing.B, ls LabelSet, e Fingerprint)
model/signature_test.go:237
↓ 4 callers
Function
benchmarkMetricToFastFingerprintConc
(b *testing.B, ls LabelSet, e Fingerprint, concLevel int)
model/signature_test.go:278
↓ 4 callers
Function
benchmarkMetricToFingerprint
(b *testing.B, ls LabelSet, e Fingerprint)
model/signature_test.go:214
↓ 4 callers
Method
close
()
config/http_config_test.go:1845
↓ 4 callers
Function
decodeAllOpenMetrics
(t *testing.T, input string, format Format)
expfmt/openmetrics_parse_test.go:33
↓ 4 callers
Function
decodeOpenMetricsErr
(input string, format Format)
expfmt/openmetrics_parse_test.go:50
↓ 4 callers
Function
getCertificateBlobs
(t *testing.T)
config/http_config_test.go:1012
↓ 4 callers
Function
isBlankOrTab
(b byte)
expfmt/text_parse.go:962
↓ 4 callers
Function
isCrossHostRedirect
isCrossHostRedirect reports whether req is a redirect that has left the original request's host at any point in the chain. It detects this by walking
config/http_config.go:1158
↓ 4 callers
Function
labelSetToFastFingerprint
labelSetToFastFingerprint works similar to labelSetToFingerprint but uses a faster and less allocation-heavy hash function, which is more susceptible
model/signature.go:78
↓ 4 callers
Function
testV1V2Marshal
(t *testing.T, name string, v jsonv1.Marshaler)
model/util127_test.go:25
↓ 4 callers
Function
toSecret
toSecret returns a SecretReader from one of the given sources, assuming exactly one or none of the sources are provided.
config/http_config.go:840
↓ 4 callers
Function
validateLabels20
(labels []*dto.LabelPair)
expfmt/openmetrics_2_0_create.go:1132
↓ 4 callers
Method
validationScheme
()
expfmt/openmetrics_2_0_parse.go:241
↓ 4 callers
Method
validationScheme
()
expfmt/openmetrics_parse.go:208
↓ 4 callers
Function
writeCertificate
(bs map[string][]byte, src, dst string)
config/http_config_test.go:1033
↓ 4 callers
Function
writeInt
writeInt is equivalent to fmt.Fprint with an int64 argument but uses strconv.AppendInt with a byte slice taken from a sync.Pool to avoid allocations.
expfmt/text_create.go:502
↓ 4 callers
Function
writeOpenMetrics20Timestamp
writeOpenMetrics20Timestamp writes a float64 as a timestamp without scientific notation.
expfmt/openmetrics_2_0_create.go:361
next →
1–100 of 800, ranked by callers