From 29a38e1996c4f13483402f6125c2ab619acb037e Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Mon, 16 Oct 2023 12:25:01 +0200 Subject: [PATCH] Rename func, add doc --- docs/api.md | 15 +++++++++++++-- pkg/pipeline/encode/encode_prom_test.go | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/api.md b/docs/api.md index 25d94723e..894052604 100644 --- a/docs/api.md +++ b/docs/api.md @@ -13,13 +13,24 @@ Following is the supported API format for prometheus encode: agg_histogram: counts samples in configurable buckets, pre-aggregated via an Aggregate stage filter: an optional criterion to filter entries by. Deprecated: use filters instead. key: the key to match and filter by - value: the value to match and filter by. Use !nil / nil to match presence / absence. Add multiple matching values using '|' rune such as 'a|b' to match either 'a' or 'b'. + value: the value to match and filter by + type: (enum) the type of filter match: exact (default), presence, absence or regex + exact: match exactly the provided fitler value + presence: filter key must be present (filter value is ignored) + absence: filter key must be absent (filter value is ignored) + regex: match filter value as a regular expression filters: a list of criteria to filter entries by key: the key to match and filter by - value: the value to match and filter by. Use !nil / nil to match presence / absence. Add multiple matching values using '|' rune such as 'a|b' to match either 'a' or 'b'. + value: the value to match and filter by + type: (enum) the type of filter match: exact (default), presence, absence or regex + exact: match exactly the provided fitler value + presence: filter key must be present (filter value is ignored) + absence: filter key must be absent (filter value is ignored) + regex: match filter value as a regular expression valueKey: entry key from which to resolve metric value labels: labels to be associated with the metric buckets: histogram buckets + valueScale: scale factor of the value (MetricVal := FlowVal / Scale) prefix: prefix added to each metric name expiryTime: time duration of no-flow to wait before deleting prometheus data item maxMetrics: maximum number of metrics to report (default: unlimited) diff --git a/pkg/pipeline/encode/encode_prom_test.go b/pkg/pipeline/encode/encode_prom_test.go index 828d5600e..b3332212c 100644 --- a/pkg/pipeline/encode/encode_prom_test.go +++ b/pkg/pipeline/encode/encode_prom_test.go @@ -523,7 +523,7 @@ func buildFlow() config.GenericMap { } } -func hundredFlows() []config.GenericMap { +func thousandsFlows() []config.GenericMap { flows := make([]config.GenericMap, 1000) for i := 0; i < 1000; i++ { flows[i] = buildFlow() @@ -573,7 +573,7 @@ func BenchmarkPromEncode(b *testing.B) { require.NoError(b, err) for i := 0; i < b.N; i++ { - for _, metric := range hundredFlows() { + for _, metric := range thousandsFlows() { prom.Encode(metric) } }