diff --git a/packages/core-shared/src/instrumentation/tracer.interface.ts b/packages/core-shared/src/instrumentation/tracer.interface.ts new file mode 100644 index 0000000..a086ca8 --- /dev/null +++ b/packages/core-shared/src/instrumentation/tracer.interface.ts @@ -0,0 +1,16 @@ +export type AttributeValue = string | number | boolean | null; + +export type SpanOpts = { + name: string; + op?: "use-case" | "controller" | "repository" | "service" | string; + attributes?: Record; +}; + +export interface ISpan { + setAttribute(key: string, value: AttributeValue): void; + setStatus(status: "ok" | "error", message?: string): void; +} + +export interface ITracer { + startSpan(opts: SpanOpts, fn: (span: ISpan) => Promise): Promise; +}