OpenTelemetry Integration
createOpenTelemetryAdapter() — builds an onLog callback that creates one OpenTelemetry span per HTTP request, with semantic HTTP attributes.
ts
function createOpenTelemetryAdapter(
tracer: OTelTracerLike,
options?: OpenTelemetryAdapterOptions,
): Pick<NetworkDashboardOptions['callbacks'], 'onLog'>Options
httpOnly
boolean · default: true
Skip WebSocket/SSE entries and only create spans for HTTP requests.
includeBodySize
boolean · default: true
Add request/response body size attributes to the span.
Usage
ts
import { trace } from '@opentelemetry/api'
import { createOpenTelemetryAdapter } from 'vue-network-dashboard'
const tracer = trace.getTracer('my-app')
app.use(NetworkDashboardPlugin, {
callbacks: createOpenTelemetryAdapter(tracer, {
httpOnly: true, // skip WebSocket/SSE (default)
includeBodySize: true, // add body size attributes (default)
}),
})Each span carries semantic HTTP attributes (http.request.method, http.response.status_code, url.full, etc.) following semconv 1.23.