@@ -39,8 +39,9 @@ public static Writer createWriter(
39
39
final Sampler sampler ,
40
40
final SingleSpanSampler singleSpanSampler ,
41
41
final HealthMetrics healthMetrics ) {
42
- return createWriter (
42
+ Writer w = createWriter (
43
43
config , commObjects , sampler , singleSpanSampler , healthMetrics , config .getWriterType ());
44
+ return w ;
44
45
}
45
46
46
47
public static Writer createWriter (
@@ -51,14 +52,20 @@ public static Writer createWriter(
51
52
final HealthMetrics healthMetrics ,
52
53
String configuredType ) {
53
54
55
+ log .debug ("START CREATE WRITER" );
56
+
54
57
if (LOGGING_WRITER_TYPE .equals (configuredType )) {
58
+ log .debug ("STARTED WRITER LOGGING" );
55
59
return new LoggingWriter ();
56
60
} else if (PRINTING_WRITER_TYPE .equals (configuredType )) {
61
+ log .debug ("STARTED WRITER PRINTING" );
57
62
return new PrintingWriter (System .out , true );
58
63
} else if (configuredType .startsWith (TRACE_STRUCTURE_WRITER_TYPE )) {
64
+ log .debug ("STARTED WRITER TRACE STRCT" );
59
65
return new TraceStructureWriter (
60
66
Strings .replace (configuredType , TRACE_STRUCTURE_WRITER_TYPE , "" ));
61
67
} else if (configuredType .startsWith (MULTI_WRITER_TYPE )) {
68
+ log .debug ("STARTED WRITER MULTI" );
62
69
return new MultiWriter (
63
70
config , commObjects , sampler , singleSpanSampler , healthMetrics , configuredType );
64
71
}
@@ -116,6 +123,13 @@ public static Writer createWriter(
116
123
builder .addTrack (TrackType .CITESTCOV , coverageApi );
117
124
}
118
125
126
+ log .debug ("BEFORE ADDING LLM OBSERVER" );
127
+ if (config .isLlmObsEnabled () && config .isLlmObsAgentlessEnabled ()) {
128
+ final RemoteApi llmobsApi = createDDIntakeRemoteApi (config , commObjects , featuresDiscovery , TrackType .LLMOBS );
129
+ builder .addTrack (TrackType .LLMOBS , llmobsApi );
130
+ log .debug ("ADDED LLM OBSERVER" );
131
+ }
132
+
119
133
remoteWriter = builder .build ();
120
134
121
135
} else { // configuredType == DDAgentWriter
@@ -171,26 +185,34 @@ private static RemoteApi createDDIntakeRemoteApi(
171
185
SharedCommunicationObjects commObjects ,
172
186
DDAgentFeaturesDiscovery featuresDiscovery ,
173
187
TrackType trackType ) {
174
- if (featuresDiscovery .supportsEvpProxy () && !config .isCiVisibilityAgentlessEnabled ()) {
188
+ // TODO make it so that it is agentless for the requested product and not both
189
+ if (featuresDiscovery .supportsEvpProxy () && !config .isCiVisibilityAgentlessEnabled () && !config .isLlmObsAgentlessEnabled ()) {
175
190
return DDEvpProxyApi .builder ()
176
191
.httpClient (commObjects .okHttpClient )
177
192
.agentUrl (commObjects .agentUrl )
178
193
.evpProxyEndpoint (featuresDiscovery .getEvpProxyEndpoint ())
179
194
.trackType (trackType )
180
195
.compressionEnabled (featuresDiscovery .supportsContentEncodingHeadersWithEvpProxy ())
181
196
.build ();
182
-
183
197
} else {
184
198
HttpUrl hostUrl = null ;
199
+ String llmObsAgentlessUrl = config .getLlMObsAgentlessUrl ();
200
+ log .debug ("LLMOBS URL {}" , llmObsAgentlessUrl );
201
+
185
202
if (config .getCiVisibilityAgentlessUrl () != null ) {
186
203
hostUrl = HttpUrl .get (config .getCiVisibilityAgentlessUrl ());
187
204
log .info ("Using host URL '{}' to report CI Visibility traces in Agentless mode." , hostUrl );
205
+ } else if (config .isLlmObsEnabled () && config .isLlmObsAgentlessEnabled () && llmObsAgentlessUrl != null && !llmObsAgentlessUrl .isEmpty ()) {
206
+ hostUrl = HttpUrl .get (llmObsAgentlessUrl );
207
+ log .info ("Using host URL '{}' to report LLM Obs traces in Agentless mode." , hostUrl );
188
208
}
189
- return DDIntakeApi .builder ()
209
+ RemoteApi ddintake = DDIntakeApi .builder ()
190
210
.hostUrl (hostUrl )
191
211
.apiKey (config .getApiKey ())
192
212
.trackType (trackType )
193
213
.build ();
214
+ log .debug ("CREATED DD INTAKE for track {} {}" , trackType .name (), ddintake );
215
+ return ddintake ;
194
216
}
195
217
}
196
218
0 commit comments