8000 Gary/llmobs java sdk integration by gary-huang · Pull Request #8519 · DataDog/dd-trace-java · GitHub
[go: up one dir, main page]

Skip to content

Gary/llmobs java sdk integration #8519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5134311
add APIs for llm obs
gary-huang Sep 19, 2024
b5c7a0a
add llm message class to support llm spans
gary-huang Mar 6, 2025
7f8f586
add llm message class to support llm spans
gary-huang Mar 6, 2025
9206dbe
impl llmobs agent and llmobs apis
gary-huang Jan 27, 2025
f5efd26
support llm messages with tool calls
gary-huang Mar 6, 2025
76740e9
handle default model name and provider
gary-huang Mar 26, 2025
5e66a2f
rm unneeded file
gary-huang Apr 11, 2025
75290af
impl llmobs agent and llmobs apis
gary-huang Jan 27, 2025
7b2db7c
impl llmobs agent
gary-huang Jan 27, 2025
d76c94d
working writer
gary-huang Feb 7, 2025
e0b4510
add support for llm message and tool calls
gary-huang Mar 6, 2025
87cdaf1
impl llmobs agent and llmobs apis
gary-huang Jan 27, 2025
f78b2c5
use new ctx api to track parent span
gary-huang Apr 1, 2025
5fc9069
add api for evals
gary-huang Mar 5, 2025
a74e456
working impl supporting both agentless and agent
gary-huang Mar 6, 2025
19d95d7
handle null tags and default to default ml app if null or empty strin…
gary-huang Apr 21, 2025
f1481ac
spotless
gary-huang Apr 23, 2025
de0d5a5
spotless
gary-huang Apr 23, 2025
82b8418
add APIs for llm obs sdk (#8135)
gary-huang May 7, 2025
f1d9d17
Merge branch 'gary/llmobs-sdk-merge' into gary/impl-llm-obs-api
gary-huang May 7, 2025
0a790c3
rename ID to Id according to java naming conventions
gary-huang May 7, 2025
d68665d
Merge branch 'gary/impl-llm-obs-api' into gary/add-llm-obs-writer
gary-huang May 7, 2025
0d77da2
Merge branch 'master' into gary/impl-llm-obs-api
gary-huang May 14, 2025
c1c38e4
Undo change to integrations-core submodule
gary-huang May 14, 2025
2be1b73
add APIs for llm obs sdk (#8135)
gary-huang May 7, 2025
d01034a
fix build gradle
gary-huang May 14, 2025
7a74cf6
Merge branch 'gary/llmobs-sdk-merge' into gary/impl-llm-obs-api
gary-huang May 14, 2025
23d6923
rm empty line
gary-huang May 14, 2025
9ac1ab7
fix test
gary-huang May 14, 2025
e382f22
wip add test
gary-huang May 14, 2025
613e6c2
Merge branch 'gary/impl-llm-obs-api' into gary/add-llm-obs-writer
gary-huang May 14, 2025
77291d8
implement LLM Obs SDK spans APIs (#8390)
gary-huang Jun 4, 2025
4739666
use proper convention like Id instead of ID
gary-huang Jun 11, 2025
993cdbe
Merge branch 'master' into gary/llmobs-sdk-merge
gary-huang Jun 11, 2025
20d2760
Merge branch 'gary/add-llm-obs-writer' into gary/llmobs-java-sdk-inte…
gary-huang Jun 11, 2025
8a9d17d
Merge branch 'gary/use-ctx-api' into gary/llmobs-java-sdk-integration
gary-huang Jun 11, 2025
8659686
Merge branch 'gary/submit-evals-2' into gary/llmobs-java-sdk-integration
gary-huang Jun 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dd-trace-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ dependencies {
implementation project(':components:json')
implementation project(':utils:container-utils')
implementation project(':utils:socket-utils')

// for span exception debugging
compileOnly project(':dd-java-agent:agent-debugger:debugger-bootstrap')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public DDAgentWriter build() {
}

final DDAgentMapperDiscovery mapperDiscovery = new DDAgentMapperDiscovery(featureDiscovery);

final PayloadDispatcher dispatcher =
new PayloadDispatcherImpl(mapperDiscovery, agentApi, healthMetrics, monitoring);
final TraceProcessingWorker traceProcessingWorker =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static Writer createWriter(

// The AgentWriter doesn't support the CI Visibility protocol. If CI Visibility is
// enabled, check if we can use the IntakeWriter instead.
if (DD_AGENT_WRITER_TYPE.equals(configuredType) && config.isCiVisibilityEnabled()) {
if (DD_AGENT_WRITER_TYPE.equals(configuredType) && (config.isCiVisibilityEnabled())) {
if (featuresDiscovery.supportsEvpProxy() || config.isCiVisibilityAgentlessEnabled()) {
configuredType = DD_INTAKE_WRITER_TYPE;
} else {
Expand Down Expand Up @@ -118,6 +118,10 @@ public static Writer createWriter(
builder.addTrack(TrackType.CITESTCOV, coverageApi);
}

final RemoteApi llmobsApi =
createDDIntakeRemoteApi(config, commObjects, featuresDiscovery, TrackType.LLMOBS);
builder.addTrack(TrackType.LLMOBS, llmobsApi);

remoteWriter = builder.build();

} else { // configuredType == DDAgentWriter
Expand Down Expand Up @@ -173,20 +177,34 @@ private static RemoteApi createDDIntakeRemoteApi(
SharedCommunicationObjects commObjects,
DDAgentFeaturesDiscovery featuresDiscovery,
TrackType trackType) {
if (featuresDiscovery.supportsEvpProxy() && !config.isCiVisibilityAgentlessEnabled()) {
boolean evpProxySupported = featuresDiscovery.supportsEvpProxy();
boolean useProxyApi =
(evpProxySupported && TrackType.LLMOBS == trackType && !config.isLlmObsAgentlessEnabled())
|| (evpProxySupported
&& (TrackType.CITESTCOV == trackType || TrackType.CITESTCYCLE == trackType)
&& !config.isCiVisibilityAgentlessEnabled());

if (useProxyApi) {
return DDEvpProxyApi.builder()
.httpClient(commObjects.okHttpClient)
.agentUrl(commObjects.agentUrl)
.evpProxyEndpoint(featuresDiscovery.getEvpProxyEndpoint())
.trackType(trackType)
.compressionEnabled(featuresDiscovery.supportsContentEncodingHeadersWithEvpProxy())
.build();

} else {
HttpUrl hostUrl = null;
String llmObsAgentlessUrl = config.getLlMObsAgentlessUrl();

if (config.getCiVisibilityAgentlessUrl() != null) {
hostUrl = HttpUrl.get(config.getCiVisibilityAgentlessUrl());
log.info("Using host URL '{}' to report CI Visibility traces in Agentless mode.", hostUrl);
} else if (config.isLlmObsEnabled()
&& config.isLlmObsAgentlessEnabled()
&& llmObsAgentlessUrl != null
&& !llmObsAgentlessUrl.isEmpty()) {
hostUrl = HttpUrl.get(llmObsAgentlessUrl);
log.info("Using host URL '{}' to report LLM Obs traces in Agentless mode.", hostUrl);
}
return DDIntakeApi.builder()
.hostUrl(hostUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void addResponseListener(final RemoteResponseListener listener) {
public Response sendSerializedTraces(final Payload payload) {
final int sizeInBytes = payload.sizeInBytes();
String tracesEndpoint = featuresDiscovery.getTraceEndpoint();

if (null == tracesEndpoint) {
featuresDiscovery.discoverIfOutdated();
tracesEndpoint = featuresDiscovery.getTraceEndpoint();
Expand Down
9E7A
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public Response sendSerializedTraces(Payload payload) {
.post(payload.toRequest())
.tag(OkHttpUtils.CustomListener.class, telemetryListener)
.build();

totalTraces += payload.traceCount();
receivedTraces += payload.traceCount();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import datadog.trace.civisibility.writer.ddintake.CiTestCycleMapperV1;
import datadog.trace.common.writer.RemoteMapper;
import datadog.trace.common.writer.RemoteMapperDiscovery;
import datadog.trace.llmobs.writer.ddintake.LLMObsSpanMapper;

/**
* Mapper discovery logic when a DDIntake is used. The mapper is discovered based on a backend
Expand Down Expand Up @@ -40,6 +41,8 @@ public void discover() {
mapper = new CiTestCycleMapperV1(wellKnownTags, compressionEnabled);
} else if (TrackType.CITESTCOV.equals(trackType)) {
mapper = new CiTestCovMapperV2(compressionEnabled);
} else if (TrackType.LLMOBS.equals(trackType)) {
mapper = new LLMObsSpanMapper();
} else {
mapper = RemoteMapper.NO_OP;
}
Expand Down
Loading
0