-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Problem
The scenario SDK sets up OpenTelemetry observability at module import time in src/tracing/setup.ts:
const envConfig = getEnv();
export const observabilityHandle = setupObservability({
langwatch: {
apiKey: envConfig.LANGWATCH_API_KEY,
endpoint: envConfig.LANGWATCH_ENDPOINT,
},
spanProcessors: [judgeSpanCollector],
});This means:
- The tracer is configured once at import time using env vars
- The programmatic
RunOptions.langwatchconfig only affects the EventBus for scenario events - OpenTelemetry traces/spans are sent to the env var endpoint, not the project-specific endpoint
Impact
When running scenarios for multiple projects (e.g., in the LangWatch server), traces will all go to the same endpoint instead of each project's endpoint. The scenario events work correctly since they use the programmatic config via EventBus.
Proposed Solution
Allow the tracer to be configured per-run:
// Option 1: Pass langwatch config to ScenarioExecution
const execution = new ScenarioExecution(cfg, steps, batchRunId, {
langwatch: options?.langwatch,
});
// Option 2: Create a scoped tracer per execution
const tracer = createScopedTracer({
apiKey: options?.langwatch?.apiKey,
endpoint: options?.langwatch?.endpoint,
});Files Affected
src/tracing/setup.tssrc/execution/scenario-execution.tssrc/runner/run.ts
Metadata
Metadata
Assignees
Labels
No labels