diff --git a/.chloggen/munir_add-option-to-avoid-remapping.yaml b/.chloggen/munir_add-option-to-avoid-remapping.yaml new file mode 100644 index 000000000000..35efaef6a6fd --- /dev/null +++ b/.chloggen/munir_add-option-to-avoid-remapping.yaml @@ -0,0 +1,13 @@ +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: datadogexporter + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Adds exporter.datadogexporter.metricremappingdisabled featuregate which disables renaming OpenTelemetry metrics to match Datadog semantics. This feature gate is only for internal use." + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [35025] + +# Optional: A list of users who contributed to the change. This is used to generate the list of contributors in the changelog. +change_logs: [] diff --git a/exporter/datadogexporter/factory.go b/exporter/datadogexporter/factory.go index 0a2381cda977..ec13fbbd63d0 100644 --- a/exporter/datadogexporter/factory.go +++ b/exporter/datadogexporter/factory.go @@ -53,6 +53,13 @@ var metricExportNativeClientFeatureGate = featuregate.GlobalRegistry().MustRegis featuregate.WithRegisterDescription("When enabled, metric export in datadogexporter uses native Datadog client APIs instead of Zorkian APIs."), ) +var metricRemappingDisableddFeatureGate = featuregate.GlobalRegistry().MustRegister( + "exporter.datadogexporter.metricremappingdisabled", + featuregate.StageAlpha, + featuregate.WithRegisterDescription("When enabled the Datadog Exporter remaps OpenTelemetry semantic conventions to Datadog semantic conventions. This feature gate is only for internal use."), + featuregate.WithRegisterReferenceURL("https://docs.datadoghq.com/opentelemetry/schema_semantics/metrics_mapping/"), +) + // noAPMStatsFeatureGate causes the trace consumer to skip APM stats computation. var noAPMStatsFeatureGate = featuregate.GlobalRegistry().MustRegister( "exporter.datadogexporter.DisableAPMStats", @@ -65,6 +72,11 @@ func isMetricExportV2Enabled() bool { return metricExportNativeClientFeatureGate.IsEnabled() } +// isMetricRemappingDisabled returns true if the datadogexporter should generate Datadog-compliant metrics from OpenTelemetry metrics +func isMetricRemappingDisabled() bool { + return metricRemappingDisableddFeatureGate.IsEnabled() +} + func isLogsAgentExporterEnabled() bool { return logsAgentExporterFeatureGate.IsEnabled() } diff --git a/exporter/datadogexporter/metrics_exporter.go b/exporter/datadogexporter/metrics_exporter.go index 6fa87508f40f..c6846807bd77 100644 --- a/exporter/datadogexporter/metrics_exporter.go +++ b/exporter/datadogexporter/metrics_exporter.go @@ -55,7 +55,12 @@ func translatorFromConfig(set component.TelemetrySettings, cfg *Config, attrsTra options := []otlpmetrics.TranslatorOption{ otlpmetrics.WithDeltaTTL(cfg.Metrics.DeltaTTL), otlpmetrics.WithFallbackSourceProvider(sourceProvider), - otlpmetrics.WithRemapping(), + } + + if isMetricRemappingDisabled() { + set.Logger.Warn("Metric remapping is disabled in the Datadog exporter. OpenTelemetry metrics must be mapped to Datadog semantics before metrics are exported to Datadog (ex: via a processor).") + } else { + options = append(options, otlpmetrics.WithRemapping()) } if cfg.Metrics.HistConfig.SendAggregations {