Skip to content

fix(protocol): make telemetry export opt-in - #2738

Closed
abhinavkr26104 wants to merge 3 commits into
browserbase:mainfrom
abhinavkr26104:fix/default-telemetry-placeholder
Closed

abhinavkr26104 wants to merge 3 commits into
browserbase:mainfrom
abhinavkr26104:fix/default-telemetry-placeholder

Conversation

@abhinavkr26104

@abhinavkr26104 abhinavkr26104 commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

why

The v4 init schema supplied https://example.com/v1/traces whenever callers omitted telemetry. The extension treated that placeholder as an intentional OTLP destination, creating guaranteed-failing background exports and possible shutdown delays for otherwise default Stagehand instances.

Fixes #2732

what changed

  • Make stagehand.init telemetry optional instead of injecting a placeholder endpoint.
  • Leave extension tracing inert when no telemetry configuration is supplied while preserving explicit OTLP export behavior.
  • Regenerate Python and Go protocol models and the embedded Go extension bundle.
  • Keep Go's existing value-style public telemetry option while omitting its zero value from the wire.
  • Document that telemetry export is disabled by default and add protocol/runtime/SDK regression coverage.
  • Add patch Changesets for the extension and SDKs.

test plan

  • Protocol unit suite: 26 files passed, 359 tests passed.
  • Extension unit suite: 45 files passed, 334 tests passed, 10 existing TODOs.
  • Focused TypeScript SDK create tests passed, including omitted and explicit telemetry.
  • Python focused tests: 200 passed, 1 skipped; generated-model freshness, Ruff format, and Ruff lint checks passed.
  • Full Python suite attempted: 455 passed, 2 skipped; only the two pre-existing Windows path assertions tracked by Python SDK browser tests use POSIX-only path assertions on Windows #2733 failed.
  • Go SDK suite excluding the intentionally separate examples package passed.
  • Protocol type-check and extension production build passed.
  • Targeted Oxfmt, Oxlint, Changesets validation, and git diff --check passed.
  • The full JavaScript unit run was attempted; unrelated Windows/environment failures remain in SDK path assertions, package-manager spawning, and file metadata handling.

Summary by cubic

Makes telemetry export opt-in so omitted telemetry no longer injects a placeholder endpoint that caused guaranteed-failing exports and shutdown delays. Previously, stagehand.init defaulted to https://example.com/v1/traces; now, omitting telemetry leaves tracing inert and explicit telemetry keeps OTLP export.

  • Protocol: stagehand.init.telemetry is optional; defaults removed; schema and integrity/wire-casing tests updated.
  • Extension: createStagehandTracing.configure accepts undefined and skips runtime; flush/shutdown are no-ops when telemetry is absent; tests cover this.
  • SDKs: TS omits telemetry from the wire when unset; Go generates *TelemetryConfig and sends partial configs (e.g., headers-only) while omitting the zero value; Python's telemetry is optional with the default removed.
  • Docs: Observability notes telemetry export is disabled by default.
  • Release: Patch changesets for @browserbasehq/stagehand, @browserbasehq/stagehand-go, @browserbasehq/stagehand-python, and @browserbasehq/stagehand-extension.

Migration

  • No action needed for defaults; placeholder export errors and shutdown delays stop.
  • To enable telemetry, set telemetry.traces.endpoint to your OTLP collector (must end with /v1/traces) and include required headers.
  • Go: Pass nil to omit telemetry or set a non-empty Telemetry.Traces.Endpoint (or headers) to enable export; value-style options are unchanged.

Written for commit e77c269. Summary will update on new commits.

Review in cubic

@abhinavkr26104
abhinavkr26104 requested a review from a team as a code owner August 15, 2026 12:09
@changeset-bot

