testing-amplication-opentelemetry-nestjs
Version:
Testing OpenTelemetry module for Nestjs with auto instrumentation and resource detection. Initially forked from https://github.com/overbit/opentelemetry-nestjs.git
19 lines (15 loc) • 419 B
text/typescript
import { context, trace, Span } from '@opentelemetry/api';
import { Injectable } from '@nestjs/common';
()
export class TraceService {
public getTracer() {
return trace.getTracer('default');
}
public getSpan(): Span {
return trace.getSpan(context.active());
}
public startSpan(name: string): Span {
const tracer = trace.getTracer('default');
return tracer.startSpan(name);
}
}