feat(appkit): tracing integration for agent plugin#176
Open
hubertzub-db wants to merge 2 commits intodatabricks:mainfrom
Open
feat(appkit): tracing integration for agent plugin#176hubertzub-db wants to merge 2 commits intodatabricks:mainfrom
hubertzub-db wants to merge 2 commits intodatabricks:mainfrom
Conversation
73d5420 to
14eb259
Compare
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
Signed-off-by: Hubert Zub <hubert.zub@databricks.com>
14eb259 to
fc7bc3c
Compare
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.
Stacked on top of #166
What this does
Adds agent tracing integration — LangChain spans flow through AppKit's global
TelemetryManagerwith MLflow experiment headers, and trace destinations are auto-provisioned in Unity Catalog.Changes to the core logic:
traceExporterHeaders) merged on top of base headers + authenableDefaultTelemetryconfig (default true)Reading order
Types first — understand the new interfaces:
packages/shared/src/plugin.ts— newappendTraceHeadersconvention onPluginConstructorpackages/appkit/src/telemetry/types.ts—traceExporterHeadersfield onTelemetryConfigpackages/appkit/src/plugins/agent/types.ts—IAgentConfig.tracingshape (false | { experimentId, ucTableName, warehouseId })packages/appkit/src/plugins/server/types.ts—enableDefaultTelemetryonServerConfigCore wiring — how headers flow from plugins to the exporter:
packages/appkit/src/core/appkit.ts—_createAppcollectsappendTraceHeadersfrom all plugins, passes merged headers toTelemetryManager.initialize()packages/appkit/src/telemetry/telemetry-manager.ts— nowasync;buildTraceExporterHeaders()merges base headers + Databricks auth + plugin headers;instrumentationsconfig passthroughAgent plugin — the main feature:
packages/appkit/src/plugins/agent/agent.ts—appendTraceHeaders(static, sync) provides experiment/UC headers;setup()callssetupExperimentTraceLocationthen conditionally instruments LangChainpackages/appkit/src/plugins/agent/tracing.ts— thin wrapper around@arizeai/openinference-instrumentation-langchainpackages/appkit/src/plugins/agent/mlflow.ts— new file —setupExperimentTraceLocation+linkExperimentToLocation(ported fromapp-templates)Instrumentation control — how users disable HTTP/Express noise:
packages/appkit/src/telemetry/instrumentations.ts— changed from eager static instances to lazy factory functions (http(),express())packages/appkit/src/plugins/server/index.ts— gated onenableDefaultTelemetry !== falseTests — small adjustments only:
server.test.ts— mock updated for factory function APItelemetry-manager.test.ts—awaitoninitialize(),delete process.env.DATABRICKS_HOSTin setupKey design decisions
static appendTraceHeaders()— called before telemetry init, keepsTelemetryManagerfree of MLflow-specific logicMLFLOW_EXPERIMENT_ID; trace location setup must succeed or instrumentation is skipped entirelyHttpInstrumentation/ExpressInstrumentationare created on-demand (factory functions) to avoid module patching at import timeOTEL_UC_TABLE_NAME(split on dots) — no separateOTEL_UC_CATALOG/OTEL_UC_SCHEMAenv vars