Documentation ¶
Index ¶
- Constants
- func AddSourceIPsToIncomingContext(ctx context.Context, source string) context.Context
- func AddSourceIPsToOutgoingContext(ctx context.Context, source string) context.Context
- func DeleteMatchingLabels(c CollectorVec, filter map[string]string) error
- func DiffConfig(defaultConfig, actualConfig map[interface{}]interface{}) (map[interface{}]interface{}, error)
- func DurationWithJitter(input time.Duration, variancePerc float64) time.Duration
- func DurationWithPositiveJitter(input time.Duration, variancePerc float64) time.Duration
- func DynamicShardSize(value float64, numInstances int) int
- func Event() log.Logger
- func FormatTimeMillis(ms int64) string
- func FormatTimeModel(t model.Time) string
- func FromLabelPairsToLabels(pairs []*dto.LabelPair) labels.Labels
- func GetFirstAddressOf(names []string) (string, error)
- func GetLabels(c prometheus.Collector, filter map[string]string) ([]labels.Labels, error)
- func GetSourceIPsFromIncomingCtx(ctx context.Context) string
- func GetSourceIPsFromOutgoingCtx(ctx context.Context) string
- func GetSumOfHistogramSampleCount(families []*dto.MetricFamily, metricName string, matchers labels.Selector) uint64
- func HashFP(fp model.Fingerprint) uint32
- func InitEvents(freq int)
- func IsRequestBodyTooLarge(err error) bool
- func LabelMatchersToString(matchers []*labels.Matcher) string
- func LabelsToMetric(ls labels.Labels) model.Metric
- func MergeNSampleSets(sampleSets ...[]model.SamplePair) []model.SamplePair
- func MergeSampleSets(a, b []model.SamplePair) []model.SamplePair
- func NewDNSWatcher(address string, dnsLookupPeriod time.Duration, notifications DNSNotifications) (services.Service, error)
- func NewDisableableTicker(interval time.Duration) (func(), <-chan time.Time)
- func ParseProtoReader(ctx context.Context, reader io.Reader, expectedSize, maxSize int, ...) error
- func ParseTime(s string) (int64, error)
- func RenderHTTPResponse(w http.ResponseWriter, v interface{}, t *template.Template, r *http.Request)
- func SerializeProtoResponse(w http.ResponseWriter, resp proto.Message, compression CompressionType) error
- func ShuffleShardExpectedInstances(shardSize, numZones int) int
- func ShuffleShardExpectedInstancesPerZone(shardSize, numZones int) int
- func ShuffleShardSeed(identifier, zone string) int64
- func SplitFiltersAndMatchers(allMatchers []*labels.Matcher) (filters, matchers []*labels.Matcher)
- func StreamWriteYAMLResponse(w http.ResponseWriter, iter chan interface{}, logger log.Logger)
- func StreamWriteYAMLV3Response(w http.ResponseWriter, iter chan interface{}, logger log.Logger)
- func StringsClone(s string) string
- func StringsContain(values []string, search string) bool
- func StringsMap(values []string) map[string]bool
- func TimeFromMillis(ms int64) time.Time
- func TimeToMillis(t time.Time) int64
- func WaitGroup(ctx context.Context, wg *sync.WaitGroup) error
- func WriteHTMLResponse(w http.ResponseWriter, message string)
- func WriteJSONResponse(w http.ResponseWriter, v interface{})
- func WriteTextResponse(w http.ResponseWriter, message string)
- func WriteYAMLResponse(w http.ResponseWriter, v interface{})
- func YAMLMarshalUnmarshal(in interface{}) (map[interface{}]interface{}, error)
- func YoloBuf(s string) []byte
- type ActiveUsers
- type ActiveUsersCleanupService
- type AllowedTenants
- type BasicAuth
- type CollectorVec
- type CompressionType
- type DNSNotifications
- type HistogramData
- type HistogramDataCollector
- type MergedMetricFamily
- type Metric
- type MetricFamiliesPerUser
- func (d MetricFamiliesPerUser) GetSumOfCounters(counter string) float64
- func (d MetricFamiliesPerUser) GetSumOfGauges(gauge string) float64
- func (d MetricFamiliesPerUser) SendMaxOfGauges(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string)
- func (d MetricFamiliesPerUser) SendMaxOfGaugesPerUser(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string)
- func (d MetricFamiliesPerUser) SendSumOfCounters(out chan<- prometheus.Metric, desc *prometheus.Desc, counter string)
- func (d MetricFamiliesPerUser) SendSumOfCountersPerUser(out chan<- prometheus.Metric, desc *prometheus.Desc, counter string)
- func (d MetricFamiliesPerUser) SendSumOfCountersPerUserWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, metric string, ...)
- func (d MetricFamiliesPerUser) SendSumOfCountersWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, counter string, ...)
- func (d MetricFamiliesPerUser) SendSumOfGauges(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string)
- func (d MetricFamiliesPerUser) SendSumOfGaugesPerUser(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string)
- func (d MetricFamiliesPerUser) SendSumOfGaugesPerUserWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, metric string, ...)
- func (d MetricFamiliesPerUser) SendSumOfGaugesWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string, ...)
- func (d MetricFamiliesPerUser) SendSumOfHistograms(out chan<- prometheus.Metric, desc *prometheus.Desc, histogramName string)
- func (d MetricFamiliesPerUser) SendSumOfHistogramsWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, histogramName string, ...)
- func (d MetricFamiliesPerUser) SendSumOfSummaries(out chan<- prometheus.Metric, desc *prometheus.Desc, summaryName string)
- func (d MetricFamiliesPerUser) SendSumOfSummariesPerUser(out chan<- prometheus.Metric, desc *prometheus.Desc, summaryName string)
- func (d MetricFamiliesPerUser) SendSumOfSummariesWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, summaryName string, ...)
- type MetricFamilyMap
- func (mfm MetricFamilyMap) MaxGauges(name string) float64
- func (mfm MetricFamilyMap) SumCounters(name string) float64
- func (mfm MetricFamilyMap) SumGauges(name string) float64
- func (mfm MetricFamilyMap) SumHistograms(name string) HistogramData
- func (mfm MetricFamilyMap) SumHistogramsTo(name string, output *HistogramData)
- func (mfm MetricFamilyMap) SumSummaries(name string) SummaryData
- func (mfm MetricFamilyMap) SumSummariesTo(name string, output *SummaryData)
- type MetricMap
- type Op
- type PriorityQueue
- type SampleStreamIterator
- type SummaryData
- type UserRegistries
- type UserRegistry
Constants ¶
const ( // Sharding strategies. ShardingStrategyDefault = "default" ShardingStrategyShuffle = "shuffle-sharding" )
Variables ¶
This section is empty.
Functions ¶
func AddSourceIPsToIncomingContext ¶ added in v1.4.0
AddSourceIPsToIncomingContext adds the given source to the GRPC context
func AddSourceIPsToOutgoingContext ¶ added in v1.4.0
AddSourceIPsToOutgoingContext adds the given source to the GRPC context
func DeleteMatchingLabels ¶ added in v1.8.0
func DeleteMatchingLabels(c CollectorVec, filter map[string]string) error
DeleteMatchingLabels removes metric with labels matching the filter.
func DiffConfig ¶ added in v1.8.0
func DiffConfig(defaultConfig, actualConfig map[interface{}]interface{}) (map[interface{}]interface{}, error)
DiffConfig utility function that returns the diff between two config map objects
func DurationWithJitter ¶ added in v1.2.0
DurationWithJitter returns random duration from "input - input*variance" to "input + input*variance" interval.
func DurationWithPositiveJitter ¶ added in v1.8.0
DurationWithPositiveJitter returns random duration from "input" to "input + input*variance" interval.
func DynamicShardSize ¶ added in v1.16.0
DynamicShardSize returns the shard size as a percentage of numInstances if the value is < 1. If the value is >= 1, the value is rounded and returned.
func FormatTimeMillis ¶ added in v1.6.0
FormatTimeMillis returns a human readable version of the input time (in milliseconds).
func FormatTimeModel ¶ added in v1.6.0
FormatTimeModel returns a human readable version of the input time.
func FromLabelPairsToLabels ¶ added in v1.7.0
FromLabelPairsToLabels converts dto.LabelPair into labels.Labels.
func GetFirstAddressOf ¶
GetFirstAddressOf returns the first IPv4 address of the supplied interface names, omitting any 169.254.x.x automatic private IPs if possible.
func GetLabels ¶ added in v1.8.0
GetLables returns list of label combinations used by this collector at the time of call. This can be used to find and delete unused metrics.
func GetSourceIPsFromIncomingCtx ¶ added in v1.4.0
GetSourceIPsFromIncomingCtx extracts the source field from the GRPC context
func GetSourceIPsFromOutgoingCtx ¶ added in v1.4.0
GetSourceIPsFromOutgoingCtx extracts the source field from the GRPC context
func GetSumOfHistogramSampleCount ¶ added in v1.7.0
func GetSumOfHistogramSampleCount(families []*dto.MetricFamily, metricName string, matchers labels.Selector) uint64
GetSumOfHistogramSampleCount returns the sum of samples count of histograms matching the provided metric name and optional label matchers. Returns 0 if no metric matches.
func HashFP ¶
func HashFP(fp model.Fingerprint) uint32
HashFP simply moves entropy from the most significant 48 bits of the fingerprint into the least significant 16 bits (by XORing) so that a simple MOD on the result can be used to pick a mutex while still making use of changes in more significant bits of the fingerprint. (The fast fingerprinting function we use is prone to only change a few bits for similar metrics. We really want to make use of every change in the fingerprint to vary mutex selection.)
func InitEvents ¶
func InitEvents(freq int)
InitEvents initializes event sampling, with the given frequency. Zero=off.
func IsRequestBodyTooLarge ¶ added in v1.8.0
IsRequestBodyTooLarge returns true if the error is "http: request body too large".
func LabelMatchersToString ¶ added in v1.10.0
LabelMatchersToString returns a string representing the input label matchers.
func LabelsToMetric ¶
LabelsToMetric converts a Labels to Metric Don't do this on any performance sensitive paths.
func MergeNSampleSets ¶
func MergeNSampleSets(sampleSets ...[]model.SamplePair) []model.SamplePair
MergeNSampleSets merges and dedupes n sets of already sorted sample pairs.
func MergeSampleSets ¶
func MergeSampleSets(a, b []model.SamplePair) []model.SamplePair
MergeSampleSets merges and dedupes two sets of already sorted sample pairs.
func NewDNSWatcher ¶ added in v1.6.0
func NewDNSWatcher(address string, dnsLookupPeriod time.Duration, notifications DNSNotifications) (services.Service, error)
NewDNSWatcher creates a new DNS watcher and returns a service that is wrapping it.
func NewDisableableTicker ¶ added in v1.11.0
NewDisableableTicker essentially wraps NewTicker but allows the ticker to be disabled by passing zero duration as the interval. Returns a function for stopping the ticker, and the ticker channel.
func ParseProtoReader ¶
func ParseProtoReader(ctx context.Context, reader io.Reader, expectedSize, maxSize int, req proto.Message, compression CompressionType) error
ParseProtoReader parses a compressed proto from an io.Reader.
func ParseTime ¶ added in v1.0.0
ParseTime parses the string into an int64, milliseconds since epoch.
func RenderHTTPResponse ¶ added in v1.2.0
func RenderHTTPResponse(w http.ResponseWriter, v interface{}, t *template.Template, r *http.Request)
RenderHTTPResponse either responds with json or a rendered html page using the passed in template by checking the Accepts header
func SerializeProtoResponse ¶
func SerializeProtoResponse(w http.ResponseWriter, resp proto.Message, compression CompressionType) error
SerializeProtoResponse serializes a protobuf response into an HTTP response.
func ShuffleShardExpectedInstances ¶ added in v1.5.0
ShuffleShardExpectedInstances returns the total number of instances that should be selected for a given tenant. If zone-aware replication is disabled, the input numZones should be 1.
func ShuffleShardExpectedInstancesPerZone ¶ added in v1.5.0
ShuffleShardExpectedInstancesPerZone returns the number of instances that should be selected for each zone when zone-aware replication is enabled. The algorithm expects the shard size to be divisible by the number of zones, in order to have nodes balanced across zones. If it's not, we do round up.
func ShuffleShardSeed ¶ added in v1.5.0
ShuffleShardSeed returns seed for random number generator, computed from provided identifier.
func SplitFiltersAndMatchers ¶
SplitFiltersAndMatchers splits empty matchers off, which are treated as filters, see #220
func StreamWriteYAMLResponse ¶ added in v1.9.0
func StreamWriteYAMLResponse(w http.ResponseWriter, iter chan interface{}, logger log.Logger)
StreamWriteYAMLResponse stream writes data as http response using yaml v2 library
func StreamWriteYAMLV3Response ¶ added in v1.14.0
func StreamWriteYAMLV3Response(w http.ResponseWriter, iter chan interface{}, logger log.Logger)
StreamWriteYAMLV3Response stream writes data as http response using yaml v3 library
func StringsClone ¶ added in v1.13.0
StringsClone returns a copy input s see: https://github.com/golang/go/blob/master/src/strings/clone.go
func StringsContain ¶ added in v1.0.0
StringsContain returns true if the search value is within the list of input values.
func StringsMap ¶ added in v1.7.0
StringsMap returns a map where keys are input values.
func TimeFromMillis ¶ added in v1.2.0
TimeFromMillis is a helper to turn milliseconds -> time.Time
func TimeToMillis ¶ added in v1.2.0
func WaitGroup ¶ added in v0.6.0
WaitGroup calls Wait() on a sync.WaitGroup and return once the Wait() completed or the context is cancelled or times out, whatever occurs first. Returns the specific context error if the context is cancelled or times out before Wait() completes.
func WriteHTMLResponse ¶ added in v1.10.0
func WriteHTMLResponse(w http.ResponseWriter, message string)
Sends message as text/html response with 200 status code.
func WriteJSONResponse ¶
func WriteJSONResponse(w http.ResponseWriter, v interface{})
WriteJSONResponse writes some JSON as a HTTP response.
func WriteTextResponse ¶ added in v1.7.0
func WriteTextResponse(w http.ResponseWriter, message string)
Sends message as text/plain response with 200 status code.
func WriteYAMLResponse ¶ added in v1.7.0
func WriteYAMLResponse(w http.ResponseWriter, v interface{})
WriteYAMLResponse writes some YAML as a HTTP response.
func YAMLMarshalUnmarshal ¶ added in v1.8.0
func YAMLMarshalUnmarshal(in interface{}) (map[interface{}]interface{}, error)
YAMLMarshalUnmarshal utility function that converts a YAML interface in a map doing marshal and unmarshal of the parameter
Types ¶
type ActiveUsers ¶ added in v1.8.0
type ActiveUsers struct {
// contains filtered or unexported fields
}
ActiveUsers keeps track of latest user's activity timestamp, and allows purging users that are no longer active.
func NewActiveUsers ¶ added in v1.8.0
func NewActiveUsers() *ActiveUsers
func (*ActiveUsers) PurgeInactiveUsers ¶ added in v1.8.0
func (m *ActiveUsers) PurgeInactiveUsers(deadline int64) []string
PurgeInactiveUsers removes users that were last active before given deadline, and returns removed users.
func (*ActiveUsers) UpdateUserTimestamp ¶ added in v1.8.0
func (m *ActiveUsers) UpdateUserTimestamp(userID string, ts int64)
type ActiveUsersCleanupService ¶ added in v1.8.0
type ActiveUsersCleanupService struct { services.Service // contains filtered or unexported fields }
ActiveUsersCleanupService tracks active users, and periodically purges inactive ones while running.
func NewActiveUsersCleanupService ¶ added in v1.8.0
func NewActiveUsersCleanupService(cleanupInterval, inactiveTimeout time.Duration, cleanupFn func(string)) *ActiveUsersCleanupService
func NewActiveUsersCleanupWithDefaultValues ¶ added in v1.8.0
func NewActiveUsersCleanupWithDefaultValues(cleanupFn func(string)) *ActiveUsersCleanupService
func (*ActiveUsersCleanupService) UpdateUserTimestamp ¶ added in v1.8.0
func (s *ActiveUsersCleanupService) UpdateUserTimestamp(user string, now time.Time)
type AllowedTenants ¶ added in v1.9.0
type AllowedTenants struct {
// contains filtered or unexported fields
}
AllowedTenants that can answer whether tenant is allowed or not based on configuration. Default value (nil) allows all tenants.
func NewAllowedTenants ¶ added in v1.9.0
func NewAllowedTenants(enabled []string, disabled []string) *AllowedTenants
NewAllowedTenants builds new allowed tenants based on enabled and disabled tenants. If there are any enabled tenants, then only those tenants are allowed. If there are any disabled tenants, then tenant from that list, that would normally be allowed, is disabled instead.
func (*AllowedTenants) IsAllowed ¶ added in v1.9.0
func (a *AllowedTenants) IsAllowed(tenantID string) bool
type BasicAuth ¶ added in v1.8.0
type BasicAuth struct { Username string `yaml:"basic_auth_username"` Password string `yaml:"basic_auth_password"` }
BasicAuth configures basic authentication for HTTP clients.
type CollectorVec ¶ added in v1.8.0
type CollectorVec interface { prometheus.Collector Delete(labels prometheus.Labels) bool }
CollectorVec is a collector that can delete metrics by labels. Implemented by *prometheus.MetricVec (used by CounterVec, GaugeVec, SummaryVec, and HistogramVec).
type CompressionType ¶
type CompressionType int
CompressionType for encoding and decoding requests and responses.
const ( NoCompression CompressionType = iota RawSnappy )
Values for CompressionType
type DNSNotifications ¶ added in v1.6.0
type DNSNotifications interface { // New address has been discovered by DNS watcher for supplied hostname. AddressAdded(address string) // Previously-discovered address is no longer resolved for the hostname. AddressRemoved(address string) }
Notifications about address resolution. All notifications are sent on the same goroutine.
type HistogramData ¶ added in v0.7.0
type HistogramData struct {
// contains filtered or unexported fields
}
HistogramData keeps data required to build histogram Metric.
func (*HistogramData) AddHistogram ¶ added in v0.7.0
func (d *HistogramData) AddHistogram(histo *dto.Histogram)
AddHistogram adds histogram from gathered metrics to this histogram data. Do not call this function after Metric() has been invoked, because histogram created by Metric is using the buckets map (doesn't make a copy), and it's not allowed to change the buckets after they've been passed to a prometheus.Metric.
func (*HistogramData) AddHistogramData ¶ added in v0.7.0
func (d *HistogramData) AddHistogramData(histo HistogramData)
AddHistogramData merges another histogram data into this one. Do not call this function after Metric() has been invoked, because histogram created by Metric is using the buckets map (doesn't make a copy), and it's not allowed to change the buckets after they've been passed to a prometheus.Metric.
func (*HistogramData) Copy ¶ added in v1.11.0
func (d *HistogramData) Copy() *HistogramData
Copy returns a copy of this histogram data.
func (*HistogramData) Metric ¶ added in v0.7.0
func (d *HistogramData) Metric(desc *prometheus.Desc, labelValues ...string) prometheus.Metric
Metric returns prometheus metric from this histogram data.
Note that returned metric shares bucket with this HistogramData, so avoid doing more modifications to this HistogramData after calling Metric.
type HistogramDataCollector ¶ added in v0.7.0
type HistogramDataCollector struct {
// contains filtered or unexported fields
}
HistogramDataCollector combines histogram data, with prometheus descriptor. It can be registered into prometheus to report histogram with stored data. Data can be updated via Add method.
func NewHistogramDataCollector ¶ added in v0.7.0
func NewHistogramDataCollector(desc *prometheus.Desc) *HistogramDataCollector
NewHistogramDataCollector creates new histogram data collector.
func (*HistogramDataCollector) Add ¶ added in v0.7.0
func (h *HistogramDataCollector) Add(hd HistogramData)
func (*HistogramDataCollector) Collect ¶ added in v0.7.0
func (h *HistogramDataCollector) Collect(out chan<- prometheus.Metric)
func (*HistogramDataCollector) Describe ¶ added in v0.7.0
func (h *HistogramDataCollector) Describe(out chan<- *prometheus.Desc)
type MergedMetricFamily ¶ added in v1.14.0
type MergedMetricFamily struct {
// contains filtered or unexported fields
}
func (*MergedMetricFamily) CreateMetricFamily ¶ added in v1.14.0
func (m *MergedMetricFamily) CreateMetricFamily() *dto.MetricFamily
type MetricFamiliesPerUser ¶ added in v0.6.0
type MetricFamiliesPerUser []struct {
// contains filtered or unexported fields
}
MetricFamiliesPerUser is a collection of metrics gathered via calling Gatherer.Gather() method on different gatherers, one per user.
func (MetricFamiliesPerUser) GetSumOfCounters ¶ added in v1.1.0
func (d MetricFamiliesPerUser) GetSumOfCounters(counter string) float64
func (MetricFamiliesPerUser) GetSumOfGauges ¶ added in v1.1.0
func (d MetricFamiliesPerUser) GetSumOfGauges(gauge string) float64
func (MetricFamiliesPerUser) SendMaxOfGauges ¶ added in v0.7.0
func (d MetricFamiliesPerUser) SendMaxOfGauges(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string)
func (MetricFamiliesPerUser) SendMaxOfGaugesPerUser ¶ added in v1.6.0
func (d MetricFamiliesPerUser) SendMaxOfGaugesPerUser(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string)
func (MetricFamiliesPerUser) SendSumOfCounters ¶ added in v0.6.0
func (d MetricFamiliesPerUser) SendSumOfCounters(out chan<- prometheus.Metric, desc *prometheus.Desc, counter string)
func (MetricFamiliesPerUser) SendSumOfCountersPerUser ¶ added in v0.6.0
func (d MetricFamiliesPerUser) SendSumOfCountersPerUser(out chan<- prometheus.Metric, desc *prometheus.Desc, counter string)
func (MetricFamiliesPerUser) SendSumOfCountersPerUserWithLabels ¶ added in v1.3.0
func (d MetricFamiliesPerUser) SendSumOfCountersPerUserWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, metric string, labelNames ...string)
SendSumOfCountersPerUserWithLabels provides metrics with the provided label names on a per-user basis. This function assumes that `user` is the first label on the provided metric Desc
func (MetricFamiliesPerUser) SendSumOfCountersWithLabels ¶ added in v0.6.0
func (d MetricFamiliesPerUser) SendSumOfCountersWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, counter string, labelNames ...string)
func (MetricFamiliesPerUser) SendSumOfGauges ¶ added in v0.6.0
func (d MetricFamiliesPerUser) SendSumOfGauges(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string)
func (MetricFamiliesPerUser) SendSumOfGaugesPerUser ¶ added in v1.6.0
func (d MetricFamiliesPerUser) SendSumOfGaugesPerUser(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string)
func (MetricFamiliesPerUser) SendSumOfGaugesPerUserWithLabels ¶ added in v0.7.0
func (d MetricFamiliesPerUser) SendSumOfGaugesPerUserWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, metric string, labelNames ...string)
SendSumOfGaugesPerUserWithLabels provides metrics with the provided label names on a per-user basis. This function assumes that `user` is the first label on the provided metric Desc
func (MetricFamiliesPerUser) SendSumOfGaugesWithLabels ¶ added in v0.6.0
func (d MetricFamiliesPerUser) SendSumOfGaugesWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, gauge string, labelNames ...string)
func (MetricFamiliesPerUser) SendSumOfHistograms ¶ added in v0.6.0
func (d MetricFamiliesPerUser) SendSumOfHistograms(out chan<- prometheus.Metric, desc *prometheus.Desc, histogramName string)
func (MetricFamiliesPerUser) SendSumOfHistogramsWithLabels ¶ added in v1.0.0
func (d MetricFamiliesPerUser) SendSumOfHistogramsWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, histogramName string, labelNames ...string)
func (MetricFamiliesPerUser) SendSumOfSummaries ¶ added in v0.6.0
func (d MetricFamiliesPerUser) SendSumOfSummaries(out chan<- prometheus.Metric, desc *prometheus.Desc, summaryName string)
func (MetricFamiliesPerUser) SendSumOfSummariesPerUser ¶ added in v1.3.0
func (d MetricFamiliesPerUser) SendSumOfSummariesPerUser(out chan<- prometheus.Metric, desc *prometheus.Desc, summaryName string)
func (MetricFamiliesPerUser) SendSumOfSummariesWithLabels ¶ added in v0.6.0
func (d MetricFamiliesPerUser) SendSumOfSummariesWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, summaryName string, labelNames ...string)
type MetricFamilyMap ¶ added in v0.7.0
type MetricFamilyMap map[string]*dto.MetricFamily
MetricFamilyMap is a map of metric names to their family (metrics with same name, but different labels) Keeping map of metric name to its family makes it easier to do searches later.
func MergeMetricFamilies ¶ added in v1.14.0
func MergeMetricFamilies(metricFamilies []MetricFamilyMap) (MetricFamilyMap, error)
MergeMetricFamilies - Capable of merging summaries, histograms, and counters
func NewMetricFamilyMap ¶ added in v0.7.0
func NewMetricFamilyMap(metrics []*dto.MetricFamily) (MetricFamilyMap, error)
NewMetricFamilyMap sorts output from Gatherer.Gather method into a map. Gatherer.Gather specifies that there metric families are uniquely named, and we use that fact here. If they are not, this method returns error.
func (MetricFamilyMap) MaxGauges ¶ added in v0.7.0
func (mfm MetricFamilyMap) MaxGauges(name string) float64
func (MetricFamilyMap) SumCounters ¶ added in v0.7.0
func (mfm MetricFamilyMap) SumCounters(name string) float64
func (MetricFamilyMap) SumGauges ¶ added in v0.7.0
func (mfm MetricFamilyMap) SumGauges(name string) float64
func (MetricFamilyMap) SumHistograms ¶ added in v0.7.0
func (mfm MetricFamilyMap) SumHistograms(name string) HistogramData
func (MetricFamilyMap) SumHistogramsTo ¶ added in v0.7.0
func (mfm MetricFamilyMap) SumHistogramsTo(name string, output *HistogramData)
func (MetricFamilyMap) SumSummaries ¶ added in v0.7.0
func (mfm MetricFamilyMap) SumSummaries(name string) SummaryData
func (MetricFamilyMap) SumSummariesTo ¶ added in v0.7.0
func (mfm MetricFamilyMap) SumSummariesTo(name string, output *SummaryData)
type MetricMap ¶ added in v1.14.0
type MetricMap struct {
// contains filtered or unexported fields
}
func NewMetricMap ¶ added in v1.14.0
func NewMetricMap() MetricMap
func (*MetricMap) AddOrSetMetric ¶ added in v1.14.0
func (m *MetricMap) AddOrSetMetric(metric *dto.Metric, mergeFn func(existing *dto.Metric, new *dto.Metric))
AddOrSetMetric - given a metric, see if there's another metric with the same labels. If not, add metric to list If yes, call mergeFn to merge the two metrics in-place, and updating existing metric
type Op ¶
type Op interface { Key() string Priority() int64 // The larger the number the higher the priority. }
Op is an operation on the priority queue.
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue is a priority queue.
func NewPriorityQueue ¶
func NewPriorityQueue(lengthGauge prometheus.Gauge) *PriorityQueue
NewPriorityQueue makes a new priority queue.
func (*PriorityQueue) Close ¶
func (pq *PriorityQueue) Close()
Close signals that the queue should be closed when it is empty. A closed queue will not accept new items.
func (*PriorityQueue) Dequeue ¶
func (pq *PriorityQueue) Dequeue() Op
Dequeue will return the op with the highest priority; block if queue is empty; returns nil if queue is closed.
func (*PriorityQueue) DiscardAndClose ¶
func (pq *PriorityQueue) DiscardAndClose()
DiscardAndClose closes the queue and removes all the items from it.
func (*PriorityQueue) Enqueue ¶
func (pq *PriorityQueue) Enqueue(op Op) bool
Enqueue adds an operation to the queue in priority order. Returns true if added; false if the operation was already on the queue.
func (*PriorityQueue) Length ¶
func (pq *PriorityQueue) Length() int
Length returns the length of the queue.
type SampleStreamIterator ¶
type SampleStreamIterator struct {
// contains filtered or unexported fields
}
SampleStreamIterator is a struct and not just a renamed type because otherwise the Metric field and Metric() methods would clash.
func NewSampleStreamIterator ¶
func NewSampleStreamIterator(ss *model.SampleStream) SampleStreamIterator
NewSampleStreamIterator creates a SampleStreamIterator
func (SampleStreamIterator) Close ¶
func (it SampleStreamIterator) Close()
Close implements the SeriesIterator interface.
func (SampleStreamIterator) Metric ¶
func (it SampleStreamIterator) Metric() metric.Metric
Metric implements the SeriesIterator interface.
func (SampleStreamIterator) RangeValues ¶
func (it SampleStreamIterator) RangeValues(in metric.Interval) []model.SamplePair
RangeValues implements the SeriesIterator interface.
func (SampleStreamIterator) ValueAtOrBeforeTime ¶
func (it SampleStreamIterator) ValueAtOrBeforeTime(ts model.Time) model.SamplePair
ValueAtOrBeforeTime implements the SeriesIterator interface.
type SummaryData ¶ added in v0.7.0
type SummaryData struct {
// contains filtered or unexported fields
}
SummaryData keeps all data needed to create summary metric
func (*SummaryData) AddSummary ¶ added in v0.7.0
func (s *SummaryData) AddSummary(sum *dto.Summary)
func (*SummaryData) Metric ¶ added in v0.7.0
func (s *SummaryData) Metric(desc *prometheus.Desc, labelValues ...string) prometheus.Metric
type UserRegistries ¶ added in v1.6.0
type UserRegistries struct {
// contains filtered or unexported fields
}
UserRegistries holds Prometheus registries for multiple users, guaranteeing multi-thread safety and stable ordering.
func NewUserRegistries ¶ added in v1.6.0
func NewUserRegistries() *UserRegistries
NewUserRegistries makes new UserRegistries.
func (*UserRegistries) AddUserRegistry ¶ added in v1.6.0
func (r *UserRegistries) AddUserRegistry(user string, reg *prometheus.Registry)
AddUserRegistry adds an user registry. If user already has a registry, previous registry is removed, but latest metric values are preserved in order to avoid counter resets.
func (*UserRegistries) BuildMetricFamiliesPerUser ¶ added in v1.6.0
func (r *UserRegistries) BuildMetricFamiliesPerUser() MetricFamiliesPerUser
func (*UserRegistries) Registries ¶ added in v1.6.0
func (r *UserRegistries) Registries() []UserRegistry
Registries returns a copy of the user registries list.
func (*UserRegistries) RemoveUserRegistry ¶ added in v1.6.0
func (r *UserRegistries) RemoveUserRegistry(user string, hard bool)
RemoveUserRegistry removes all Prometheus registries for a given user. If hard is true, registry is removed completely. If hard is false, latest registry values are preserved for future aggregations.
type UserRegistry ¶ added in v1.6.0
type UserRegistry struct {
// contains filtered or unexported fields
}
UserRegistry holds a Prometheus registry associated to a specific user.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package fakeauth provides middlewares thats injects a fake userID, so the rest of the code can continue to be multitenant.
|
Package fakeauth provides middlewares thats injects a fake userID, so the rest of the code can continue to be multitenant. |
grpcencoding
|
|