Skip to content

Commit 5479b8f

Browse files
committed
add transaction pointer to both span type and span class
1 parent 89669cb commit 5479b8f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

packages/tracing/src/span.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Span as SpanInterface, SpanContext } from '@sentry/types';
33
import { dropUndefinedKeys, timestampWithMs, uuid4 } from '@sentry/utils';
44

55
import { SpanStatus } from './spanstatus';
6+
import { Transaction } from './transaction';
67

78
/**
89
* Keeps track of finished spans for a given transaction
@@ -99,6 +100,11 @@ export class Span implements SpanInterface, SpanContext {
99100
*/
100101
public spanRecorder?: SpanRecorder;
101102

103+
/**
104+
* @inheritDoc
105+
*/
106+
public transaction?: Transaction;
107+
102108
/**
103109
* You should never call the constructor manually, always use `hub.startSpan()`.
104110
* @internal

packages/types/src/span.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Transaction } from './transaction';
2+
13
/** Interface holding all properties that can be set on a Span on creation. */
24
export interface SpanContext {
35
/**
@@ -84,6 +86,11 @@ export interface Span extends SpanContext {
8486
*/
8587
data: { [key: string]: any };
8688

89+
/**
90+
* The transaction containing this span
91+
*/
92+
transaction?: Transaction;
93+
8794
/**
8895
* Sets the finish timestamp on the current span.
8996
* @param endTimestamp Takes an endTimestamp if the end should not be the time when you call this function.

0 commit comments

Comments
 (0)