Skip to content

Commit 4d0678a

Browse files
committed
feat: Add parent_span_id to outgoing logs
1 parent 0e77407 commit 4d0678a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/core/src/log.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { ParameterizedString } from './types-hoist';
77
import type { DynamicSamplingContext, LogEnvelope, LogItem } from './types-hoist/envelope';
88
import type { Log, LogAttribute, LogSeverityLevel } from './types-hoist/log';
99
import { createEnvelope, dropUndefinedKeys, dsnToString, isParameterizedString, logger } from './utils-hoist';
10+
import { getActiveSpan, spanToJSON } from './utils/spanUtils';
1011

1112
const LOG_BUFFER_MAX_LENGTH = 25;
1213

@@ -161,6 +162,11 @@ export function captureLog({
161162
}
162163
}
163164

165+
const span = getActiveSpan();
166+
if (span) {
167+
logAttributes['sentry.trace.parent_span_id'] = spanToJSON(span).parent_span_id;
168+
}
169+
164170
if (release) {
165171
logAttributes['sentry.release'] = release;
166172
}

0 commit comments

Comments
 (0)