Skip to content

Commit 59b9dd2

Browse files
mabdinursongy23mx-psi
authored andcommitted
feat(datadogexporter): adds remap_metrics feature gate (open-telemetry#35025)
**Description:** <Describe what has changed.> Adds a metrics configuration that enables/disables the conversion of OpenTelemetry metrics to Datadog semantics in the Datadog Exporter. This conversion will soon occur in a datadog semantic processor. **Link to tracking Issue:** N/A **Testing:** Unit tests *̶*̶D̶o̶c̶u̶m̶e̶n̶t̶a̶t̶i̶o̶n̶:̶*̶*̶ O̶n̶c̶e̶ t̶h̶i̶s̶ c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶ i̶s̶ G̶A̶ w̶e̶ w̶i̶l̶l̶ u̶p̶d̶a̶t̶e̶ t̶h̶e̶ d̶o̶c̶s̶ h̶e̶r̶e̶:̶ h̶t̶t̶p̶s̶:̶//d̶o̶c̶s̶.d̶a̶t̶a̶d̶o̶g̶h̶q̶.c̶o̶m̶/o̶p̶e̶n̶t̶e̶l̶e̶m̶e̶t̶r̶y̶/c̶o̶l̶l̶e̶c̶t̶o̶r̶_̶e̶x̶p̶o̶r̶t̶e̶r̶/c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶/ --------- Co-authored-by: Yang Song <[email protected]> Co-authored-by: Pablo Baeyens <[email protected]>
1 parent 658c836 commit 59b9dd2

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
change_type: enhancement
2+
3+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
4+
component: datadogexporter
5+
6+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
7+
note: "Adds exporter.datadogexporter.metricremappingdisabled featuregate which disables renaming OpenTelemetry metrics to match Datadog semantics. This feature gate is only for internal use."
8+
9+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
10+
issues: [35025]
11+
12+
# Optional: A list of users who contributed to the change. This is used to generate the list of contributors in the changelog.
13+
change_logs: []

exporter/datadogexporter/factory.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ var metricExportNativeClientFeatureGate = featuregate.GlobalRegistry().MustRegis
5353
featuregate.WithRegisterDescription("When enabled, metric export in datadogexporter uses native Datadog client APIs instead of Zorkian APIs."),
5454
)
5555

56+
var metricRemappingDisableddFeatureGate = featuregate.GlobalRegistry().MustRegister(
57+
"exporter.datadogexporter.metricremappingdisabled",
58+
featuregate.StageAlpha,
59+
featuregate.WithRegisterDescription("When enabled the Datadog Exporter remaps OpenTelemetry semantic conventions to Datadog semantic conventions. This feature gate is only for internal use."),
60+
featuregate.WithRegisterReferenceURL("https://docs.datadoghq.com/opentelemetry/schema_semantics/metrics_mapping/"),
61+
)
62+
5663
// noAPMStatsFeatureGate causes the trace consumer to skip APM stats computation.
5764
var noAPMStatsFeatureGate = featuregate.GlobalRegistry().MustRegister(
5865
"exporter.datadogexporter.DisableAPMStats",
@@ -65,6 +72,11 @@ func isMetricExportV2Enabled() bool {
6572
return metricExportNativeClientFeatureGate.IsEnabled()
6673
}
6774

75+
// isMetricRemappingDisabled returns true if the datadogexporter should generate Datadog-compliant metrics from OpenTelemetry metrics
76+
func isMetricRemappingDisabled() bool {
77+
return metricRemappingDisableddFeatureGate.IsEnabled()
78+
}
79+
6880
func isLogsAgentExporterEnabled() bool {
6981
return logsAgentExporterFeatureGate.IsEnabled()
7082
}

exporter/datadogexporter/metrics_exporter.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ func translatorFromConfig(set component.TelemetrySettings, cfg *Config, attrsTra
5555
options := []otlpmetrics.TranslatorOption{
5656
otlpmetrics.WithDeltaTTL(cfg.Metrics.DeltaTTL),
5757
otlpmetrics.WithFallbackSourceProvider(sourceProvider),
58-
otlpmetrics.WithRemapping(),
58+
}
59+
60+
if isMetricRemappingDisabled() {
61+
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).")
62+
} else {
63+
options = append(options, otlpmetrics.WithRemapping())
5964
}
6065

6166
if cfg.Metrics.HistConfig.SendAggregations {

0 commit comments

Comments
 (0)