-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(apm) Expose transaction start & end timestamp #14007
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
Conversation
| # timestamp floats. | ||
| if obj.get_event_type() == 'transaction': | ||
| d['startTimestamp'] = obj.data.get('start_timestamp') | ||
| d['timestamp'] = obj.data.get('timestamp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this ends up being the same as obj.datetime and the field dateCreated that is populated at line 272. Is there a reason to add a new one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dateCreated field is a string and lacks the ms precision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then, since this is going to be there only for transacitons, I would advise to rename the two fields in such a way that make it clear what they mean like:
startTimestamp
endTimestamp
So people would not have to look into the code to understand what timestamp means in the context of the transaction.
|
Is it possible to have a dedicated transaction object? Something like |
|
@dashed I'm reluctant to overload |
|
@markstory Yea the I feel like attributes |
913a769 to
61522bd
Compare
|
I've moved the start & end timestamps into the With timestamps in the metadata, the generated |
|
I don't think we want the message to be like that 😬 |
|
@dashed I've done some refactoring in EventManager to move the message generation into the event types. This change will prevent the timestamps from being indexed in the message. @fpacifici Do you think the timestamp names need to change if they are located in |
61522bd to
e1e8cb6
Compare
|
This looks pretty good to me. 👏 I'll leave the implementation details to @fpacifici since I don't have strong opinions on that front. |
meh .... ok. If we are end up being inconsistent either way feel free to ignore my comment. |
|
|
||
| data = CanonicalKeyDict(data) | ||
| if platform in ('csp', 'hkpk', 'expectct', 'expectstaple'): | ||
| if platform in ('transaction', 'csp', 'hkpk', 'expectct', 'expectstaple'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed ? It was not here in the previous version if I remember correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this the sample transaction event gets data added to the extra, modules and request interfaces which are generally not going to be present on a transaction event payload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but "transaction" should not be a platform. By doing this we are overloading the meaning and behavior of a parameter. Also you are skipping line 145 where the "platform" field is added to data. Is this intentional.
If you need a different behavior for different event types, I would suggest to pass the event type as an optional parameter, or, better pass a parameter that tells which interfaces to pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name platform is an awkward name as it is used to locate a sample/fixture file in src/sentry/data/samples. The files there are a mixture of both sample SDK events and special scenarios like empty-exception or python-omittedbody.
On transaction events expose both the start and end timestamps. This will allow us to correctly display the transaction span length. Refs SEN-799
Move logic to serialize transaction only events into a separate method. This also allows error/default only logic to be moved as well. I've elected to not emit `dateCreated` on transaction events as it is redundant given the start/end timestamps.
eb1cb2f to
0c40d72
Compare
|
I've removed the I've gone back to exposing timestamps on the root level of the event and using I've also shifted some of the properties that will only appear on error events around so that those keys are never populated on transaction events. |
dashed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. 👍
I'll let either @fpacifici or Vienna give their feedback (cc @jan-auer )
| 'metadata': obj.get_event_metadata(), | ||
| 'tags': tags, | ||
| 'platform': obj.platform, | ||
| 'dateCreated': obj.datetime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed a few dependencies on dateCreated
src/sentry/static/sentry/app/views/organizationEventsV2/eventModalContent.jsx: date={getDynamicText({value: event.dateCreated, fixed: 'Dummy timestamp'})}
src/sentry/static/sentry/app/views/organizationEventsV2/modalLineGraph.jsx: const eventTime = +new Date(currentEvent.dateCreated);
src/sentry/static/sentry/app/views/organizationGroupDetails/eventToolbar.jsx: const dateCreated = moment(evt.dateCreated);
Are these going to be ok if you remove the field? I suspect there is no acceptance test that go through transaction event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good finds. The modal graph and content component do need to be updated. The GroupDetailsToolbar should be fine as transaction events won't have groups.
|
I am ok with this now. @dashed you may want to have a look at the UI change. |
On transaction events expose both the start and end timestamps. This will allow us to correctly display the transaction span length.
I've also added the transaction sample from my now closed tracing pull request. Having a sample transaction event should be useful when we have to do more endpoint and acceptance tests around transaction events.
Refs SEN-799