UNPKG

nice-grpc-opentelemetry

Version:

OpenTelemetry instrumentation for nice-grpc

21 lines (20 loc) 955 B
import { Span } from '@opentelemetry/api'; import { MESSAGETYPEVALUES_RECEIVED, MESSAGETYPEVALUES_SENT } from '@opentelemetry/semantic-conventions'; export declare const tracer: import("@opentelemetry/api").Tracer; /** * @param methodPath Full method path in form `/package.service/method` * * @see https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/rpc/#span-name */ export declare function getSpanName(methodPath: string): string; /** * Wrap call request or response iterable and emit `message` span event for each * item. * * @param iterable request or response iterable * @param span call span * @param type `SENT` or `RECEIVED` * * @see https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/rpc/#events */ export declare function emitSpanEvents<T>(iterable: AsyncIterable<T>, span: Span, type: typeof MESSAGETYPEVALUES_SENT | typeof MESSAGETYPEVALUES_RECEIVED): AsyncIterable<T>;