Skip to content

feat(types): add profile envelope item type #6468

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
Dec 9, 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
4 changes: 3 additions & 1 deletion packages/types/src/datacategory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ export type DataCategory =
// Session update events
| 'session'
// SDK internal event, like client_reports
| 'internal';
| 'internal'
// Profile event type
| 'profile';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this change is breaking in a very unfortunate way. We use the DataCategory type as a callback argument in a hook that can be configured by the users:

recordDroppedEvent(reason: EventDropReason, dataCategory: DataCategory, event?: Event): void;

We essentially have two options:

  • Disregard this fact under the assumption that it won't matter for many people.
  • Add logic that prevents 'profile' from being passed to this hook.

I am fine with both.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disregard this fact under the assumption that it won't matter for many people

I'm in favor of this, recordDroppedEvent is not going to be used by the 99.9% of folks, we can add a note to the changelog about it.

Copy link
Member Author

@JonasBa JonasBa Dec 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lforst yeah, I figured. As it stands today with the profiling SDK implementation, I dont think recordDroppedEvent will even be called for profiles (we just early return if sampling rate is lower than random). I think for now this is fine, but as we integrate more tightly with the SDK, we can fix this and actually pass a profile to the recordDroppedEvent if necessary

5 changes: 3 additions & 2 deletions packages/types/src/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export type EnvelopeItemType =
| 'sessions'
| 'transaction'
| 'attachment'
| 'event';
| 'event'
| 'profile';

export type BaseEnvelopeHeaders = {
[key: string]: unknown;
Expand All @@ -48,7 +49,7 @@ type BaseEnvelope<EnvelopeHeader, Item> = [
];

type EventItemHeaders = {
type: 'event' | 'transaction';
type: 'event' | 'transaction' | 'profile';
};
type AttachmentItemHeaders = {
type: 'attachment';
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface Event {
}

/** JSDoc */
export type EventType = 'transaction';
export type EventType = 'transaction' | 'profile';

/** JSDoc */
export interface EventHint {
Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const ITEM_TYPE_TO_DATA_CATEGORY_MAP: Record<EnvelopeItemType, DataCategory> = {
event: 'error',
client_report: 'internal',
user_report: 'default',
profile: 'profile',
};

/**
Expand Down