# Packages
Package fakeauth provides middlewares thats injects a fake userID, so the rest of the code can continue to be multitenant.
Package marshal converts internal objects to loghttp model objects.
# Functions
AllNonGreedy turns greedy quantifiers such as `.*` and `.+` into non-greedy ones.
ClearCapture removes capture operation as they are not used for filtering.
CopyMap makes a copy of the given map.
DeleteMatchingLabels removes metric with labels matching the filter.
DurationWithJitter returns random duration from "input - input*variance" to "input + input*variance" interval.
DurationWithPositiveJitter returns random duration from "input" to "input + input*variance" interval.
Event is the log-like API for event sampling.
ForInterval splits the given start and end time into given interval.
FormatTimeMillis returns a human readable version of the input time (in milliseconds).
FormatTimeModel returns a human readable version of the input time.
FromLabelPairsToLabels converts dto.LabelPair into labels.Labels.
GetFactorOfTime returns the percentage of time that the span `from` to `through` accounts for inside the range `minTime` to `maxTime`.
GetFirstAddressOf returns the first IPv4 address of the supplied interface names, omitting any 169.254.x.x automatic private IPs if possible.
GetLabels returns list of label combinations used by this collector at the time of call.
GetSumOfHistogramSampleCount returns the sum of samples count of histograms matching the provided metric name and optional label matchers.
HashedQuery returns a unique hash value for the given `query`.
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.
HumanizeBytes returns a human readable string representation of the given byte value and removes all whitespaces.
InitEvents initializes event sampling, with the given frequency.
IsConnCanceled returns true, if error is from a closed gRPC connection.
IsRequestBodyTooLarge returns true if the error is "http: request body too large".
LabelsToMetric converts a Labels to Metric Don't do this on any performance sensitive paths.
LogConfig takes a pointer to a config object, marshalls it to YAML and prints each line in REVERSE order The reverse order makes display in Grafana in easier which typically sorts newest entries at the top.
LogError logs any error returned by f; useful when deferring Close etc.
LogError logs any error returned by f; useful when deferring Close etc.
MapToModelLabelSet converts a map into a model.LabelSet.
MergeMaps merges the overlay map onto the base map, with overlay taking precedence NOTE: this treats the given base and overlay maps as immutable, and returns a copy.
MergeNSampleSets merges and dedupes n sets of already sorted sample pairs.
MergeSampleSets merges and dedupes two sets of already sorted sample pairs.
ModelLabelSetToMap convert a model.LabelSet to a map[string]string.
NewAllowedTenants builds new allowed tenants based on enabled and disabled tenants.
NewDisableableTicker essentially wraps NewTicker but allows the ticker to be disabled by passing zero duration as the interval.
NewDNSWatcher creates a new DNS watcher and returns a service that is wrapping it.
NewGenMap created which maintains at most maxSize recently used entries.
NewHistogramDataCollector creates new histogram data collector.
NewJitter returns a Jitter object that creates durations with random jitter.
NewMetricFamilyMap sorts output from Gatherer.Gather method into a map.
NewPriorityQueue makes a new priority queue.
NewRingWatcher creates a new Ring watcher and returns a service that is wrapping it.
NewSizeReader returns an io.Reader that will have the number of bytes read from r available.
NewTickerWithJitter returns a new Ticker-like object, but instead of a constant tick duration, it adds random +/- dev to each iteration.
NewUniqueStrings returns a UniqueStrings instance with a pre-allocated result buffer.
NewUserRegistries makes new UserRegistries.
ParseProtoReader parses a compressed proto from an io.Reader.
ParseTime parses the string into an int64, milliseconds since epoch.
PrepareLabelsAndMatchers is used by the ingester and index gateway to service volume requests.
PrintConfig will takes a pointer to a config object, marshalls it to YAML and prints the result to the provided writer unlike LogConfig, PrintConfig prints the object in naturally ocurring order.
RegisterCounterVec registers new CounterVec with given name,namespace and labels.
RenderHTTPResponse either responds with json or a rendered html page using the passed in template by checking the Accepts header.
RoundToMilliseconds returns milliseconds precision time from nanoseconds.
SerializeProtoResponse serializes a protobuf response into an HTTP response.
ShuffleShardExpectedInstances returns the total number of instances that should be selected for a given tenant.
ShuffleShardExpectedInstancesPerZone returns the number of instances that should be selected for each zone when zone-aware replication is enabled.
ShuffleShardSeed returns seed for random number generator, computed from provided identifier.
SnakeCase converts given string `s` into `snake_case`.
SplitFiltersAndMatchers splits empty matchers off, which are treated as filters, see #220.
StreamWriteYAMLResponse stream writes data as http response.
StringsContain returns true if the search value is within the list of input values.
TimeFromMillis is a helper to turn milliseconds -> time.Time.
Sends message as text/html response with 200 status code.
WriteJSONResponse writes some JSON as a HTTP response.
Sends message as text/plain response with 200 status code.
WriteYAMLResponse writes some YAML as a HTTP response.
# Constants
Values for CompressionType.
Values for CompressionType.
ShardingAlgoByGroup is an alias of ShardingStrategyDefault.
this will eventually become the new default strategy.
ShardingStrategyDefault shards rule groups across available rulers in the ring.
ShardingStrategyShuffle shards tenants' rule groups across available rulers in the ring using a shuffle-sharding algorithm.
# Structs
ActiveUsers keeps track of latest user's activity timestamp, and allows purging users that are no longer active.
ActiveUsersCleanupService tracks active users, and periodically purges inactive ones while running.
AllowedTenants that can answer whether tenant is allowed or not based on configuration.
BasicAuth configures basic authentication for HTTP clients.
GroupedErrors implements the error interface, and it contains the errors used to construct it grouped by the error message.
HeaderAuth condigures header based authorization for HTTP clients.
HistogramData keeps data required to build histogram Metric.
HistogramDataCollector combines histogram data, with prometheus descriptor.
PriorityQueue is a priority queue.
SummaryData keeps all data needed to create summary metric.
UniqueStrings keeps a slice of unique strings.
UserRegistries holds Prometheus registries for multiple users, guaranteeing multi-thread safety and stable ordering.
UserRegistry holds a Prometheus registry associated to a specific user.
# Interfaces
CollectorVec is a collector that can delete metrics by labels.
Notifications about address resolution.
IngesterQueryOptions exists because querier.Config cannot be passed directly to the queryrange package due to an import cycle.
Op is an operation on the priority queue.
# Type aliases
CompressionType for encoding and decoding requests and responses.
MetricFamiliesPerUser is a collection of metrics gathered via calling Gatherer.Gather() method on different gatherers, one per user.
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.
MetricLabelTransformFunc exists in ruler package, but that would create a cyclic import, so is duplicated here.
The MultiError type implements the error interface, and contains the Errors used to construct it.