import { TracerProvider } from '@opentelemetry/api'; /** Interface Plugin to apply patch. */ export interface Plugin { /** * Contains all supported versions. * All versions must be compatible with [semver](https://semver.org/spec/v2.0.0.html) format. * If the version is not supported, we won't apply instrumentation patch (see `enable` method). * If omitted, all versions of the module will be patched. */ supportedVersions?: string[]; /** * Name of the module that the plugin instrument. */ moduleName: string; /** * Method that enables the instrumentation patch. * @param moduleExports The value of the `module.exports` property that would * normally be exposed by the required module. ex: `http`, `https` etc. * @param TracerProvider a tracer provider. * @param [config] an object to configure the plugin. */ enable(moduleExports: T, TracerProvider: TracerProvider, config?: PluginConfig): T; /** Method to disable the instrumentation */ disable(): void; } export interface PluginConfig { /** * Whether to enable the plugin. * @default true */ enabled?: boolean; /** * Path of the trace plugin to load. * @default '@opentelemetry/plugin-http' in case of http. */ path?: string; /** * Request methods that match any string in ignoreMethods will not be traced. */ ignoreMethods?: string[]; /** * URLs that partially match any regex in ignoreUrls will not be traced. * In addition, URLs that are _exact matches_ of strings in ignoreUrls will * also not be traced. */ ignoreUrls?: Array; /** * List of internal files that need patch and are not exported by * default. */ internalFilesExports?: PluginInternalFiles; /** * If true, additional information about query parameters and * results will be attached (as `attributes`) to spans representing * database operations. */ enhancedDatabaseReporting?: boolean; } export interface PluginInternalFilesVersion { [pluginName: string]: string; } /** * Each key should be the name of the module to trace, and its value * a mapping of a property name to a internal plugin file name. */ export interface PluginInternalFiles { [versions: string]: PluginInternalFilesVersion; }