Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(cloudflare): Add debug line | use SpanLink type from core
  • Loading branch information
JPeer264 committed Apr 13, 2026
commit 88f6fc2ad10ab243ac2263fa84923fc332bf3d08
17 changes: 5 additions & 12 deletions packages/cloudflare/src/utils/traceLinks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { DurableObjectStorage } from '@cloudflare/workers-types';
import { TraceFlags } from '@opentelemetry/api';
import { getActiveSpan } from '@sentry/core';
import type { SpanLink } from '@sentry/core';
import { debug, getActiveSpan } from '@sentry/core';
import { DEBUG_BUILD } from '../debug-build';

/** Storage key prefix for the span context that links consecutive method invocations */
const SENTRY_TRACE_LINK_KEY_PREFIX = '__SENTRY_TRACE_LINK__';
Expand All @@ -12,16 +14,6 @@ export interface StoredSpanContext {
sampled: boolean;
}

/** Span link structure for connecting traces */
export interface SpanLink {
context: {
traceId: string;
spanId: string;
traceFlags: number;
};
attributes?: Record<string, string>;
}

/**
* Gets the storage key for a specific method's trace link.
*/
Expand All @@ -46,8 +38,9 @@ export async function storeSpanContext(originalStorage: DurableObjectStorage, me
};
await originalStorage.put(getTraceLinkKey(methodName), storedContext);
}
} catch {
} catch (error) {
// Silently ignore storage errors to prevent internal failures from affecting user code
Comment thread
JPeer264 marked this conversation as resolved.
DEBUG_BUILD && debug.log(`[CloudflareClient] Error storing span context for method ${methodName}`, error);
}
}
Comment thread
cursor[bot] marked this conversation as resolved.

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ export type {
} from './types-hoist/span';
export type { SpanStatus } from './types-hoist/spanStatus';
export type { Log, LogSeverityLevel } from './types-hoist/log';
export type { SpanLink } from './types-hoist/link';
export type {
Metric,
MetricType,
Expand Down