Skip to content

Commit

Permalink
feat(metrics): Define allowlist for histogram metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
rnishtala-sumo committed Aug 6, 2024
1 parent b6c474c commit f4296f3
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 22 deletions.
1 change: 1 addition & 0 deletions .changelog/3821.added.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat(metrics): Define allowlist for histogram metrics
1 change: 1 addition & 0 deletions deploy/helm/sumologic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ The following table lists the configurable parameters of the Sumo Logic chart an
| `sumologic.metrics.collector.otelcol.config.override` | Configuration for otelcol metrics collector, replaces defaults. See also https://github.com/SumoLogic/sumologic-otel-collector/blob/main/docs/configuration.md. | {} |
| `sumologic.metrics.collector.otelcol.targetAllocator.resources` | Resource requests and limits for Metrics Collector Target Allocator. | {} |
| `sumologic.metrics.dropHistogramBuckets` | Drop buckets from histogram and summary metrics, leaving only the sum and count components. | `true` |
| `sumologic.metrics.allowHistogramRegex` | Allowlist for Histogram metrics, including the buckets | "" |
| `sumologic.metrics.sourceType` | The type of the Sumo Logic source being used for metrics ingestion. Can be `http` or `otlp`. | `otlp` |
| `sumologic.traces.enabled` | Set the enabled flag to true to enable tracing ingestion. _Tracing must be enabled for the account first. Please contact your Sumo representative for activation details_ | `true` |
| `sumologic.traces.spans_per_request` | Maximum number of spans sent in single batch | `100` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ processors:
metric_statements:
- context: metric
statements:
- extract_sum_metric(true) where type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_count_metric(true) where type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_sum_metric(true) where not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_count_metric(true) where not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
{{- end }}

receivers:
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/conf/metrics/otelcol/processors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ filter/drop_unnecessary_metrics:
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*")
{{- if .Values.sumologic.metrics.dropHistogramBuckets }}
# drop histograms we've extracted sums and counts from, but don't want the full thing
- type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
- not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
{{- end }}

# Prometheus receiver puts all labels in record-level attributes, and we need them in resource
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ sumologic:
## - kubelet_runtime_operations_duration_seconds
dropHistogramBuckets: true

# A regular expression to allow selected histogram metrics, including the buckets.
allowHistogramRegex: ""

## A regular expression for namespaces.
## Metrics that match these namespaces will be excluded from Sumo.
excludeNamespaceRegex: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ data:
metrics:
metric:
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*")
- type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
- not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type
== METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
groupbyattrs:
keys:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ data:
metrics:
metric:
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*")
- type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
- not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type
== METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
groupbyattrs:
keys:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ data:
metrics:
metric:
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*")
- type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
- not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type
== METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
groupbyattrs:
keys:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ data:
metrics:
metric:
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*")
- type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
- not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type
== METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
groupbyattrs:
keys:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ data:
metrics:
metric:
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*")
- type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
- not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type
== METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
groupbyattrs:
keys:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ data:
metrics:
metric:
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*")
- type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
- not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type
== METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
groupbyattrs:
keys:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ data:
metrics:
metric:
- resource.attributes["job"] != "pod-annotations" and IsMatch(name, "scrape_.*")
- type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
- not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex) and type
== METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY or IsMatch(name, ".*_bucket")
groupbyattrs:
keys:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ spec:
metric_statements:
- context: metric
statements:
- extract_sum_metric(true) where type == METRIC_DATA_TYPE_HISTOGRAM or type
== METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_count_metric(true) where type == METRIC_DATA_TYPE_HISTOGRAM or type
== METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_sum_metric(true) where not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex)
and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY
- extract_count_metric(true) where not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex)
and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY
receivers:
prometheus:
config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ spec:
metric_statements:
- context: metric
statements:
- extract_sum_metric(true) where type == METRIC_DATA_TYPE_HISTOGRAM or type
== METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_count_metric(true) where type == METRIC_DATA_TYPE_HISTOGRAM or type
== METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_sum_metric(true) where not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex)
and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY
- extract_count_metric(true) where not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex)
and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY
receivers:
prometheus:
config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ spec:
metric_statements:
- context: metric
statements:
- extract_sum_metric(true) where type == METRIC_DATA_TYPE_HISTOGRAM or type
== METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_count_metric(true) where type == METRIC_DATA_TYPE_HISTOGRAM or type
== METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM or type == METRIC_DATA_TYPE_SUMMARY
- extract_sum_metric(true) where not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex)
and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY
- extract_count_metric(true) where not IsMatch(name, .Values.sumologic.metrics.allowHistogramRegex)
and type == METRIC_DATA_TYPE_HISTOGRAM or type == METRIC_DATA_TYPE_EXPONENTIAL_HISTOGRAM
or type == METRIC_DATA_TYPE_SUMMARY
receivers:
prometheus:
config:
Expand Down

0 comments on commit f4296f3

Please sign in to comment.