feat(inst/langchain4j): add LangChain4j 1.0 phase attribution instrumentation#11530
Draft
jbachorik wants to merge 1 commit into
Draft
feat(inst/langchain4j): add LangChain4j 1.0 phase attribution instrumentation#11530jbachorik wants to merge 1 commit into
jbachorik wants to merge 1 commit into
Conversation
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
New instrumentation module
dd-java-agent/instrumentation/langchain4j/langchain4j-1.0with threeInstrumenterModule.Profilinghooks tagging LangChain4j 1.0 pipeline boundaries:ChatModelInstrumentationChatModel#chat(ChatRequest)— all implementationsawaiting_inferenceToolExecutorInstrumentationToolExecutor#execute(ToolExecutionRequest, Object)tool_executionAiServicesInstrumentationDefaultAiServices$1#invoke(...)(anonymous InvocationHandler)context_buildEach advice sets
llm.agent.phaseon enter viaProfiling.get().newScope().setContextValue(...)and clears on exit. Muzzle passes LC4j versions 1.0.0–1.15.1.Motivation
LangChain4j uses its own HTTP client — the existing OpenAI Java SDK instrumentation does not fire on LC4j calls. Without this module, CPU flamegraphs from LC4j services show undifferentiated work.
Part of PROF-14858. Stacked on #11529 (DatadogProfiler slot). Next: [ddt-4-demo] (demo app).
Additional Notes
TargetSystem.PROFILINGis enabled (InstrumenterModule.Profiling).ToolExecutoris atdev.langchain4j.service.tool(notagent.toolas the spec guessed).DefaultAiServices$1.langchain4j-ollama1.0.0 does not exist in Maven Central; earliest 1.x is 1.2.0.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge. You can also:/merge --commit-message "..."/merge -c/merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-levelJira ticket: PROF-14863