changeset-bot Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e77c269

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 20 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-go Patch
@browserbasehq/stagehand-python Patch
@browserbasehq/stagehand-extension Patch
browse Patch
@browserbasehq/stagehand-integrations Patch
@browserbasehq/stagehand-integrations-example-eve-facade Patch
@browserbasehq/stagehand-integrations-example-pi-facade Patch
@browserbasehq/stagehand-integrations-claude-agent-sdk Patch
@browserbasehq/stagehand-integrations-example-claude-code-facade Patch
@browserbasehq/stagehand-integrations-codex-sdk Patch
@browserbasehq/stagehand-integrations-example-codex-facade Patch
@browserbasehq/stagehand-integrations-cursor-sdk Patch
@browserbasehq/stagehand-integrations-deepagents-sdk Patch
@browserbasehq/stagehand-integrations-eve-sdk Patch
@browserbasehq/stagehand-integrations-fx-sdk Patch
@browserbasehq/stagehand-integrations-mastra-sdk Patch
@browserbasehq/stagehand-integrations-example-mastra-facade Patch
@browserbasehq/stagehand-integrations-pi-sdk Patch
@browserbasehq/stagehand-integrations-example-vercel-ai-facade Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 20 files

Architecture diagram
sequenceDiagram
    participant Client as SDK Client (TS/Go/Python)
    participant Init as stagehand.init
    participant Schema as Protocol Schema (Zod/JSON)
    participant Ext as Extension (tracing.ts)
    participant OTLP as OTLP Collector

    Note over Client,OTLP: Telemetry Opt-In Flow

    Client->>Init: Call init with clientInfo
    alt Telemetry omitted (default)
        Init->>Schema: Validate init params
        Schema-->>Init: Optional telemetry field absent
        Init->>Ext: configure(undefined, clientInfo)
        Ext->>Ext: Skip runtime creation
        Note over Ext: Tracing inert, no exporters
        Init-->>Client: Init success
        Ext->>OTLP: No export attempts
    else Explicit telemetry configured
        Client->>Init: Set telemetry.traces.endpoint
        Init->>Schema: Validate with explicit endpoint
        Schema-->>Init: Telemetry config present
        Init->>Ext: configure(telemetry, clientInfo)
        Ext->>Ext: Create tracing runtime
        Ext->>OTLP: Start span export
        OTLP-->>Ext: Accept spans
        Init-->>Client: Init success with telemetry
    end

    Note over Client,Ext: Go SDK Special Handling
    Client->>Init: Pass TelemetryConfig (value type)
    Init->>Init: Check endpoint non-empty
    alt Endpoint empty (zero value)
        Init->>Init: Convert to nil pointer
        Init->>Ext: Omit from wire
    else Endpoint non-empty
        Init->>Init: Keep pointer reference
        Init->>Ext: Include on wire
    end

    opt Shutdown with telemetry
        Client->>Ext: forceFlush()
        Ext->>OTLP: Flush pending spans
        Client->>Ext: shutdown()
        Ext->>OTLP: Close exporters
    end

    opt Shutdown without telemetry
        Client->>Ext: forceFlush()
        Ext->>Ext: No-op (no runtime)
        Client->>Ext: shutdown()
        Ext->>Ext: No-op (no runtime)
    end
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/sdk-go/stagehand.go Resolved
abhinavkr26104 and others added 2 commits August 15, 2026 17:58
# Conflicts:
#	packages/extension/tracing.ts
#	packages/sdk-go/internal/extensionassets/stagehand-extension.zip
#	packages/sdk-python/src/stagehand/_generated/models.py
@github-actions github-actions Bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:mirrored An internal mirrored PR currently exists for this external contributor PR. labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was approved by @miguelg719 and mirrored to #3045. All further discussion should happen on that PR.

@github-actions github-actions Bot closed this Sep 25, 2026
miguelg719 added a commit that referenced this pull request Sep 26, 2026
Mirrored from external contributor PR #2738 after approval by
@miguelg719.

Original author: @abhinavkr26104
Original PR: #2738
Approved source head SHA: `e77c269fcc7ab33d2b76f213f26da62b77b1e826`

