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 .ProfilingConfig .PROFILING_AGENTLESS ;
459464import static datadog .trace .api .config .ProfilingConfig .PROFILING_AGENTLESS_DEFAULT ;
460465import static datadog .trace .api .config .ProfilingConfig .PROFILING_API_KEY_FILE_OLD ;
@@ -913,7 +918,6 @@ public static String getHostName() {
913918 private final boolean jmxFetchMultipleRuntimeServicesEnabled ;
914919 private final int jmxFetchMultipleRuntimeServicesLimit ;
915920
916- private final boolean metricsOtelEnabled ;
917921 private final int metricsOtelInterval ;
918922 private final int metricsOtelTimeout ;
919923 private final int metricsOtelCardinalityLimit ;
@@ -924,6 +928,12 @@ public static String getHostName() {
924928 private final int otlpMetricsTimeout ;
925929 private final OtlpConfig .Temporality otlpMetricsTemporalityPreference ;
926930
931+ private final String otlpTracesEndpoint ;
932+ private final Map <String , String > otlpTracesHeaders ;
933+ private final OtlpConfig .Protocol otlpTracesProtocol ;
934+ private final OtlpConfig .Compression otlpTracesCompression ;
935+ private final int otlpTracesTimeout ;
936+
927937 // These values are default-ed to those of jmx fetch values as needed
928938 private final boolean healthMetricsEnabled ;
929939 private final String healthMetricsStatsdHost ;
@@ -1889,9 +1899,6 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
18891899 statsDClientSocketBuffer = configProvider .getInteger (STATSD_CLIENT_SOCKET_BUFFER );
18901900 statsDClientSocketTimeout = configProvider .getInteger (STATSD_CLIENT_SOCKET_TIMEOUT );
18911901
1892- metricsOtelEnabled =
1893- configProvider .getBoolean (METRICS_OTEL_ENABLED , DEFAULT_METRICS_OTEL_ENABLED );
1894-
18951902 int cardinalityLimit =
18961903 configProvider .getInteger (
18971904 METRICS_OTEL_CARDINALITY_LIMIT , DEFAULT_METRICS_OTEL_CARDINALITY_LIMIT );
@@ -1919,11 +1926,11 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
19191926 metricsOtelTimeout = otelTimeout ;
19201927
19211928 // keep OTLP default timeout below the overall export timeout
1922- int defaultOtlpTimeout = Math .min (metricsOtelTimeout , DEFAULT_METRICS_OTEL_TIMEOUT );
1923- int otlpTimeout = configProvider .getInteger (OTLP_METRICS_TIMEOUT , defaultOtlpTimeout );
1929+ int defaultOtlpMetricsTimeout = Math .min (metricsOtelTimeout , DEFAULT_METRICS_OTEL_TIMEOUT );
1930+ int otlpTimeout = configProvider .getInteger (OTLP_METRICS_TIMEOUT , defaultOtlpMetricsTimeout );
19241931 if (otlpTimeout < 0 ) {
19251932 log .warn ("Invalid OTLP metrics timeout: {}. The value must be positive" , otlpTimeout );
1926- otlpTimeout = defaultOtlpTimeout ;
1933+ otlpTimeout = defaultOtlpMetricsTimeout ;
19271934 }
19281935 otlpMetricsTimeout = otlpTimeout ;
19291936
@@ -1946,7 +1953,7 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
19461953 + ':'
19471954 + DEFAULT_OTLP_HTTP_PORT
19481955 + '/'
1949- + DEFAULT_OTLP_HTTP_METRIC_ENDPOINT ;
1956+ + DEFAULT_OTLP_HTTP_METRICS_ENDPOINT ;
19501957 }
19511958 }
19521959 otlpMetricsEndpoint = otlpMetricsEndpointFromEnvironment ;
@@ -1957,6 +1964,37 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
19571964 OtlpConfig .Temporality .class ,
19581965 OtlpConfig .Temporality .DELTA );
19591966
1967+ otlpTimeout = configProvider .getInteger (OTLP_TRACES_TIMEOUT , DEFAULT_OTLP_TRACES_TIMEOUT );
1968+ if (otlpTimeout < 0 ) {
1969+ log .warn ("Invalid OTLP traces timeout: {}. The value must be positive" , otlpTimeout );
1970+ otlpTimeout = DEFAULT_OTLP_TRACES_TIMEOUT ;
1971+ }
1972+ otlpTracesTimeout = otlpTimeout ;
1973+
1974+ otlpTracesHeaders = configProvider .getMergedMap (OTLP_TRACES_HEADERS , '=' );
1975+ otlpTracesProtocol =
1976+ configProvider .getEnum (
1977+ OTLP_TRACES_PROTOCOL , OtlpConfig .Protocol .class , OtlpConfig .Protocol .HTTP_PROTOBUF );
1978+ otlpTracesCompression =
1979+ configProvider .getEnum (
1980+ OTLP_TRACES_COMPRESSION , OtlpConfig .Compression .class , OtlpConfig .Compression .NONE );
1981+
1982+ String otlpTracesEndpointFromEnvironment = configProvider .getString (OTLP_TRACES_ENDPOINT );
1983+ if (otlpTracesEndpointFromEnvironment == null ) {
1984+ if (otlpMetricsProtocol == OtlpConfig .Protocol .GRPC ) {
1985+ otlpTracesEndpointFromEnvironment = "http://" + agentHost + ':' + DEFAULT_OTLP_GRPC_PORT ;
1986+ } else {
1987+ otlpTracesEndpointFromEnvironment =
1988+ "http://"
1989+ + agentHost
1990+ + ':'
1991+ + DEFAULT_OTLP_HTTP_PORT
1992+ + '/'
1993+ + DEFAULT_OTLP_HTTP_TRACES_ENDPOINT ;
1994+ }
1995+ }
1996+ otlpTracesEndpoint = otlpTracesEndpointFromEnvironment ;
1997+
19601998 // Runtime metrics are disabled if Otel metrics are enabled and the metrics exporter is none
19611999 runtimeMetricsEnabled = configProvider .getBoolean (RUNTIME_METRICS_ENABLED , true );
19622000
@@ -5205,7 +5243,7 @@ public boolean isJmxFetchIntegrationEnabled(
52055243 }
52065244
52075245 public boolean isMetricsOtelEnabled () {
5208- return metricsOtelEnabled ;
5246+ return instrumenterConfig . isMetricsOtelEnabled () ;
52095247 }
52105248
52115249 public int getMetricsOtelCardinalityLimit () {
@@ -5244,6 +5282,30 @@ public OtlpConfig.Temporality getOtlpMetricsTemporalityPreference() {
52445282 return otlpMetricsTemporalityPreference ;
52455283 }
52465284
5285+ public boolean isTraceOtelEnabled () {
5286+ return instrumenterConfig .isTraceOtelEnabled ();
5287+ }
5288+
5289+ public String getOtlpTracesEndpoint () {
5290+ return otlpTracesEndpoint ;
5291+ }
5292+
5293+ public Map <String , String > getOtlpTracesHeaders () {
5294+ return otlpTracesHeaders ;
5295+ }
5296+
5297+ public OtlpConfig .Protocol getOtlpTracesProtocol () {
5298+ return otlpTracesProtocol ;
5299+ }
5300+
5301+ public OtlpConfig .Compression getOtlpTracesCompression () {
5302+ return otlpTracesCompression ;
5303+ }
5304+
5305+ public int getOtlpTracesTimeout () {
5306+ return otlpTracesTimeout ;
5307+ }
5308+
52475309 public boolean isRuleEnabled (final String name ) {
52485310 return isRuleEnabled (name , true );
52495311 }
@@ -6255,8 +6317,6 @@ public String toString() {
62556317 + aiGuardEnabled
62566318 + ", aiGuardEndpoint="
62576319 + aiGuardEndpoint
6258- + ", metricsOtelEnabled="
6259- + metricsOtelEnabled
62606320 + ", metricsOtelInterval="
62616321 + metricsOtelInterval
62626322 + ", metricsOtelTimeout="
@@ -6275,6 +6335,16 @@ public String toString() {
62756335 + otlpMetricsTimeout
62766336 + ", otlpMetricsTemporalityPreference="
62776337 + otlpMetricsTemporalityPreference
6338+ + ", otlpTracesEndpoint="
6339+ + otlpTracesEndpoint
6340+ + ", otlpTracesHeaders="
6341+ + otlpTracesHeaders
6342+ + ", otlpTracesProtocol="
6343+ + otlpTracesProtocol
6344+ + ", otlpTracesCompression="
6345+ + otlpTracesCompression
6346+ + ", otlpTracesTimeout="
6347+ + otlpTracesTimeout
62786348 + ", serviceDiscoveryEnabled="
62796349 + serviceDiscoveryEnabled
62806350 + ", sfnInjectDatadogAttributeEnabled="
0 commit comments