observability
54 pages@nais/apm API reference
Every export, signature, and option of the @nais/apm browser SDK β init, captureException, captureMessage, setUser, setContext, captureFeedback, and more.
Adding Custom Spans and Metrics with OpenTelemetry
Auto-instrumentation covers HTTP, database, and messaging calls out of the box. To trace your own business logic or track application-specific events, add custom spans and metrics using theβ¦
Adding logs to your Grafana dashboard
Add logs to your Grafana dashboards and correlate them with metrics and traces.
Alerting
Alerting is a crucial part of observability, and it's the first step in knowing when something is wrong with your application.
Auto-configuration reference
Auto-generated frontend configuration values, environment variables, and the nais.js file structure.
Avoid false errors from expected 4xx responses
Fix inflated error rates in APM caused by exceptions that produce expected 4xx responses.
Correlate traces and logs
Learn how to correlate traces with logs in Grafana Tempo.
Create a dashboard in Grafana
Create a dashboard in Grafana for your application
Create alert in Grafana
Learn how to create an alert for your application in Grafana.
Create alert with Prometheus
Create alerts for your application using Prometheus.
Create alerts from templates
Turn a Nais APM issue or service into a Grafana alert rule using the built-in error-rate, SLO burn-rate, exception-spike, web-vitals, and new-exception templates.
Custom frontend metrics
Send custom measurements from the browser and query them in Grafana.
Customize Prometheus alerts
Advanced guide to customized Prometheus alerts
Disable persistent application logs
Disable log storage for a specific application
Distributed Tracing
Application Performance Monitoring or tracing using Grafana Tempo on Nais.
Enable session replay
Opt in to masked session replay or crash snapshots in @nais/apm, understand the non-overridable masking floor, and make the privacy decision your team owns.
Expose metrics from your application
Expose metrics from your application
Frontend observability
Frontend observability with Grafana Faro gives you real user monitoring, performance metrics, error tracking, and tracing for browser applications.
Frontend observability troubleshooting
Common issues and solutions for frontend observability with Faro.
Frontend-to-backend trace propagation
Connect frontend browser traces to backend spans for end-to-end visibility.
Get backend exceptions into Issues
Get your backend exceptions β JVM (Spring Boot, Ktor) and Node.js β into the Nais APM Issues tab with tight grouping and a stack trace, whether you log to stdout (the default) or export logs over OpenTelemetry.
Get started with auto-instrumentation
Enable auto-instrumentation to collect traces and runtime metrics from your application without code changes.
Get started with Grafana Loki
Get started with Grafana Loki, the default and preferred log aggregation system for all Nais application
Get started with Grafana Tempo
Grafana Tempo is a distributed tracing backend that stores and queries traces. It is integrated with Grafana, so you can visualize and query traces alongside your metrics and logs.
Get started with Nais APM
Find your service in Nais APM and tour its health overview, issues, backend, database, frontend, traces, and logs.
Get started with Team Logs
Get started with Team Logs, a private logging solution leveraging Google Cloud Logs.
Getting Started with Observability in Nais
This tutorial walks you through enabling observability for your Nais application and finding your data in the Grafana stack.
How Nais APM works
How Nais APM works β where your telemetry comes from and where it lives, why issue grouping is computed statelessly at query time, and what Nais APM deliberately does not do.
Issues and fingerprinting
How Nais APM groups errors into issues β versioned fingerprints, the tiers that decide grouping, and what makes two errors "the same issue".
Logging
Understand how application logging works in Nais, its purpose, good practices, and the available log destinations.
Make database queries visible
The instrumentation the Nais APM Database tab needs β OpenTelemetry client spans with db.system, and connection-pool metrics for pool health.
Metrics
Metrics are a way to measure the state of your application and can be used to create alerts and dashboards in Grafana.
Metrics and alerts for logs
Use Loki-derived metrics to monitor log patterns and create Prometheus alerts.
Migrate from Sentry to @nais/apm
Move a frontend app off @sentry/* and onto the @nais/apm SDK β a clean, full migration with a concept map, a copy-pasteable recipe, and an honest list of what is different and what is not supported yet.
Nais APM
Nais APM is the curated application performance monitoring app in Grafana. It turns the telemetry your app already ships into service health, issues, and traces β no manual queries.
Next.js quickstart with @nais/apm
Instrument a Next.js app with @nais/apm β client init, an error boundary, route tracking, and opt-in tracing. Covers both the App Router and the Pages Router.
Observability
Nais offers several methods for monitoring and observing your applications. This page describes the different options and how to use them.
Observability Glossary
Observability is the art of understanding how a system behaves by adding instrumentation such as logs, metrics, and traces.
OpenTelemetry Auto-Instrumentation Configuration
When you enable auto-instrumentation in your application the following OpenTelemetry configuration will become available to your application as environment variables:
OpenTelemetry Metrics
This is a list of metrics exported by the OpenTelemetry SDKs and auto-instrumentation libraries. The OpenTelemetry SDKs and auto-instrumentation libraries export the following general metrics:
OpenTelemetry Trace Semantic Conventions
OpenTelemetry Semantic Conventions define a common set of attribute names for spans, so that traces from different languages and libraries can be queried and correlated consistently. This page listsβ¦
Prometheus Alerting Rule Reference
PrometheusRule resource specification for defining alerts in Prometheus.
Push metrics to Prometheus
Push metrics to Prometheus
React + Vite quickstart with @nais/apm
Instrument a React single-page app built with Vite using @nais/apm β init at the entry point, an error boundary, and React Router route tracking.
Set up Faro
Set up Grafana Faro in your frontend application for real user monitoring, error tracking, and tracing.
Set up Faro with Next.js
Set up Grafana Faro in a Next.js application using the App Router.
Sourcemap deobfuscation
How sourcemap deobfuscation works for frontend error stack traces.
Span Metrics
Span metrics are collected for each span and provide insight into the performance of your application. On our platform, these metrics are generated by the Grafana Tempo metrics generator and exportedβ¦
Trace context propagation
Learn how to propagate trace context across process boundaries in a few common scenarios.
Track frontend errors with @nais/apm
Install the @nais/apm SDK in a browser app, initialize it with zero config, capture exceptions, and see them as issues in Nais APM.
Triage an issue
Resolve, ignore, and assign issues in Nais APM, and understand regressions, mutes, and how triage state is shared across your team.
URL and deep-link contract
The stable URL and query-parameter contract for deep-linking into Nais APM from alerts, runbooks, and shared investigations.
Use log patterns during an incident
Collapse thousands of log lines into a handful of patterns in the Nais APM Logs tab to spot what's new or spiking during an incident.
View logs from the command line
View logs from the command line using kubectl.