Skip to content

Sentry Integration

createSentryAdapter() — builds an onLog/onError callback pair that forwards every request to Sentry as a breadcrumb, and 5xx/network errors as Sentry events.

ts
function createSentryAdapter(
  sentry: SentryLike,
  options?: SentryAdapterOptions,
): Pick<NetworkDashboardOptions['callbacks'], 'onLog' | 'onError'>

Options

filter

(entry: UnifiedLogEntry) => boolean · default: —

When provided, only entries for which this returns true are sent to Sentry.

errorStatusThreshold

number · default: 500

HTTP status at or above which a request is also reported as a Sentry event via captureMessage, in addition to the breadcrumb.

includeBodies

boolean · default: false

Include request/response bodies in the breadcrumb data.

Usage

ts
import * as Sentry from '@sentry/vue'
import { createSentryAdapter } from 'vue-network-dashboard'

app.use(NetworkDashboardPlugin, {
  callbacks: createSentryAdapter(Sentry, {
    errorStatusThreshold: 500, // send a Sentry event for 5xx (default)
    includeBodies: false, // omit bodies from breadcrumbs (default)
  }),
})

Every request becomes a Sentry breadcrumb. HTTP 5xx responses and network errors are also sent as Sentry events via captureMessage.