import { ModuleMetadata, Type, Abstract } from '@nestjs/common'; import { Attributes } from '@opentelemetry/api'; import { RouteInfo } from '@nestjs/common/interfaces'; export type OpenTelemetryModuleOptions = { /** * OpenTelemetry Metrics Setup */ metrics?: OpenTelemetryMetrics; }; export interface OpenTelemetryOptionsFactory { createOpenTelemetryOptions(): Promise | OpenTelemetryModuleOptions; } /** * The options for the asynchronous Terminus module creation * * @publicApi */ export interface OpenTelemetryModuleAsyncOptions extends Pick { /** * The name of the module */ name?: string; /** * The class which should be used to provide the Terminus options */ useClass?: Type; /** * Import existing providers from other module */ useExisting?: Type; /** * The factory which should be used to provide the Terminus options */ useFactory?: (...args: any[]) => Promise | OpenTelemetryModuleOptions; /** * The providers which should get injected */ inject?: (string | symbol | Function | Type | Abstract)[]; } export type OpenTelemetryMetrics = { hostMetrics?: boolean; apiMetrics?: { enable?: boolean; defaultAttributes?: Attributes; ignoreRoutes?: (string | RouteInfo)[]; ignoreUndefinedRoutes?: boolean; prefix?: string; }; };