High cardinality metrics in k8s environments #8628
-
Hello to everyone! Some vector metrics have potentially unbound cardinality, like following:
Because each metrics contains label "file" (autogenerated by log driver) or "pod_name" (autogenertated by k8s). sources:
kubernetes_logs:
type: kubernetes_logs
internal_metrics:
type: internal_metrics
transforms:
prometheus_sink_transform_cleanup:
inputs:
- internal_metrics
source: |
del(.tags.file)
del(.tags.pod_name)
type: remap
prometheus_sink_transform_aggregate:
inputs:
- prometheus_sink_transform_cleanup
type: aggregate
sinks:
prometheus_sink:
address: 0.0.0.0:9090
inputs:
- prometheus_sink_transform_aggregate
type: prometheus_exporter Here first remap transform is used to delete high cardinality tags and then aggregate transform is used to aggregate multiple metric events values to a single metric event. (before transform)
(after transform):
I also read about tag cardinality limit. But it seems, this transform is more like a safeguard for high cardinality metrics. Is there any way to drop high cardinality tags and aggregate metric values? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hey! Is this a preventative step or are you seeing cardinality issue while running today. I would have expected a |
Beta Was this translation helpful? Give feedback.
-
Hi all, just wanted to report I am also seeing high cardinality on I will try to add the transform that @ArtemTrofimushkin is using. @jszwedko @spencergilbert Do you think this situation deserves a few lines in documents? |
Beta Was this translation helpful? Give feedback.
Hey! Is this a preventative step or are you seeing cardinality issue while running today. I would have expected a
counter
being run throughaggregate
to sum the metrics, I'll see if I can check the code and verify that's the intended behavior forcounter
metrics.