Skip to content

Commit 0d7323c

Browse files
committed
We changed envelope to 'trace_metric' to avoid ambiguity
1 parent 8e12b0d commit 0d7323c

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

dev-packages/browser-integration-tests/suites/public-api/metrics/simple/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ sentryTest('should capture all metric types', async ({ getLocalTestUrl, page })
1616

1717
expect(envelopeItems[0]).toEqual([
1818
{
19-
type: 'metric',
19+
type: 'trace_metric',
2020
item_count: 5,
2121
content_type: 'application/vnd.sentry.items.trace-metric+json',
2222
},

packages/core/src/metrics/envelope.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { createEnvelope } from '../utils/envelope';
1414
export function createMetricContainerEnvelopeItem(items: Array<SerializedMetric>): MetricContainerItem {
1515
return [
1616
{
17-
type: 'metric',
17+
type: 'trace_metric',
1818
item_count: items.length,
1919
content_type: 'application/vnd.sentry.items.trace-metric+json',
2020
} as MetricContainerItem[0],

packages/core/src/types-hoist/envelope.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export type EnvelopeItemType =
4848
| 'span'
4949
| 'log'
5050
| 'metric'
51+
| 'trace_metric'
5152
| 'raw_security';
5253

5354
export type BaseEnvelopeHeaders = {
@@ -102,14 +103,8 @@ type LogContainerItemHeaders = {
102103
content_type: 'application/vnd.sentry.items.log+json';
103104
};
104105
type MetricContainerItemHeaders = {
105-
type: 'metric';
106-
/**
107-
* The number of metric items in the container. This must be the same as the number of metric items in the payload.
108-
*/
106+
type: 'trace_metric';
109107
item_count: number;
110-
/**
111-
* The content type of the metric items. This must be `application/vnd.sentry.items.trace-metric+json`.
112-
*/
113108
content_type: 'application/vnd.sentry.items.trace-metric+json';
114109
};
115110
type RawSecurityHeaders = { type: 'raw_security'; sentry_release?: string; sentry_environment?: string };

packages/core/src/utils/envelope.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ const ITEM_TYPE_TO_DATA_CATEGORY_MAP: Record<EnvelopeItemType, DataCategory> = {
222222
raw_security: 'security',
223223
log: 'log_item',
224224
metric: 'metric',
225+
trace_metric: 'metric',
225226
};
226227

227228
/**

packages/core/test/lib/metrics/envelope.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('createMetricContainerEnvelopeItem', () => {
3030

3131
expect(result).toHaveLength(2);
3232
expect(result[0]).toEqual({
33-
type: 'metric',
33+
type: 'trace_metric',
3434
item_count: 2,
3535
content_type: 'application/vnd.sentry.items.trace-metric+json',
3636
});

0 commit comments

Comments
 (0)