UNPKG

@fastify/otel

Version:

Official Fastify OpenTelemetry Instrumentation

37 lines (29 loc) 1.08 kB
/// <reference types="node" /> import { InstrumentationBase, type InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation' import type { FastifyPluginCallback } from 'fastify' import type { FastifyOtelInstrumentationOpts, FastifyOtelOptions, FastifyOtelRequestContext } from './types' declare module 'fastify' { interface FastifyRequest { opentelemetry(): FastifyOtelRequestContext } interface FastifyContextConfig { /** Set this to `false` to disable OpenTelemetry for the route */ otel: boolean } } declare class FastifyOtelInstrumentation<Config extends FastifyOtelInstrumentationOpts = FastifyOtelInstrumentationOpts> extends InstrumentationBase<Config> { servername: string constructor (config?: FastifyOtelInstrumentationOpts) init (): InstrumentationNodeModuleDefinition[] plugin (): FastifyPluginCallback<FastifyOtelOptions> } declare namespace exported { export type { FastifyOtelInstrumentationOpts } export { FastifyOtelInstrumentation } export { FastifyOtelInstrumentation as default } } export = exported