Repository navigation
docs: add OpenTelemetry provider guides - #2919
antonvishal wants to merge 5 commits into
Conversation
|
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
|
@cubic review |
@Kylejeong2 I have started the AI code review. It will take a few minutes to complete. |
Kylejeong2
left a comment
There was a problem hiding this comment.
left some comments, address @cubic as well
There was a problem hiding this comment.
All reported issues were addressed across 12 files
Architecture diagram
sequenceDiagram
participant Dev as Developer
participant App as Stagehand App
participant Browser as Local Browser
participant OTel as OTLP Exporter
participant Provider as Observability Provider
participant Collector as OTel Collector
Note over Dev,Provider: Stagehand v4 OpenTelemetry Integration Flow
Dev->>App: launch() + create() with telemetry config
App->>Browser: Start browser context
App->>App: Emit operation spans (act/observe/extract)
App->>App: Emit log spans for each log record
Browser-->>App: Page interaction results
App->>OTel: Batched OTLP/HTTP JSON export to /v1/traces
alt Direct provider export
OTel->>Provider: POST traces with provider-specific headers
Note over OTel,Provider: Auth varies by provider
alt Braintrust
OTel->>Provider: Authorization: Bearer + x-bt-parent: project_id
else Langfuse
OTel->>Provider: Authorization: Basic + x-langfuse-ingestion-version: 4
else LangSmith
OTel->>Provider: x-api-key + Langsmith-Project header
else Sentry
OTel->>Provider: x-sentry-auth: sentry sentry_key
end
Provider-->>OTel: 200 OK / export error
else Collector routing (NEW: OTLP Collector)
OTel->>Collector: POST http://localhost:4318/v1/traces
Collector->>Collector: Batch processor + fan-out
Collector->>Provider: Export via otlp_http exporter
Provider-->>Collector: Response
Collector-->>OTel: 200 / error
end
Note over App,Provider: Verification
Provider->>Provider: File trace under project (x-bt-parent, Langsmith-Project, etc.)
Dev->>Provider: Check traces with service.name = stagehand-service-worker
alt Missing traces
Note over Dev,Provider: Check data plane/region, headers, and close() was called
end
App->>App: stagehand.close() flushes remaining batch
App->>OTel: Final export before process exit
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
85309e4 to
ae93dce
Compare
|
Hey @Kylejeong2, I addressed the comments. |
Keep the collector page in the sidebar so the overview grid stays even. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Adds Stagehand v4 OTLP setup guides for Braintrust, Langfuse, LangSmith, Sentry, and the OpenTelemetry Collector.
I manually verified the endpoint and header requirements for each provider.
Follow-up: add a Stagehand page to each provider's documentation.
Test plan