@ogcio/o11y-sdk-node
Version:
Opentelemetry standard instrumentation SDK for NodeJS based project
21 lines (20 loc) • 888 B
TypeScript
import type { Context } from "@opentelemetry/api";
import type { Span } from "@opentelemetry/sdk-trace-base";
import { OnEndingHookSpanProcessor } from "./on-ending-hook-span-processor.js";
/**
* A SpanProcessor that captures pseudo-profiling data (CPU time and memory usage)
* for each span and adds them as span attributes.
*
* This processor wraps the span's end() method to capture profiling metrics
* just before the span is marked as ended, while the span is still writable.
*/
export declare class PseudoProfilingSpanProcessor extends OnEndingHookSpanProcessor {
private readonly _spanProfilingData;
onStart(span: Span, _context: Context): void;
onEnding(span: Span): void;
/**
* Captures profiling data and sets attributes on the span.
* Called just before the span is ended, while it's still writable.
*/
private _captureProfilingData;
}