1
1
import type {
2
2
Context ,
3
3
Contexts ,
4
- DynamicSamplingContext ,
5
4
Hub ,
6
5
MeasurementUnit ,
7
6
Measurements ,
@@ -10,15 +9,14 @@ import type {
10
9
Transaction as TransactionInterface ,
11
10
TransactionArguments ,
12
11
TransactionEvent ,
13
- TransactionMetadata ,
14
12
TransactionSource ,
15
13
} from '@sentry/types' ;
16
14
import { dropUndefinedKeys , logger } from '@sentry/utils' ;
17
15
18
16
import { DEBUG_BUILD } from '../debug-build' ;
19
17
import { getCurrentHub } from '../hub' ;
20
18
import { getMetricSummaryJsonForSpan } from '../metrics/metric-summary' ;
21
- import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE , SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '../semanticAttributes' ;
19
+ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '../semanticAttributes' ;
22
20
import { getSpanDescendants , spanTimeInputToSeconds , spanToJSON , spanToTraceContext } from '../utils/spanUtils' ;
23
21
import { getDynamicSamplingContextFromSpan } from './dynamicSamplingContext' ;
24
22
import { SentrySpan } from './sentrySpan' ;
@@ -39,11 +37,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
39
37
40
38
private _trimEnd ?: boolean | undefined ;
41
39
42
- // DO NOT yet remove this property, it is used in a hack for v7 backwards compatibility.
43
- private _frozenDynamicSamplingContext : Readonly < Partial < DynamicSamplingContext > > | undefined ;
44
-
45
- private _metadata : Partial < TransactionMetadata > ;
46
-
47
40
/**
48
41
* This constructor should never be called manually.
49
42
* @internal
@@ -62,11 +55,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
62
55
63
56
this . _name = transactionContext . name || '' ;
64
57
65
- this . _metadata = {
66
- // eslint-disable-next-line deprecation/deprecation
67
- ...transactionContext . metadata ,
68
- } ;
69
-
70
58
this . _trimEnd = transactionContext . trimEnd ;
71
59
72
60
this . _attributes = {
@@ -78,45 +66,8 @@ export class Transaction extends SentrySpan implements TransactionInterface {
78
66
// TODO (v8): Replace this with another way to set the root span
79
67
// eslint-disable-next-line deprecation/deprecation
80
68
this . transaction = this ;
81
-
82
- // If Dynamic Sampling Context is provided during the creation of the transaction, we freeze it as it usually means
83
- // there is incoming Dynamic Sampling Context. (Either through an incoming request, a baggage meta-tag, or other means)
84
- const incomingDynamicSamplingContext = this . _metadata . dynamicSamplingContext ;
85
- if ( incomingDynamicSamplingContext ) {
86
- // We shallow copy this in case anything writes to the original reference of the passed in `dynamicSamplingContext`
87
- this . _frozenDynamicSamplingContext = { ...incomingDynamicSamplingContext } ;
88
- }
89
- }
90
-
91
- // This sadly conflicts with the getter/setter ordering :(
92
-
93
- /**
94
- * Get the metadata for this transaction.
95
- * @deprecated Use `spanGetMetadata(transaction)` instead.
96
- */
97
- public get metadata ( ) : TransactionMetadata {
98
- // We merge attributes in for backwards compatibility
99
- return {
100
- // Legacy metadata
101
- ...this . _metadata ,
102
-
103
- // From attributes
104
- ...( this . _attributes [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] && {
105
- sampleRate : this . _attributes [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] as TransactionMetadata [ 'sampleRate' ] ,
106
- } ) ,
107
- } ;
108
- }
109
-
110
- /**
111
- * Update the metadata for this transaction.
112
- * @deprecated Use `spanGetMetadata(transaction)` instead.
113
- */
114
- public set metadata ( metadata : TransactionMetadata ) {
115
- this . _metadata = metadata ;
116
69
}
117
70
118
- /* eslint-enable @typescript-eslint/member-ordering */
119
-
120
71
/** @inheritdoc */
121
72
public updateName ( name : string ) : this {
122
73
this . _name = name ;
@@ -146,14 +97,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
146
97
this . _measurements [ name ] = { value, unit } ;
147
98
}
148
99
149
- /**
150
- * Store metadata on this transaction.
151
- * @deprecated Use attributes or store data on the scope instead.
152
- */
153
- public setMetadata ( newMetadata : Partial < TransactionMetadata > ) : void {
154
- this . _metadata = { ...this . _metadata , ...newMetadata } ;
155
- }
156
-
157
100
/**
158
101
* @inheritDoc
159
102
*/
@@ -181,17 +124,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
181
124
} ) ;
182
125
}
183
126
184
- /**
185
- * @inheritdoc
186
- *
187
- * @experimental
188
- *
189
- * @deprecated Use top-level `getDynamicSamplingContextFromSpan` instead.
190
- */
191
- public getDynamicSamplingContext ( ) : Readonly < Partial < DynamicSamplingContext > > {
192
- return getDynamicSamplingContextFromSpan ( this ) ;
193
- }
194
-
195
127
/**
196
128
* Override the current hub with a new one.
197
129
* Used if you want another hub to finish the transaction.
@@ -252,9 +184,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
252
184
253
185
const { scope : capturedSpanScope , isolationScope : capturedSpanIsolationScope } = getCapturedScopesOnSpan ( this ) ;
254
186
255
- // eslint-disable-next-line deprecation/deprecation
256
- const { metadata } = this ;
257
-
258
187
const source = this . _attributes [ 'sentry.source' ] as TransactionSource | undefined ;
259
188
260
189
const transaction : TransactionEvent = {
@@ -269,7 +198,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
269
198
transaction : this . _name ,
270
199
type : 'transaction' ,
271
200
sdkProcessingMetadata : {
272
- ...metadata ,
273
201
capturedSpanScope,
274
202
capturedSpanIsolationScope,
275
203
...dropUndefinedKeys ( {
0 commit comments