Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion deploy/helm/metrics-collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ processors:
- set(resource.attributes["sw.k8s.cluster.uid"], "${CLUSTER_UID}")
- set(resource.attributes["k8s.cluster.name"], "${CLUSTER_NAME}")

- set(datapoint.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(resource.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
Copy link
Contributor

@mpecenka mpecenka Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this could malform data in case there will be multiple datapoints with different namespaces.
You do not need this at all, just move the filter/namespace after groupbyattrs/trivy-operator-metrics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea that works

- set(datapoint.attributes[Format("k8s.%s.name",[ToLowerCase(datapoint.attributes["resource_kind"])])], datapoint.attributes["resource_name"])

transform/trivy-operator-metrics-split:
Expand Down Expand Up @@ -1170,6 +1170,9 @@ service:
- memory_limiter
- filter/trivy-operator-metrics
- transform/trivy-operator-metrics-attributes
{{- if eq (include "isNamespacesFilterEnabled" .) "true" }}
- filter/namespaces
{{- end }}
- metricstransform/rename
- groupbyattrs/trivy-operator-metrics
- metricstransform/trivy-operator-metrics-aggregation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ Metrics config should match snapshot when using default values:
- set(resource.attributes["sw.k8s.agent.app.version"], "${APP_VERSION}")
- set(resource.attributes["sw.k8s.cluster.uid"], "${CLUSTER_UID}")
- set(resource.attributes["k8s.cluster.name"], "${CLUSTER_NAME}")
- set(datapoint.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(resource.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(datapoint.attributes[Format("k8s.%s.name",[ToLowerCase(datapoint.attributes["resource_kind"])])],
datapoint.attributes["resource_name"])
transform/trivy-operator-metrics-split:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ Metrics config should match snapshot when fargate is enabled:
- set(resource.attributes["sw.k8s.agent.app.version"], "${APP_VERSION}")
- set(resource.attributes["sw.k8s.cluster.uid"], "${CLUSTER_UID}")
- set(resource.attributes["k8s.cluster.name"], "${CLUSTER_NAME}")
- set(datapoint.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(resource.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(datapoint.attributes[Format("k8s.%s.name",[ToLowerCase(datapoint.attributes["resource_kind"])])],
datapoint.attributes["resource_name"])
transform/trivy-operator-metrics-split:
Expand Down Expand Up @@ -3275,7 +3275,7 @@ Metrics config should match snapshot when using Prometheus url with extra_scrape
- set(resource.attributes["sw.k8s.agent.app.version"], "${APP_VERSION}")
- set(resource.attributes["sw.k8s.cluster.uid"], "${CLUSTER_UID}")
- set(resource.attributes["k8s.cluster.name"], "${CLUSTER_NAME}")
- set(datapoint.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(resource.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(datapoint.attributes[Format("k8s.%s.name",[ToLowerCase(datapoint.attributes["resource_kind"])])],
datapoint.attributes["resource_name"])
transform/trivy-operator-metrics-split:
Expand Down Expand Up @@ -5001,7 +5001,7 @@ Metrics config should match snapshot when using default values:
- set(resource.attributes["sw.k8s.agent.app.version"], "${APP_VERSION}")
- set(resource.attributes["sw.k8s.cluster.uid"], "${CLUSTER_UID}")
- set(resource.attributes["k8s.cluster.name"], "${CLUSTER_NAME}")
- set(datapoint.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(resource.attributes["k8s.namespace.name"], datapoint.attributes["namespace"])
- set(datapoint.attributes[Format("k8s.%s.name",[ToLowerCase(datapoint.attributes["resource_kind"])])],
datapoint.attributes["resource_name"])
transform/trivy-operator-metrics-split:
Expand Down
Loading