@abhinavkr26104, please continue any follow-up discussion on this
mirrored PR. When the external PR gets new commits, this same internal
PR will be marked stale until the latest external commit is approved and
refreshed here.

## Original description
# why

The v4 init schema supplied `https://example.com/v1/traces` whenever
callers omitted telemetry. The extension treated that placeholder as an
intentional OTLP destination, creating guaranteed-failing background
exports and possible shutdown delays for otherwise default Stagehand
instances.

Fixes #2732

# what changed

- Make `stagehand.init` telemetry optional instead of injecting a
placeholder endpoint.
- Leave extension tracing inert when no telemetry configuration is
supplied while preserving explicit OTLP export behavior.
- Regenerate Python and Go protocol models and the embedded Go extension
bundle.
- Keep Go's existing value-style public telemetry option while omitting
its zero value from the wire.
- Document that telemetry export is disabled by default and add
protocol/runtime/SDK regression coverage.
- Add patch Changesets for the extension and SDKs.

# test plan

- Protocol unit suite: 26 files passed, 359 tests passed.
- Extension unit suite: 45 files passed, 334 tests passed, 10 existing
TODOs.
- Focused TypeScript SDK create tests passed, including omitted and
explicit telemetry.
- Python focused tests: 200 passed, 1 skipped; generated-model
freshness, Ruff format, and Ruff lint checks passed.
- Full Python suite attempted: 455 passed, 2 skipped; only the two
pre-existing Windows path assertions tracked by #2733 failed.
- Go SDK suite excluding the intentionally separate examples package
passed.
- Protocol type-check and extension production build passed.
- Targeted Oxfmt, Oxlint, Changesets validation, and `git diff --check`
passed.
- The full JavaScript unit run was attempted; unrelated
Windows/environment failures remain in SDK path assertions,
package-manager spawning, and file metadata handling.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Makes telemetry export opt-in so omitted telemetry no longer injects a
placeholder endpoint that caused guaranteed-failing exports and shutdown
delays. `stagehand.init` no longer defaults to
`https://example.com/v1/traces`; omitting telemetry leaves tracing
inert, while explicit telemetry keeps OTLP export.

- Protocol: `stagehand.init.telemetry` is now optional with no default;
schema, integrity, and wire-casing tests updated.
- Extension: `createStagehandTracing.configure` accepts `undefined` and
skips runtime creation; flush/shutdown become no-ops when telemetry is
absent.
- SDKs: TypeScript omits `telemetry` from the wire when unset; Go's
`StagehandInitParams.Telemetry` is now `*TelemetryConfig` and omits the
zero value via `optionalTelemetry`, while `CreateOptions.Telemetry`
stays value-style; Python marks `telemetry` as `Optional` with the
placeholder default removed.
- Release: Patch changesets added for the five affected packages.

**Migration**
- No action needed; placeholder export errors and shutdown delays
disappear.
- Set `telemetry.traces.endpoint` to an OTLP collector (ending in
`/v1/traces`) with required headers to enable export.
- Go: pass `nil` to omit telemetry or set a non-empty endpoint/headers
to enable; direct `StagehandInitParams` construction now requires
`*TelemetryConfig`.

<sup>Written for commit fecc5a6.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/browserbase/stagehand/pull/3045?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->

<!-- external-contributor-pr:owned source-pr=2738
source-sha=e77c269fcc7ab33d2b76f213f26da62b77b1e826 claimer=miguelg719
-->

---------

Co-authored-by: Abhinav Kumar Singh <[email protected]>
Co-authored-by: miguel <[email protected]>
Co-authored-by: Miguel <[email protected]>
@github-actions github-actions Bot added external-contributor:completed The mirrored PR has been merged and the external contributor flow is complete. and removed external-contributor:mirrored An internal mirrored PR currently exists for this external contributor PR. labels Sep 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The mirrored PR #3045 has been merged into main. This original external contributor PR will stay closed as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:completed The mirrored PR has been merged and the external contributor flow is complete. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default telemetry exports traces to the placeholder example.com endpoint

2 participants