11import  type  { 
22  Contexts , 
3-   DynamicSamplingContext , 
43  Hub , 
54  MeasurementUnit , 
65  Measurements , 
@@ -9,15 +8,14 @@ import type {
98  Transaction  as  TransactionInterface , 
109  TransactionArguments , 
1110  TransactionEvent , 
12-   TransactionMetadata , 
1311  TransactionSource , 
1412}  from  '@sentry/types' ; 
1513import  {  dropUndefinedKeys ,  logger  }  from  '@sentry/utils' ; 
1614
1715import  {  DEBUG_BUILD  }  from  '../debug-build' ; 
1816import  {  getCurrentHub  }  from  '../hub' ; 
1917import  {  getMetricSummaryJsonForSpan  }  from  '../metrics/metric-summary' ; 
20- import  {  SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ,   SEMANTIC_ATTRIBUTE_SENTRY_SOURCE  }  from  '../semanticAttributes' ; 
18+ import  {  SEMANTIC_ATTRIBUTE_SENTRY_SOURCE  }  from  '../semanticAttributes' ; 
2119import  {  getSpanDescendants ,  spanTimeInputToSeconds ,  spanToJSON ,  spanToTraceContext  }  from  '../utils/spanUtils' ; 
2220import  {  getDynamicSamplingContextFromSpan  }  from  './dynamicSamplingContext' ; 
2321import  {  SentrySpan  }  from  './sentrySpan' ; 
@@ -38,11 +36,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
3836
3937  private  _trimEnd ?: boolean  |  undefined ; 
4038
41-   // DO NOT yet remove this property, it is used in a hack for v7 backwards compatibility. 
42-   private  _frozenDynamicSamplingContext : Readonly < Partial < DynamicSamplingContext > >  |  undefined ; 
43- 
44-   private  _metadata : Partial < TransactionMetadata > ; 
45- 
4639  /** 
4740   * This constructor should never be called manually. 
4841   * @internal  
@@ -61,56 +54,14 @@ export class Transaction extends SentrySpan implements TransactionInterface {
6154
6255    this . _name  =  transactionContext . name  ||  '' ; 
6356
64-     this . _metadata  =  { 
65-       // eslint-disable-next-line deprecation/deprecation 
66-       ...transactionContext . metadata , 
67-     } ; 
68- 
6957    this . _trimEnd  =  transactionContext . trimEnd ; 
7058
7159    this . _attributes  =  { 
7260      [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'custom' , 
7361      ...this . _attributes , 
7462    } ; 
75- 
76-     // If Dynamic Sampling Context is provided during the creation of the transaction, we freeze it as it usually means 
77-     // there is incoming Dynamic Sampling Context. (Either through an incoming request, a baggage meta-tag, or other means) 
78-     const  incomingDynamicSamplingContext  =  this . _metadata . dynamicSamplingContext ; 
79-     if  ( incomingDynamicSamplingContext )  { 
80-       // We shallow copy this in case anything writes to the original reference of the passed in `dynamicSamplingContext` 
81-       this . _frozenDynamicSamplingContext  =  {  ...incomingDynamicSamplingContext  } ; 
82-     } 
8363  } 
8464
85-   // This sadly conflicts with the getter/setter ordering :( 
86- 
87-   /** 
88-    * Get the metadata for this transaction. 
89-    * @deprecated  Use `spanGetMetadata(transaction)` instead. 
90-    */ 
91-   public  get  metadata ( ) : TransactionMetadata  { 
92-     // We merge attributes in for backwards compatibility 
93-     return  { 
94-       // Legacy metadata 
95-       ...this . _metadata , 
96- 
97-       // From attributes 
98-       ...( this . _attributes [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ]  &&  { 
99-         sampleRate : this . _attributes [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ]  as  TransactionMetadata [ 'sampleRate' ] , 
100-       } ) , 
101-     } ; 
102-   } 
103- 
104-   /** 
105-    * Update the metadata for this transaction. 
106-    * @deprecated  Use `spanGetMetadata(transaction)` instead. 
107-    */ 
108-   public  set  metadata ( metadata : TransactionMetadata )  { 
109-     this . _metadata  =  metadata ; 
110-   } 
111- 
112-   /* eslint-enable @typescript-eslint/member-ordering */ 
113- 
11465  /** @inheritdoc  */ 
11566  public  updateName ( name : string ) : this { 
11667    this . _name  =  name ; 
@@ -127,14 +78,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
12778    this . _measurements [ name ]  =  {  value,  unit } ; 
12879  } 
12980
130-   /** 
131-    * Store metadata on this transaction. 
132-    * @deprecated  Use attributes or store data on the scope instead. 
133-    */ 
134-   public  setMetadata ( newMetadata : Partial < TransactionMetadata > ) : void { 
135-     this . _metadata  =  {  ...this . _metadata ,  ...newMetadata  } ; 
136-   } 
137- 
13881  /** 
13982   * @inheritDoc  
14083   */ 
@@ -148,6 +91,30 @@ export class Transaction extends SentrySpan implements TransactionInterface {
14891    return  this . _hub . captureEvent ( transaction ) ; 
14992  } 
15093
94+   /** 
95+    * @inheritDoc  
96+    */ 
97+   public  toContext ( ) : TransactionArguments  { 
98+     // eslint-disable-next-line deprecation/deprecation 
99+     const  spanContext  =  super . toContext ( ) ; 
100+ 
101+     return  dropUndefinedKeys ( { 
102+       ...spanContext , 
103+       name : this . _name , 
104+       trimEnd : this . _trimEnd , 
105+     } ) ; 
106+   } 
107+ 
108+   /** 
109+    * Override the current hub with a new one. 
110+    * Used if you want another hub to finish the transaction. 
111+    * 
112+    * @internal  
113+    */ 
114+   public  setHub ( hub : Hub ) : void { 
115+     this . _hub  =  hub ; 
116+   } 
117+ 
151118  /** 
152119   * Finish the transaction & prepare the event to send to Sentry. 
153120   */ 
@@ -198,9 +165,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
198165
199166    const  {  scope : capturedSpanScope ,  isolationScope : capturedSpanIsolationScope  }  =  getCapturedScopesOnSpan ( this ) ; 
200167
201-     // eslint-disable-next-line deprecation/deprecation 
202-     const  {  metadata }  =  this ; 
203- 
204168    const  source  =  this . _attributes [ 'sentry.source' ]  as  TransactionSource  |  undefined ; 
205169
206170    const  transaction : TransactionEvent  =  { 
@@ -215,7 +179,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
215179      transaction : this . _name , 
216180      type : 'transaction' , 
217181      sdkProcessingMetadata : { 
218-         ...metadata , 
219182        capturedSpanScope, 
220183        capturedSpanIsolationScope, 
221184        ...dropUndefinedKeys ( { 
0 commit comments