From 538035c452bfbc042961b199c0f44e733c88bfab Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Wed, 4 Feb 2026 13:45:32 +0000 Subject: feat: add extra instrumentation in the otel traces (#2453) --- packages/shared-server/src/tracing.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'packages/shared-server/src/tracing.ts') 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( spanName: string, options: { kind?: SpanKind; - attributes?: Record; + attributes?: TracingAttributes; }, fn: (span: Span) => Promise, ): Promise { @@ -168,7 +172,7 @@ export function withSpanSync( spanName: string, options: { kind?: SpanKind; - attributes?: Record; + 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, -): void { +export function setSpanAttributes(attributes: TracingAttributes): void { const span = getActiveSpan(); if (span) { span.setAttributes(attributes); -- cgit v1.2.3-70-g09d2