Skip to content

Commit ade08ca

Browse files
author
Nayeem Kamal
committed
fixed llmobs intake creation if llmobs not enabled
1 parent 157e53e commit ade08ca

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

dd-trace-core/src/main/java/datadog/trace/common/writer/WriterFactory.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static Writer createWriter(
4040
final Sampler sampler,
4141
final SingleSpanSampler singleSpanSampler,
4242
final HealthMetrics healthMetrics) {
43+
System.out.println("=====" + config.getWriterType());
4344
return createWriter(
4445
config, commObjects, sampler, singleSpanSampler, healthMetrics, config.getWriterType());
4546
}
@@ -68,7 +69,8 @@ public static Writer createWriter(
6869
if (!DD_AGENT_WRITER_TYPE.equals(configuredType)
6970
&& !DD_INTAKE_WRITER_TYPE.equals(configuredType)) {
7071
log.warn(
71-
"Writer type not configured correctly: Type {} not recognized. Ignoring", configuredType);
72+
"Writer type not configured correctly: Type {} not recognized. Ignoring ",
73+
configuredType);
7274
configuredType = datadog.trace.api.ConfigDefaults.DEFAULT_AGENT_WRITER_TYPE;
7375
}
7476

@@ -92,6 +94,14 @@ public static Writer createWriter(
9294
"CI Visibility functionality is limited. Please upgrade to Agent v6.40+ or v7.40+ or enable Agentless mode.");
9395
}
9496
}
97+
if (DD_AGENT_WRITER_TYPE.equals(configuredType) && (config.isLlmObsEnabled())) {
98+
if (featuresDiscovery.supportsEvpProxy() || config.isLlmObsAgentlessEnabled()) {
99+
configuredType = DD_INTAKE_WRITER_TYPE;
100+
} else {
101+
log.info("LLM Observability functionality is limited.");
102+
// TODO: add supported agent version to this log line for llm obs
103+
}
104+
}
95105

96106
RemoteWriter remoteWriter;
97107
if (DD_INTAKE_WRITER_TYPE.equals(configuredType)) {
@@ -117,11 +127,11 @@ public static Writer createWriter(
117127
createDDIntakeRemoteApi(config, commObjects, featuresDiscovery, TrackType.CITESTCOV);
118128
builder.addTrack(TrackType.CITESTCOV, coverageApi);
119129
}
120-
121-
final RemoteApi llmobsApi =
122-
createDDIntakeRemoteApi(config, commObjects, featuresDiscovery, TrackType.LLMOBS);
123-
builder.addTrack(TrackType.LLMOBS, llmobsApi);
124-
130+
if (config.isLlmObsEnabled()) {
131+
final RemoteApi llmobsApi =
132+
createDDIntakeRemoteApi(config, commObjects, featuresDiscovery, TrackType.LLMOBS);
133+
builder.addTrack(TrackType.LLMOBS, llmobsApi);
134+
}
125135
remoteWriter = builder.build();
126136

127137
} else { // configuredType == DDAgentWriter
@@ -203,6 +213,7 @@ private static RemoteApi createDDIntakeRemoteApi(
203213
&& config.isLlmObsAgentlessEnabled()
204214
&& llmObsAgentlessUrl != null
205215
&& !llmObsAgentlessUrl.isEmpty()) {
216+
System.out.println("------entering llmobs block");
206217
hostUrl = HttpUrl.get(llmObsAgentlessUrl);
207218
log.info("Using host URL '{}' to report LLM Obs traces in Agentless mode.", hostUrl);
208219
}

0 commit comments

Comments
 (0)