Logfire Frontend
PydanticOfficialPublished by Pydantic
- Skill
- Tool integration
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides guidance on configuring Pydantic Logfire for browser-based applications using the @pydantic/logfire-browser and @pydantic/logfire-session-replay SDKs. It covers setup procedures for React, Vite, and Next.js, alongside strategies for managing observability signals, including Web Vitals, error tracking, and session replay recording. The skill emphasizes proper credential usage, privacy controls through data masking, and selecting appropriate capture profiles to balance telemetry volume with diagnostic needs.
What it does
- Configures frontend observability using Logfire browser SDKs.
- Implements session replay with configurable privacy masking and input blocking.
- Supports integration with React, Vite, and Next.js client-side environments.
- Provides capture profiles for varying levels of instrumentation and performance overhead.
- Guides the setup of error tracking and Web Vitals monitoring.
- Offers verification steps to ensure telemetry ingestion and replay playback.
When to use it
- When you need to monitor browser-side errors and user interactions.
- When you want to record user sessions for debugging complex frontend issues.
- When you need to track Web Vitals and performance metrics in a web application.
- When you need to reduce browser telemetry volume while maintaining critical error visibility.
Advantages
- Enables end-to-end visibility by linking browser sessions to backend traces.
- Provides granular control over data privacy through text and input masking.
- Offers flexible capture profiles to optimize for performance or detail.
- Integrates seamlessly with modern frontend frameworks like Next.js and React.
Usage examples
- “How do I set up basic frontend observability in my React application?”
- The agent provides the installation commands for @pydantic/logfire-browser and shows how to initialize the configuration in your main entrypoint before rendering the root component.
- “How can I enable session replay while masking sensitive user input?”
- The agent guides you to install the session replay package and configure the integration with maskAllInputs: true and blockSelector options to protect sensitive regions.
- “I need to reduce the amount of telemetry data my frontend sends. What are my options?”
- The agent explains the 'Minimal errors and replays' capture profile, showing how to disable automatic spans and RUM signals while keeping essential error reporting.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/pydantic/logfire-frontend/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip logfire-frontend.zip -d .agents/skills
Documentation by Pydantic
Set Up Frontend Observability and Session Replays
The application uses @pydantic/logfire-browser and, when replay is requested,
@pydantic/logfire-session-replay. Configure one browser provider; preserve an
existing OpenTelemetry provider, proxy, and application initialization pattern.
Confirm the browser application
Read repository instructions, the application manifest, browser entrypoint, router, and existing instrumentation. For Next.js, distinguish client code from server instrumentation before changing either. Respect dependency constraints; check the installed SDK's types before using a capture or sampling option.
Preserve the exact origin, organization, and project supplied by the user or setup handoff. Browser-only setup does not require a CLI login, a local SDK credential, or an ordinary project write token. Use existing native MCP access for verification when available; otherwise use the Logfire UI.
Create or select the frontend application under Frontend → Applications and
use its generated regional URL and restricted frontend token. A normal project
write token, server environment variable, or .logfire credential is unsuitable
for browser code. The frontend application owns service identity. If no supported
public API/tool can manage it, use the UI; do not invent a private endpoint.
Match capture to the request
Read browser setup, then the applicable section of capture profiles:
Full frontend observability: automatic page/request/interaction spans and Web Vitals. Add replay only when requested.
Errors and replays with automatic instrumentation: retain traces with Logfire error-level events or OpenTelemetry error status, while keeping replay independently enabled. This also retains other spans in a qualifying trace.
Minimal errors and replays: disable automatic spans and Web Vitals and explicitly report application errors. Use when the user requires lower browser instrumentation overhead or strictly limits the signals collected.
Preserve existing approved replay rates and masking. Trace sampling, replay
sampling, and metric capture are separate decisions. Do not promise that
minLevel filters automatic spans, that a trace sampler retains an entire browser
session, or that every handled application failure is captured automatically.
Session replay is Early Access; check availability for the target organization and keep an existing application rollout flag. Mask text and inputs, leave console capture off, and block sensitive regions before recording them. Review attributes and URLs separately from visible-text masking. Add normalized route templates and opaque user IDs only when useful; names and emails are optional personal data.
Verify the selected behavior
Use verification and troubleshooting to exercise the real browser application, check the signals retained and omitted, query fresh errors in the exact project, and play the matching recording. For a sampling profile, test successful requests and the failure types the user cares about; inspect actual exported spans rather than assuming how HTTP status maps to error severity.
Run the application's normal typecheck/build and focused tests. Report browser execution, telemetry ingestion, and replay playback separately. A successful build, flush, upload response, or generated link does not prove all three. Return the verified project/application, capture policy, and a clean relevant UI link. If account reads or browser playback are unavailable, mark those parts unverified and state what evidence is missing.
For server-side Node.js or Next.js setup, use application instrumentation.
Files
- ATTRIBUTION.mdAdded by AutoGineer849 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md4.1 KiB
- references/capture-profiles.md5.8 KiB
- references/setup.md9.3 KiB
- references/verification.md5.3 KiB
references/verification.md
Verify Browser Telemetry and Replay
Verify in the user's selected application and exact Logfire project. Use the available browser tool; do not treat a Node-only SDK script as browser proof. Keep a test time window, application name, and non-sensitive test operation so old telemetry cannot satisfy the check.
Exercise the selected capture profile
Run the normal typecheck/build, start the browser app using its documented dev command, and exercise:
A successful request and ordinary navigation/interaction.
The relevant HTTP failure (4xx/5xx or rejected fetch), an uncaught JavaScript error, and an unhandled rejection. Use controlled non-sensitive test failures.
A failure caught by the application or framework boundary, reported through
reportError()if that is part of the user's desired coverage.
Inspect browser requests to the configured trace, metric, and replay endpoints. For the error-tail profile, successful standalone traces should be omitted; qualifying error traces should survive. Successful spans within an accepted error trace are expected. No Web Vitals metric exports should occur when that capture is disabled. For the minimal profile, automatic request spans should be absent while explicitly reported errors remain.
Do not infer which failed HTTP responses qualify from the configuration alone: inspect exported status/level with the installed instrumentation. The sampler's decision does not prove that JavaScript errors were reported; exercise the listeners and caught-error path separately. Ensure reinitialization and React Strict Mode do not create duplicate providers or duplicate error reports.
Confirm fresh telemetry in Logfire
Use existing read-capable native MCP or the Logfire UI for the exact project. Do not require a CLI login or SDK write token for browser setup. If CLI account access is specifically needed, use the CLI connection guide. Restricted frontend tokens and ordinary SDK write tokens cannot query data.
Use a bounded query for the exercised frontend application and time window:
SELECT start_timestamp, trace_id, service_name, message,
attributes->>'session.id' AS session_id
FROM records
WHERE service_name = 'customer-portal'
AND start_timestamp > now() - interval '15 minutes'
ORDER BY start_timestamp DESC
LIMIT 20Replace the synthetic service name and time window with confirmed values.
Require fresh rows for the exercised errors with the frontend application's
identity and a non-empty session.id. Inspect the error/exception details and
any associated request spans. Full RUM also needs fresh page-load/request data
and browser-supported Web Vitals; do not require performance charts from an
errors-only profile. If reads are unavailable, mark ingestion unverified.
Verify a playable recording
When replay is requested, keep the tab active and interact for longer than the configured minimum recording duration. For a deterministic local test only, set continuous recording to 1; do not change deployed sampling merely to make one test pass. Check the replay controller actually started and uploads reached the configured destination.
Open Frontend → Session Replays with a time range including the session's
start. Open the matching recording and verify that playback, navigation/click
markers, and the activity list advance together. Confirm the error's session.id
matches the recording and its timestamp falls within the recorded time bounds.
Use the recording's browser-telemetry link to verify the relevant error appears.
For the privacy check, use synthetic visible text/input values and a synthetic blocked region. Confirm masking and omission in the recording; test the actual application's sensitive attributes/URLs separately. An upload response proves transport acceptance, not successful playback or masking.
If a playback-capable browser or read access is unavailable, report the browser and transport checks performed and explicitly leave ingestion/playback unverified. Return the clean project or recording link verified in the UI or returned by the available MCP tool. Do not invent a private replay URL/API or inject credentials into a browser. Link creation is a separate convenience, never an ingestion check.
Troubleshooting
No browser errors: check whether the exception was caught, whether its reporting handler ran, and whether head/tail sampling discarded its trace.
No replay: check Early Access availability, actual recorder mode/sample choice, minimum duration, failed imports, content blockers, CSP, and upload authentication. A sampled-off controller is not a transport failure.
Replay exists but no matching spans: check the exact app/project, shared
session.id, recording time bounds, retention, and trace sampling. Error-only sampling intentionally omits healthy standalone traces.Recording gaps: inspect failed/retried chunk uploads and downloads. A page-close flush is best effort; in-memory chunks do not survive reloads.
Duplicate setup or capture: initialize one module/provider, install error listeners once, and exclude telemetry/replay uploads from both instrumentation and recorder network capture. Preserve built-in endpoint exclusions when adding custom ignore patterns or a proxy.
Source: Session Replays verification.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Pydantic
- Publisher
- Pydantic (Official)
- Source
- pydantic/skills · skills/logfire-frontend · commit 98f591c
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- pydantic/skills
AutoGineer is not affiliated with or endorsed by Pydantic or Pydantic.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download logfire-frontend.zip