From 29613afe99b6a84bcadabf28350e6018150019c4 Mon Sep 17 00:00:00 2001 From: Nicole Chung Date: Fri, 6 Mar 2026 10:44:26 -0500 Subject: [PATCH 1/2] [CONTP-1260] added config for COAT metrics --- comp/core/agenttelemetry/impl/config.go | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/comp/core/agenttelemetry/impl/config.go b/comp/core/agenttelemetry/impl/config.go index 34560fc7dfd4ac..7a161d6f339df4 100644 --- a/comp/core/agenttelemetry/impl/config.go +++ b/comp/core/agenttelemetry/impl/config.go @@ -465,6 +465,56 @@ var defaultProfiles = ` - tag - bucket - outcome + - name: admission_webhooks.mutation_attempts + aggregate_tags: + - mutation_type + - status + - injected + - name: admission_webhooks.library_injection_attempts + aggregate_tags: + - language + - injected + - auto_detected + - injection_type + - name: admission_webhooks.library_injection_errors + aggregate_tags: + - language + - auto_detected + - injection_type + - name: admission_webhooks.patcher_errors + - name: admission_webhooks.rc_provider_configs + - name: admission_webhooks.rc_provider_configs_invalid + - name: autodiscovery.errors + aggregate_tags: + - provider + - name: autodiscovery.watched_resources + aggregate_tags: + - listener + - kind + - name: cluster_checks.configs_dispatched + - name: cluster_checks.configs_dangling + - name: cluster_checks.unscheduled_check + aggregate_tags: + - config_source + - name: external_metrics.datadog_metrics + aggregate_tags: + - valid + - active + - name: language_detection_patcher.patches + aggregate_tags: + - owner_kind + - status + - name: workloadmeta.stored_entities + aggregate_tags: + - kind + - source + - name: tagger.stored_entities + aggregate_tags: + - source + - prefix + - name: workloadmeta.pull_errors + aggregate_tags: + - collector_id schedule: start_after: 30 iterations: 0 From 98b372f3115adcc7ed96dc41dc0ed60d31a7647c Mon Sep 17 00:00:00 2001 From: Nicole Chung Date: Mon, 23 Mar 2026 11:46:35 -0400 Subject: [PATCH 2/2] [CONTP-1260] fixed double underscore issue --- comp/core/agenttelemetry/impl/config.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/comp/core/agenttelemetry/impl/config.go b/comp/core/agenttelemetry/impl/config.go index 7a161d6f339df4..a9306020f1d59a 100644 --- a/comp/core/agenttelemetry/impl/config.go +++ b/comp/core/agenttelemetry/impl/config.go @@ -602,11 +602,18 @@ func compileMetric(p *Profile, m *MetricConfig) error { return fmt.Errorf("profile '%s' 'metrics[].name' '(%s)' attribute should have two elements separated by '.'", p.Name, m.Name) } - // Converts a Datadog metric name to a Prometheus metric name for quicker matching. Prometheus metrics - // (from the "telemetry" package) must be declared without setting Options.NoDoubleUnderscoreSep to true, - // ensuring the full metric name includes double underscores ("__"); otherwise, matching will fail. - promName := fmt.Sprintf("%s__%s", names[0], names[1]) - p.metricsMap[promName] = m + // Converts a Datadog metric name to a Prometheus metric name for quicker matching. + // Register both double-underscore ("__") and single-underscore ("_") forms so that + // metrics declared with or without Options.NoDoubleUnderscoreSep are matched. + // + // NOTE: if two different COAT config entries produce the same single-underscore key + // (e.g. "foo_bar.baz" and "foo.bar_baz" both collapse to "foo_bar_baz"), the second + // entry silently overwrites the first. This can only happen when a subsystem name + // itself contains underscores, so avoid that when naming new metrics. + promNameDouble := fmt.Sprintf("%s__%s", names[0], names[1]) + promNameSingle := fmt.Sprintf("%s_%s", names[0], names[1]) + p.metricsMap[promNameDouble] = m + p.metricsMap[promNameSingle] = m // Compile aggregate tags (optional) if len(m.AggregateTags) == 0 {