This repository was archived by the owner on Jun 2, 2025. It is now read-only.
forked frompetyosi/client-side-instrumentation
- Notifications
You must be signed in to change notification settings - Fork1
pydantic/nextjs-client-side-instrumentation
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Moved to thelogfire-js monorepo
The example showcases how a fetch request initiated from the browser can propagate to the server and then to a third-party service, all while being instrumented with OpenTelemetry. The example uses the Logfire OTel SDK for both the client and server sides.
- The
ClientInstrumentationProvider
is a client-only component that instruments the browser fetch. - To avoid exposing the write token, the middleware.ts proxies the logfire
/v1/traces
request. - The instrumentation.ts file is the standard
@vercel/otel
setup. - The
.env
should look like this:
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://logfire-api.pydantic.dev/v1/tracesOTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://logfire-api.pydantic.dev/v1/metricsOTEL_EXPORTER_OTLP_HEADERS='Authorization=your-token'LOGFIRE_TOKEN='your-token'
NOTE: alternatively, if you're not sure about the connection between the client and the server, you can host the proxy at a different location (e.g. Cloudflare).
About
No description, website, or topics provided.
Resources
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Languages
- TypeScript58.2%
- CSS37.4%
- JavaScript4.4%