feat(dev): add --otel-endpoint flag to forward traces to custom OTLP …#1010
feat(dev): add --otel-endpoint flag to forward traces to custom OTLP …#1010
Conversation
…backend Add a new --otel-endpoint <url> option to agentcore dev that lets users send agent traces to an external OTLP/HTTP collector (e.g. Jaeger, Grafana Tempo) instead of the built-in local collector. When --otel-endpoint is provided: - The local in-process OtelCollector is not started (no port bound) - OTEL_EXPORTER_OTLP_ENDPOINT is set to the supplied URL - All other OTEL env vars are injected as normal - collector is returned as undefined (traces panel in web UI will be empty) The existing --no-traces flag continues to disable telemetry entirely. Changes: - src/cli/operations/dev/otel/collector.ts: startOtelCollector accepts optional customEndpoint; skips local server when provided - src/cli/commands/dev/command.tsx: add --otel-endpoint flag, log the endpoint at startup, pass through to runBrowserMode - src/cli/commands/dev/browser-mode.ts: thread otelEndpoint through BrowserModeOptions and launchBrowserDev - src/cli/commands/dev/__tests__/dev.test.ts: verify flag appears in help - src/cli/operations/dev/otel/__tests__/collector.test.ts: 10 unit tests covering both default and custom-endpoint behaviour
- docs/commands.md: add --no-traces and --otel-endpoint rows to the dev command flags table - docs/local-development.md: add Telemetry section covering the default local collector, custom OTLP endpoint usage, disabling traces, and trace file storage location
|
Dead code:
const { workingDir, project, agentName, otelEnvVars = {}, collector } = opts;So the field has no behavioral effect today — the custom endpoint's entire effect comes from A couple of options:
Option 1 is probably what you want unless there's a follow-up planned. |
|
In if (opts.traces !== false) {
const otelResult = await startOtelCollector(persistTracesDir, opts.otelEndpoint);
...
if (opts.otelEndpoint) {
console.log(`OTEL traces → ${opts.otelEndpoint}`);
}
}If a user passes both Options:
Option 1 is the cleanest. |
…backend
Description
Add a new --otel-endpoint option to agentcore dev that lets users send agent traces to an external OTLP/HTTP collector (e.g. Jaeger, Grafana Tempo) instead of the built-in local collector.
When --otel-endpoint is provided:
The existing --no-traces flag continues to disable telemetry entirely.
Changes:
Related Issue
Closes #1009
Documentation PR
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.