diff --git a/comp/core/agenttelemetry/impl/config.go b/comp/core/agenttelemetry/impl/config.go index 34560fc7dfd4ac..a9306020f1d59a 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 @@ -552,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 {