Skip to content

Commit 3eff09f

Browse files
measurements in span
1 parent 0592b2b commit 3eff09f

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

packages/core/src/semanticAttributes.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,3 @@ export const SEMANTIC_ATTRIBUTE_SENTRY_OP = 'sentry.op';
1919
* Use this attribute to represent the origin of a span.
2020
*/
2121
export const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = 'sentry.origin';
22-
23-
/**
24-
* Use this attribute to represent measurements of a span.
25-
*/
26-
export const SEMANTIC_ATTRIBUTE_MEASUREMENTS = 'measurements';

packages/core/src/tracing/span.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ import { dropUndefinedKeys, logger, timestampInSeconds, uuid4 } from '@sentry/ut
1818

1919
import { DEBUG_BUILD } from '../debug-build';
2020
import { getMetricSummaryJsonForSpan } from '../metrics/metric-summary';
21-
import {
22-
SEMANTIC_ATTRIBUTE_MEASUREMENTS,
23-
SEMANTIC_ATTRIBUTE_SENTRY_OP,
24-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
25-
} from '../semanticAttributes';
21+
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes';
2622
import { getRootSpan } from '../utils/getRootSpan';
2723
import {
2824
TRACE_FLAG_NONE,
@@ -122,6 +118,8 @@ export class Span implements SpanInterface {
122118
protected _status?: SpanStatusType | string | undefined;
123119
protected _exclusiveTime?: number;
124120

121+
protected _measurements: Measurements;
122+
125123
private _logMessage?: string;
126124

127125
/**
@@ -168,6 +166,7 @@ export class Span implements SpanInterface {
168166
if (spanContext.exclusiveTime) {
169167
this._exclusiveTime = spanContext.exclusiveTime;
170168
}
169+
this._measurements = spanContext.measurements ? { ...spanContext.measurements } : {};
171170
}
172171

173172
// This rule conflicts with another eslint rule :(
@@ -636,7 +635,7 @@ export class Span implements SpanInterface {
636635
origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined,
637636
_metrics_summary: getMetricSummaryJsonForSpan(this),
638637
exclusive_time: this._exclusiveTime,
639-
measurements: this._attributes[SEMANTIC_ATTRIBUTE_MEASUREMENTS] as Measurements | undefined,
638+
measurements: Object.keys(this._measurements).length > 0 ? this._measurements : undefined,
640639
});
641640
}
642641

packages/core/src/tracing/transaction.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type {
33
Contexts,
44
DynamicSamplingContext,
55
MeasurementUnit,
6-
Measurements,
76
SpanTimeInput,
87
Transaction as TransactionInterface,
98
TransactionContext,
@@ -31,8 +30,6 @@ export class Transaction extends SpanClass implements TransactionInterface {
3130

3231
protected _name: string;
3332

34-
private _measurements: Measurements;
35-
3633
private _contexts: Contexts;
3734

3835
private _trimEnd?: boolean | undefined;
@@ -53,7 +50,6 @@ export class Transaction extends SpanClass implements TransactionInterface {
5350
*/
5451
public constructor(transactionContext: TransactionContext, hub?: Hub) {
5552
super(transactionContext);
56-
this._measurements = {};
5753
this._contexts = {};
5854

5955
// eslint-disable-next-line deprecation/deprecation

packages/types/src/span.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ export interface SpanContext {
186186
* Exclusive time in milliseconds.
187187
*/
188188
exclusiveTime?: number;
189+
190+
/**
191+
* Measurements of the Span.
192+
*/
193+
measurements?: Measurements;
189194
}
190195

191196
/** Span holding trace_id, span_id */

0 commit comments

Comments
 (0)