Skip to content

fix(tracing): Update warm/cold start span ops #2487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Update warm/cold start span ops ([#2487](https://github.com/getsentry/sentry-react-native/pull/2487))

## 4.4.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion src/js/tracing/reactnativetracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export class ReactNativeTracing implements Integration {

const appStartTimeSeconds = appStart.appStartTime / 1000;

const appStartMode = appStart.isColdStart ? 'app_start_cold' : 'app_start_warm';
const appStartMode = appStart.isColdStart ? 'app.start.cold' : 'app.start.warm';
transaction.startChild({
description: appStart.isColdStart ? 'Cold App Start' : 'Warm App Start',
op: appStartMode,
Expand Down
20 changes: 10 additions & 10 deletions test/tracing/reactnativetracing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ describe('ReactNativeTracing', () => {

expect(
// @ts-ignore access private for test
transaction._measurements?.app_start_cold?.value
transaction._measurements['app.start.cold'].value
).toEqual(timeOriginMilliseconds - appStartTimeMilliseconds);
expect(
// @ts-ignore access private for test
transaction._measurements?.app_start_cold?.unit).toBe('millisecond');
transaction._measurements['app.start.cold'].unit).toBe('millisecond');

done();
}
Expand Down Expand Up @@ -162,11 +162,11 @@ describe('ReactNativeTracing', () => {

expect(
// @ts-ignore access private for test
transaction._measurements?.app_start_warm?.value
transaction._measurements['app.start.warm'].value
).toEqual(timeOriginMilliseconds - appStartTimeMilliseconds);
expect(
// @ts-ignore access private for test
transaction._measurements?.app_start_warm?.unit).toBe('millisecond');
transaction._measurements['app.start.warm'].unit).toBe('millisecond');

done();
}
Expand Down Expand Up @@ -206,12 +206,12 @@ describe('ReactNativeTracing', () => {
if (transaction) {
expect(
// @ts-ignore access private for test
transaction._measurements?.app_start_warm
transaction._measurements['app.start.warm']
).toBeUndefined();

expect(
// @ts-ignore access private for test
transaction._measurements?.app_start_cold
transaction._measurements['app.start.cold']
).toBeUndefined();

done();
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('ReactNativeTracing', () => {
jest.runOnlyPendingTimers();

// @ts-ignore access private for test
expect(routeTransaction._measurements?.app_start_cold?.value).toBe(
expect(routeTransaction._measurements['app.start.cold'].value).toBe(
timeOriginMilliseconds - appStartTimeMilliseconds
);

Expand All @@ -314,7 +314,7 @@ describe('ReactNativeTracing', () => {

const span = spanRecorder.spans[spanRecorder.spans.length - 1];

expect(span.op).toBe('app_start_cold');
expect(span.op).toBe('app.start.cold');
expect(span.description).toBe('Cold App Start');
expect(span.startTimestamp).toBe(appStartTimeMilliseconds / 1000);
expect(span.endTimestamp).toBe(timeOriginMilliseconds / 1000);
Expand Down Expand Up @@ -368,7 +368,7 @@ describe('ReactNativeTracing', () => {
jest.runOnlyPendingTimers();

// @ts-ignore access private for test
expect(routeTransaction._measurements?.app_start_warm?.value).toBe(
expect(routeTransaction._measurements['app.start.warm'].value).toBe(
timeOriginMilliseconds - appStartTimeMilliseconds
);

Expand All @@ -384,7 +384,7 @@ describe('ReactNativeTracing', () => {

const span = spanRecorder.spans[spanRecorder.spans.length - 1];

expect(span.op).toBe('app_start_warm');
expect(span.op).toBe('app.start.warm');
expect(span.description).toBe('Warm App Start');
expect(span.startTimestamp).toBe(appStartTimeMilliseconds / 1000);
expect(span.endTimestamp).toBe(timeOriginMilliseconds / 1000);
Expand Down