feat(core-shared): add ITracer/ISpan interfaces
This commit is contained in:
16
packages/core-shared/src/instrumentation/tracer.interface.ts
Normal file
16
packages/core-shared/src/instrumentation/tracer.interface.ts
Normal file
@@ -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<string, AttributeValue>;
|
||||
};
|
||||
|
||||
export interface ISpan {
|
||||
setAttribute(key: string, value: AttributeValue): void;
|
||||
setStatus(status: "ok" | "error", message?: string): void;
|
||||
}
|
||||
|
||||
export interface ITracer {
|
||||
startSpan<T>(opts: SpanOpts, fn: (span: ISpan) => Promise<T>): Promise<T>;
|
||||
}
|
||||
Reference in New Issue
Block a user