Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Conversation

@AbhiPrasad
Copy link
Member

The span.finish() and transaction.finish() methods can be given an optional endTimestamp value that allows for users to override the endTimestamp of a span/transaction. This is currently implemented in the JavaScript SDK

https://github.com/getsentry/sentry-javascript/blob/bb6f86502e1ea551fa503136a954844f77cca322/packages/tracing/src/span.ts#L232-L234

This PR updates the develop documentation to reflect this capability.

The `span.finish()` and `transaction.finish()` methods can be given an optional `endTimestamp` value that allows for users to override the endTimestamp of a span/transaction. This is currently implemented in the JavaScript SDK

https://github.com/getsentry/sentry-javascript/blob/bb6f86502e1ea551fa503136a954844f77cca322/packages/tracing/src/span.ts#L232-L234

This PR updates the develop documentation to reflect this capability.
@vercel
Copy link

vercel bot commented Feb 24, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sentry/develop/Cdj3FjmTNxMx4iseHnkmLvka1guD
✅ Preview: https://develop-git-abhi-span-endtimestamp.sentry.dev

- `Span.finish()`

- Just set `endTimestamp` to the current time (in payload `timestamp`)
- Accepts an optional `endTimestamp` to allow users to set a custom `endTimestamp` on the finished span
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any sort of validation? e.g. if the given endTimestamp if before the startTimestamp and if so, should it log an error or what?
Asking that because of getsentry/sentry-dart#676

Copy link
Member Author

Choose a reason for hiding this comment

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

At the current moment there is no validation in JS or Python. We can think about adding this though? Should we add to the spec?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally yes, our PR logs that the endTimestamp is before the startTimestamp and sets the current timestamp.
If this sounds like a good approach, we could document to the spec.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we should ask around. Think logging is a good idea, but not sure about setting current timestamp if there is an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is in TSC already, we can make another PR if that's the case, so we unblock this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants