diff options
| author | Mohamed Bassem <me@mbassem.com> | 2026-02-04 13:45:32 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-04 13:45:32 +0000 |
| commit | 538035c452bfbc042961b199c0f44e733c88bfab (patch) | |
| tree | b401a004a0ca3103264261170602fbf2822df14e /packages/shared-server/src/tracing.ts | |
| parent | 93ad2e2001eb7070df50b0ab51dfd3e1ab377629 (diff) | |
| download | karakeep-538035c452bfbc042961b199c0f44e733c88bfab.tar.zst | |
feat: add extra instrumentation in the otel traces (#2453)
Diffstat (limited to 'packages/shared-server/src/tracing.ts')
| -rw-r--r-- | packages/shared-server/src/tracing.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/shared-server/src/tracing.ts b/packages/shared-server/src/tracing.ts index e831e019..10222f88 100644 --- a/packages/shared-server/src/tracing.ts +++ b/packages/shared-server/src/tracing.ts @@ -24,6 +24,10 @@ import { import serverConfig from "@karakeep/shared/config"; import logger from "@karakeep/shared/logger"; +import type { TracingAttributes } from "./tracingTypes"; + +export type { TracingAttributeKey, TracingAttributes } from "./tracingTypes"; + let tracerProvider: NodeTracerProvider | null = null; let isInitialized = false; @@ -129,7 +133,7 @@ export async function withSpan<T>( spanName: string, options: { kind?: SpanKind; - attributes?: Record<string, string | number | boolean>; + attributes?: TracingAttributes; }, fn: (span: Span) => Promise<T>, ): Promise<T> { @@ -168,7 +172,7 @@ export function withSpanSync<T>( spanName: string, options: { kind?: SpanKind; - attributes?: Record<string, string | number | boolean>; + attributes?: TracingAttributes; }, fn: (span: Span) => T, ): T { @@ -213,9 +217,7 @@ export function addSpanEvent( /** * Set attributes on the current active span. */ -export function setSpanAttributes( - attributes: Record<string, string | number | boolean>, -): void { +export function setSpanAttributes(attributes: TracingAttributes): void { const span = getActiveSpan(); if (span) { span.setAttributes(attributes); |
