Skip to content

Commit c599009

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

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/tracing/src/span.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable max-lines */
2-
import { Span as SpanInterface, SpanContext } from '@sentry/types';
2+
import { Span as SpanInterface, SpanContext, Transaction } from '@sentry/types';
33
import { dropUndefinedKeys, timestampWithMs, uuid4 } from '@sentry/utils';
44

55
import { SpanStatus } from './spanstatus';
@@ -99,6 +99,11 @@ export class Span implements SpanInterface, SpanContext {
9999
*/
100100
public spanRecorder?: SpanRecorder;
101101

102+
/**
103+
* @inheritDoc
104+
*/
105+
public transaction?: Transaction;
106+
102107
/**
103108
* You should never call the constructor manually, always use `hub.startSpan()`.
104109
* @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)