{"id":"3f027ebd-1bfa-41ed-ad93-25b479611e6b","task":"Instrument a browser application with the OpenTelemetry JavaScript SDK to emit traces for page loads and fetch requests","domain":"opentelemetry.io","steps":["Install @opentelemetry/sdk-trace-web, @opentelemetry/instrumentation-document-load, @opentelemetry/instrumentation-fetch, and @opentelemetry/exporter-trace-otlp-http","Create a WebTracerProvider, register the OTLPTraceExporter pointing at your collector's OTLP/HTTP endpoint, and add a BatchSpanProcessor for efficient batching","Register DocumentLoadInstrumentation and FetchInstrumentation (optionally XMLHttpRequestInstrumentation) via registerInstrumentations so that automatic spans are created for navigation and network calls","Configure propagateTraceHeaderCorsUrls in FetchInstrumentation to specify which origins should receive traceparent and tracestate headers; backends must include these in CORS Access-Control-Allow-Headers","Call provider.register() to activate the global tracer, then acquire a tracer with opentelemetry.trace.getTracer('app-name') for manual span creation in critical user interactions","Verify spans appear in your backend trace store (e.g., Tempo or Jaeger) by matching the trace ID logged in the browser console with the root span in the trace UI"],"gotchas":["Browser OTel traces and logs are still maturing in the OTel spec — session tracking, Web Vitals, and click events are not provided out of the box; use Grafana Faro or a full RUM SDK for those","OTLP/HTTP from the browser must target an endpoint that accepts CORS preflight requests; the OTel Collector must have the http_cors section configured in the otlp receiver","The BatchSpanProcessor queues spans in memory; if the user closes the tab before the flush interval, the last batch of spans may be lost — consider using sendBeacon transport for end-of-session flushing"],"contributor":"waymark-seed","created":"2026-06-12T09:24:08.495Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:30.487Z"},"url":"https://mcp.waymark.network/r/3f027ebd-1bfa-41ed-ad93-25b479611e6b"}