You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose browser instrumentation factories and lazy auto-instrumentation through the Logfire browser package so applications can opt into richer RUM setup without importing OpenTelemetry web auto-instrumentations directly.
Keep Web Vitals spans provider-owned, add explicit Logfire page URL attributes, document replay correlation tradeoffs, and bump @pydantic/logfire-browser to 0.17.0-alpha.2 so the alpha release workflow publishes these SDK changes.
`traceUrl` should point to a server-side endpoint that accepts OTLP trace requests from your browser instrumentation, forwards them to Logfire, and adds the `Authorization` header on the server.
35
34
35
+
`autoInstrumentations` is opt-in and lazily loads OpenTelemetry browser auto-instrumentations after the Logfire browser provider is ready. For advanced integrations, `instrumentations` also accepts factories, so custom instrumentation construction can be deferred until `configure()` has registered the provider.
36
+
36
37
Use `diagLogLevel` while troubleshooting local browser instrumentation:
37
38
38
39
```ts
39
40
logfire.configure({
40
41
traceUrl: '/logfire-proxy/v1/traces',
41
42
serviceName: 'web-app',
42
-
instrumentations: [getWebAutoInstrumentations()],
43
+
autoInstrumentations: true,
43
44
diagLogLevel: logfire.DiagLogLevel.ALL,
44
45
})
45
46
```
@@ -67,9 +68,13 @@ of total duration by default. Each span gets `session.id` and
67
68
`browser.session.id`; `session.id` is the OpenTelemetry semantic attribute and
68
69
`browser.session.id` is emitted for Logfire Platform compatibility.
69
70
70
-
Session-enabled spans also get `url.full` and `url.path` by default. If your
71
-
URLs may contain sensitive query strings or fragments, sanitize or suppress
72
-
these attributes:
71
+
Session-enabled spans also get `logfire.page.url.full` and
72
+
`logfire.page.url.path` by default for current page context. During the alpha,
73
+
the SDK also emits compatibility `url.full` and `url.path` values with the same
74
+
sanitized page URL. Prefer `logfire.page.url.*` for page grouping because
75
+
OpenTelemetry fetch/resource spans may use `url.*` for the network target URL.
76
+
If your URLs may contain sensitive query strings or fragments, sanitize or
77
+
suppress these attributes:
73
78
74
79
```ts
75
80
logfire.configure({
@@ -177,13 +182,14 @@ Metric data point attributes are intentionally low-cardinality:
177
182
`web_vital.name` and `web_vital.rating` by default. They do not include
178
183
`session.id`, `browser.session.id`, `url.full`, `url.path`, Web Vital
179
184
ids/deltas, DOM selectors, attribution fields, or raw PerformanceEntry data. Use
180
-
spans for raw-sample drilldown, session/replay correlation, exact URL context,
181
-
and attribution selectors.
185
+
spans for raw-sample drilldown, session/replay correlation, exact page context,
186
+
and attribution selectors. When metrics are configured, Logfire Platform should
187
+
treat these histograms as the aggregate Web Vitals surface.
182
188
183
189
For modern single-page apps, these are standard document-level Web Vitals, not
184
-
route-level soft-navigation metrics. Span URL attributes describe the browser
185
-
URL when the callback fires; route-specific Core Web Vitals need separate route
186
-
or soft-navigation instrumentation. To add a route dimension to metrics, pass a
190
+
route-level soft-navigation metrics. Span page URL attributes describe the
191
+
browser URL when the callback fires; route-specific Core Web Vitals need
192
+
separate route or soft-navigation instrumentation. To add a route dimension to metrics, pass a
187
193
low-cardinality template such as `/products/:id` through
188
194
`rum.webVitals.metrics.attributes`.
189
195
@@ -218,10 +224,13 @@ logfire.configure({
218
224
```
219
225
220
226
`sessionReplay` implies default RUM session behavior. Replay chunks and browser
221
-
spans share `session.id` / `browser.session.id`, and spans started while replay
222
-
is active include `logfire.session_replay.active` and
223
-
`logfire.session_replay.mode`. The browser SDK does not populate replay
224
-
`traceIds` from active-span polling.
227
+
spans share `session.id` / `browser.session.id`. Spans started after replay has
228
+
loaded and sampled into `full` or `buffer` mode include
229
+
`logfire.session_replay.active` and `logfire.session_replay.mode`. Those active
230
+
attributes are truthful best-effort annotations, not the primary correlation
231
+
key; early spans should be correlated to replay by browser session id and replay
232
+
time bounds. The browser SDK does not populate replay `traceIds` from
233
+
active-span polling.
225
234
226
235
Direct token usage is available as an advanced escape hatch, but it exposes the
227
236
write token to browser code and should not be the default browser deployment
0 commit comments