112112import static datadog .trace .api .ConfigDefaults .DEFAULT_LLM_OBS_AGENTLESS_ENABLED ;
113113import static datadog .trace .api .ConfigDefaults .DEFAULT_LOGS_INJECTION_ENABLED ;
114114import static datadog .trace .api .ConfigDefaults .DEFAULT_METRICS_OTEL_CARDINALITY_LIMIT ;
115- import static datadog .trace .api .ConfigDefaults .DEFAULT_METRICS_OTEL_ENABLED ;
116115import static datadog .trace .api .ConfigDefaults .DEFAULT_METRICS_OTEL_INTERVAL ;
117116import static datadog .trace .api .ConfigDefaults .DEFAULT_METRICS_OTEL_TIMEOUT ;
118117import static datadog .trace .api .ConfigDefaults .DEFAULT_OTLP_GRPC_PORT ;
119- import static datadog .trace .api .ConfigDefaults .DEFAULT_OTLP_HTTP_METRIC_ENDPOINT ;
118+ import static datadog .trace .api .ConfigDefaults .DEFAULT_OTLP_HTTP_METRICS_ENDPOINT ;
120119import static datadog .trace .api .ConfigDefaults .DEFAULT_OTLP_HTTP_PORT ;
120+ import static datadog .trace .api .ConfigDefaults .DEFAULT_OTLP_HTTP_TRACES_ENDPOINT ;
121+ import static datadog .trace .api .ConfigDefaults .DEFAULT_OTLP_TRACES_TIMEOUT ;
121122import static datadog .trace .api .ConfigDefaults .DEFAULT_PARTIAL_FLUSH_MIN_SPANS ;
122123import static datadog .trace .api .ConfigDefaults .DEFAULT_PERF_METRICS_ENABLED ;
123124import static datadog .trace .api .ConfigDefaults .DEFAULT_PRIORITY_SAMPLING_ENABLED ;
446447import static datadog .trace .api .config .LlmObsConfig .LLMOBS_AGENTLESS_ENABLED ;
447448import static datadog .trace .api .config .LlmObsConfig .LLMOBS_ML_APP ;
448449import static datadog .trace .api .config .OtlpConfig .METRICS_OTEL_CARDINALITY_LIMIT ;
449- import static datadog .trace .api .config .OtlpConfig .METRICS_OTEL_ENABLED ;
450450import static datadog .trace .api .config .OtlpConfig .METRICS_OTEL_INTERVAL ;
451451import static datadog .trace .api .config .OtlpConfig .METRICS_OTEL_TIMEOUT ;
452452import static datadog .trace .api .config .OtlpConfig .OTLP_METRICS_COMPRESSION ;
455455import static datadog .trace .api .config .OtlpConfig .OTLP_METRICS_PROTOCOL ;
456456import static datadog .trace .api .config .OtlpConfig .OTLP_METRICS_TEMPORALITY_PREFERENCE ;
457457import static datadog .trace .api .config .OtlpConfig .OTLP_METRICS_TIMEOUT ;
458+ import static datadog .trace .api .config .OtlpConfig .OTLP_TRACES_COMPRESSION ;
459+ import static datadog .trace .api .config .OtlpConfig .OTLP_TRACES_ENDPOINT ;
460+ import static datadog .trace .api .config .OtlpConfig .OTLP_TRACES_HEADERS ;
461+ import static datadog .trace .api .config .OtlpConfig .OTLP_TRACES_PROTOCOL ;
462+ import static datadog .trace .api .config .OtlpConfig .OTLP_TRACES_TIMEOUT ;
458463import static datadog .trace .api .config .OtlpConfig .TRACE_OTEL_EXPORTER ;
459464import static datadog .trace .api .config .ProfilingConfig .PROFILING_AGENTLESS ;
460465import static datadog .trace .api .config .ProfilingConfig .PROFILING_AGENTLESS_DEFAULT ;
@@ -914,9 +919,6 @@ public static String getHostName() {
914919 private final boolean jmxFetchMultipleRuntimeServicesEnabled ;
915920 private final int jmxFetchMultipleRuntimeServicesLimit ;
916921
917- private final String traceOtelExporter ;
918-
919- private final boolean metricsOtelEnabled ;
920922 private final int metricsOtelInterval ;
921923 private final int metricsOtelTimeout ;
922924 private final int metricsOtelCardinalityLimit ;
@@ -927,6 +929,13 @@ public static String getHostName() {
927929 private final int otlpMetricsTimeout ;
928930 private final OtlpConfig .Temporality otlpMetricsTemporalityPreference ;
929931
932+ private final String traceOtelExporter ;
933+ private final String otlpTracesEndpoint ;
934+ private final Map <String , String > otlpTracesHeaders ;
935+ private final OtlpConfig .Protocol otlpTracesProtocol ;
936+ private final OtlpConfig .Compression otlpTracesCompression ;
937+ private final int otlpTracesTimeout ;
938+
930939 // These values are default-ed to those of jmx fetch values as needed
931940 private final boolean healthMetricsEnabled ;
932941 private final String healthMetricsStatsdHost ;
@@ -1892,11 +1901,6 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
18921901 statsDClientSocketBuffer = configProvider .getInteger (STATSD_CLIENT_SOCKET_BUFFER );
18931902 statsDClientSocketTimeout = configProvider .getInteger (STATSD_CLIENT_SOCKET_TIMEOUT );
18941903
1895- traceOtelExporter = configProvider .getString (TRACE_OTEL_EXPORTER );
1896-
1897- metricsOtelEnabled =
1898- configProvider .getBoolean (METRICS_OTEL_ENABLED , DEFAULT_METRICS_OTEL_ENABLED );
1899-
19001904 int cardinalityLimit =
19011905 configProvider .getInteger (
19021906 METRICS_OTEL_CARDINALITY_LIMIT , DEFAULT_METRICS_OTEL_CARDINALITY_LIMIT );
@@ -1924,11 +1928,11 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
19241928 metricsOtelTimeout = otelTimeout ;
19251929
19261930 // keep OTLP default timeout below the overall export timeout
1927- int defaultOtlpTimeout = Math .min (metricsOtelTimeout , DEFAULT_METRICS_OTEL_TIMEOUT );
1928- int otlpTimeout = configProvider .getInteger (OTLP_METRICS_TIMEOUT , defaultOtlpTimeout );
1931+ int defaultOtlpMetricsTimeout = Math .min (metricsOtelTimeout , DEFAULT_METRICS_OTEL_TIMEOUT );
1932+ int otlpTimeout = configProvider .getInteger (OTLP_METRICS_TIMEOUT , defaultOtlpMetricsTimeout );
19291933 if (otlpTimeout < 0 ) {
19301934 log .warn ("Invalid OTLP metrics timeout: {}. The value must be positive" , otlpTimeout );
1931- otlpTimeout = defaultOtlpTimeout ;
1935+ otlpTimeout = defaultOtlpMetricsTimeout ;
19321936 }
19331937 otlpMetricsTimeout = otlpTimeout ;
19341938
@@ -1951,7 +1955,7 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
19511955 + ':'
19521956 + DEFAULT_OTLP_HTTP_PORT
19531957 + '/'
1954- + DEFAULT_OTLP_HTTP_METRIC_ENDPOINT ;
1958+ + DEFAULT_OTLP_HTTP_METRICS_ENDPOINT ;
19551959 }
19561960 }
19571961 otlpMetricsEndpoint = otlpMetricsEndpointFromEnvironment ;
@@ -1962,6 +1966,39 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
19621966 OtlpConfig .Temporality .class ,
19631967 OtlpConfig .Temporality .DELTA );
19641968
1969+ traceOtelExporter = configProvider .getString (TRACE_OTEL_EXPORTER );
1970+
1971+ otlpTimeout = configProvider .getInteger (OTLP_TRACES_TIMEOUT , DEFAULT_OTLP_TRACES_TIMEOUT );
1972+ if (otlpTimeout < 0 ) {
1973+ log .warn ("Invalid OTLP traces timeout: {}. The value must be positive" , otlpTimeout );
1974+ otlpTimeout = DEFAULT_OTLP_TRACES_TIMEOUT ;
1975+ }
1976+ otlpTracesTimeout = otlpTimeout ;
1977+
1978+ otlpTracesHeaders = configProvider .getMergedMap (OTLP_TRACES_HEADERS , '=' );
1979+ otlpTracesProtocol =
1980+ configProvider .getEnum (
1981+ OTLP_TRACES_PROTOCOL , OtlpConfig .Protocol .class , OtlpConfig .Protocol .HTTP_PROTOBUF );
1982+ otlpTracesCompression =
1983+ configProvider .getEnum (
1984+ OTLP_TRACES_COMPRESSION , OtlpConfig .Compression .class , OtlpConfig .Compression .NONE );
1985+
1986+ String otlpTracesEndpointFromEnvironment = configProvider .getString (OTLP_TRACES_ENDPOINT );
1987+ if (otlpTracesEndpointFromEnvironment == null ) {
1988+ if (otlpMetricsProtocol == OtlpConfig .Protocol .GRPC ) {
1989+ otlpTracesEndpointFromEnvironment = "http://" + agentHost + ':' + DEFAULT_OTLP_GRPC_PORT ;
1990+ } else {
1991+ otlpTracesEndpointFromEnvironment =
1992+ "http://"
1993+ + agentHost
1994+ + ':'
1995+ + DEFAULT_OTLP_HTTP_PORT
1996+ + '/'
1997+ + DEFAULT_OTLP_HTTP_TRACES_ENDPOINT ;
1998+ }
1999+ }
2000+ otlpTracesEndpoint = otlpTracesEndpointFromEnvironment ;
2001+
19652002 // Runtime metrics are disabled if Otel metrics are enabled and the metrics exporter is none
19662003 runtimeMetricsEnabled = configProvider .getBoolean (RUNTIME_METRICS_ENABLED , true );
19672004
@@ -5209,12 +5246,8 @@ public boolean isJmxFetchIntegrationEnabled(
52095246 return configProvider .isEnabled (integrationNames , "jmxfetch." , ".enabled" , defaultEnabled );
52105247 }
52115248
5212- public boolean isOtlpTracesExporterEnabled () {
5213- return "otlp" .equalsIgnoreCase (traceOtelExporter );
5214- }
5215-
52165249 public boolean isMetricsOtelEnabled () {
5217- return metricsOtelEnabled ;
5250+ return instrumenterConfig . isMetricsOtelEnabled () ;
52185251 }
52195252
52205253 public int getMetricsOtelCardinalityLimit () {
@@ -5253,6 +5286,34 @@ public OtlpConfig.Temporality getOtlpMetricsTemporalityPreference() {
52535286 return otlpMetricsTemporalityPreference ;
52545287 }
52555288
5289+ public boolean isTraceOtelEnabled () {
5290+ return instrumenterConfig .isTraceOtelEnabled ();
5291+ }
5292+
5293+ public boolean isTraceOtlpExporterEnabled () {
5294+ return "otlp" .equalsIgnoreCase (traceOtelExporter );
5295+ }
5296+
5297+ public String getOtlpTracesEndpoint () {
5298+ return otlpTracesEndpoint ;
5299+ }
5300+
5301+ public Map <String , String > getOtlpTracesHeaders () {
5302+ return otlpTracesHeaders ;
5303+ }
5304+
5305+ public OtlpConfig .Protocol getOtlpTracesProtocol () {
5306+ return otlpTracesProtocol ;
5307+ }
5308+
5309+ public OtlpConfig .Compression getOtlpTracesCompression () {
5310+ return otlpTracesCompression ;
5311+ }
5312+
5313+ public int getOtlpTracesTimeout () {
5314+ return otlpTracesTimeout ;
5315+ }
5316+
52565317 public boolean isRuleEnabled (final String name ) {
52575318 return isRuleEnabled (name , true );
52585319 }
@@ -6264,10 +6325,6 @@ public String toString() {
62646325 + aiGuardEnabled
62656326 + ", aiGuardEndpoint="
62666327 + aiGuardEndpoint
6267- + ", traceOtelExporter="
6268- + traceOtelExporter
6269- + ", metricsOtelEnabled="
6270- + metricsOtelEnabled
62716328 + ", metricsOtelInterval="
62726329 + metricsOtelInterval
62736330 + ", metricsOtelTimeout="
@@ -6286,6 +6343,18 @@ public String toString() {
62866343 + otlpMetricsTimeout
62876344 + ", otlpMetricsTemporalityPreference="
62886345 + otlpMetricsTemporalityPreference
6346+ + ", traceOtelExporter="
6347+ + traceOtelExporter
6348+ + ", otlpTracesEndpoint="
6349+ + otlpTracesEndpoint
6350+ + ", otlpTracesHeaders="
6351+ + otlpTracesHeaders
6352+ + ", otlpTracesProtocol="
6353+ + otlpTracesProtocol
6354+ + ", otlpTracesCompression="
6355+ + otlpTracesCompression
6356+ + ", otlpTracesTimeout="
6357+ + otlpTracesTimeout
62896358 + ", serviceDiscoveryEnabled="
62906359 + serviceDiscoveryEnabled
62916360 + ", sfnInjectDatadogAttributeEnabled="
0 commit comments