diff options
author | snek <snek@deno.com> | 2024-11-13 11:38:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-13 10:38:46 +0000 |
commit | aa546189be730163ee5370029e4dfdb3b454ab96 (patch) | |
tree | 4407643e6908f82c9ac31d9ae5faf04b3ab8d413 /cli/tsc | |
parent | 7becd83a3828b35331d0fcb82c64146e520f154b (diff) |
feat: OpenTelemetry Tracing API and Exporting (#26710)
Initial import of OTEL code supporting tracing. Metrics soon to come.
Implements APIs for https://jsr.io/@deno/otel so that code using
OpenTelemetry.js just works tm.
There is still a lot of work to do with configuration and adding
built-in tracing to core APIs, which will come in followup PRs.
---------
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'cli/tsc')
-rw-r--r-- | cli/tsc/dts/lib.deno.unstable.d.ts | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index 973a09d92..6234268c3 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -1225,6 +1225,108 @@ declare namespace Deno { export {}; // only export exports } + /** + * @category Telemetry + * @experimental + */ + export namespace tracing { + /** + * Whether tracing is enabled. + * @category Telemetry + * @experimental + */ + export const enabled: boolean; + + /** + * Allowed attribute type. + * @category Telemetry + * @experimental + */ + export type AttributeValue = string | number | boolean | bigint; + + /** + * A tracing span. + * @category Telemetry + * @experimental + */ + export class Span implements Disposable { + readonly traceId: string; + readonly spanId: string; + readonly parentSpanId: string; + readonly kind: string; + readonly name: string; + readonly startTime: number; + readonly endTime: number; + readonly status: null | { code: 1 } | { code: 2; message: string }; + readonly attributes: Record<string, AttributeValue>; + readonly traceFlags: number; + + /** + * Construct a new Span and enter it as the "current" span. + */ + constructor( + name: string, + kind?: "internal" | "server" | "client" | "producer" | "consumer", + ); + + /** + * Set an attribute on this span. + */ + setAttribute( + name: string, + value: AttributeValue, + ): void; + + /** + * Enter this span as the "current" span. + */ + enter(): void; + + /** + * Exit this span as the "current" span and restore the previous one. + */ + exit(): void; + + /** + * End this span, and exit it as the "current" span. + */ + end(): void; + + [Symbol.dispose](): void; + + /** + * Get the "current" span, if one exists. + */ + static current(): Span | undefined | null; + } + + /** + * A SpanExporter compatible with OpenTelemetry.js + * https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_sdk_trace_base.SpanExporter.html + * @category Telemetry + * @experimental + */ + export class SpanExporter {} + + /** + * A ContextManager compatible with OpenTelemetry.js + * https://open-telemetry.github.io/opentelemetry-js/interfaces/_opentelemetry_api.ContextManager.html + * @category Telemetry + * @experimental + */ + export class ContextManager {} + + export {}; // only export exports + } + + /** + * @category Telemetry + * @experimental + */ + export namespace metrics { + export {}; // only export exports + } + export {}; // only export exports } |