Skip to content

rename metrics #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kind: Kustomization
images:
- name: controller
newName: ghcr.io/kube-logging/telemetry-controller
newTag: latest
newTag: 0.0.4
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ processors:
- action: insert
key: loki.attribute.labels
value: tenant
attributes/metricattributes:
actions:
- action: insert
key: app
from_attribute: k8s.pod.labels.app.kubernetes.io/name
- action: insert
key: host
from_attribute: k8s.node.name
- action: insert
key: namespace
from_attribute: k8s.namespace.name
- action: insert
key: container
from_attribute: k8s.container.name
- action: insert
key: pod
from_attribute: k8s.pod.name
attributes/subscription_subscription-example-1:
actions:
- action: insert
Expand Down Expand Up @@ -304,9 +321,9 @@ service:
exporters: [routing/subscription_example-tenant-b-ns_subscription-example-3_outputs]
metrics/output:
receivers: [count/output_metrics]
processors: [memory_limiter, deltatocumulative]
processors: [memory_limiter, deltatocumulative, attributes/metricattributes]
exporters: [prometheus/message_metrics_exporter]
metrics/tenant:
receivers: [count/tenant_metrics]
processors: [memory_limiter, deltatocumulative]
processors: [memory_limiter, deltatocumulative, attributes/metricattributes]
exporters: [prometheus/message_metrics_exporter]
34 changes: 32 additions & 2 deletions internal/controller/telemetry/otel_conf_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,36 @@ func generateMetricsProcessors() map[string]any {

metricsProcessors["deltatocumulative"] = DeltatoCumulativeConfig{}

metricsProcessors["attributes/metricattributes"] = AttributesProcessor{
Actions: []AttributesProcessorAction{
{
Action: "insert",
Key: "app",
FromAttribute: "k8s.pod.labels.app.kubernetes.io/name",
},
{
Action: "insert",
Key: "host",
FromAttribute: "k8s.node.name",
},
{
Action: "insert",
Key: "namespace",
FromAttribute: "k8s.namespace.name",
},
{
Action: "insert",
Key: "container",
FromAttribute: "k8s.container.name",
},
{
Action: "insert",
Key: "pod",
FromAttribute: "k8s.pod.name",
},
},
}

return metricsProcessors
}

Expand Down Expand Up @@ -654,13 +684,13 @@ func generateMetricsPipelines() map[string]Pipeline {

metricsPipelines["metrics/tenant"] = Pipeline{
Receivers: []string{"count/tenant_metrics"},
Processors: []string{"deltatocumulative"},
Processors: []string{"deltatocumulative", "attributes/metricattributes"},
Exporters: []string{"prometheus/message_metrics_exporter"},
}

metricsPipelines["metrics/output"] = Pipeline{
Receivers: []string{"count/output_metrics"},
Processors: []string{"deltatocumulative"},
Processors: []string{"deltatocumulative", "attributes/metricattributes"},
Exporters: []string{"prometheus/message_metrics_exporter"},
}

Expand Down