UNPKG

@mwcp/otel

Version:
23 lines (14 loc) 481 B
import assert from 'node:assert' import { Provide } from '@midwayjs/core' import { MConfig } from '@mwcp/share' import { Trace } from '##/lib/index.js' import { Config, ConfigKey } from '##/lib/types.js' @Provide() export class DefaultOtelComponentService { @MConfig(ConfigKey.config) readonly config: Config @Trace({ startActiveSpan: false }) async hello(input: string): Promise<string> { assert(typeof this.config.enable !== 'undefined') return input } }