import type { Middleware , ParameterizedContext , DefaultState } from 'koa' ; import type { RouterParamContext } from '@koa/router' ; import type * as Router from '@koa/router' ; import { InstrumentationConfig } from '@opentelemetry/instrumentation' ; /**
 * This symbol is used to mark a Koa layer as being already instrumented
 * since its possible to use a given layer multiple times (ex: middlewares)
 */ export const kLayerPatched = Symbol ( 'koa-layer-patched' ) ; export type KoaMiddleware = Middleware < DefaultState , KoaContext > & { [ kLayerPatched ] ? : boolean ; router ? : Router ; } ; export type KoaContext = ParameterizedContext < DefaultState , RouterParamContext > ; /**
 * Options available for the Koa Instrumentation (see [documentation](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-Instrumentation-koa#koa-Instrumentation-options))
 */ export interface KoaInstrumentationConfig extends InstrumentationConfig { /** Ignore specific layers based on their type */ ignoreLayersType ? : KoaLayerType [ ] ; } export enum KoaLayerType { ROUTER = 'router' , MIDDLEWARE = 'middleware' } export const KoaComponentName = 'koa' ;