Skip to content
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

docs: Add docs for new performance APIs #10017

Merged
merged 3 commits into from
Jan 4, 2024
Merged

Conversation

mydea
Copy link
Member

@mydea mydea commented Jan 2, 2024

This is a WIP document about the new performance APIs. I'm sure I forgot a bunch of things, but it's a start at least...!

View rendered

@mydea mydea self-assigned this Jan 2, 2024
@mydea mydea removed the request for review from Abdkhan14 January 2, 2024 16:05
| `parentSpanId` | Same |
| `status` | TODO: new signature |
| `sampled` | `spanContext().traceFlags` |
| `startTimestamp` | `startTime` - note that this has a different format! |
Copy link
Member Author

Choose a reason for hiding this comment

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

This will be sad, because this is not nice in OTEL, but I guess we have to do it 😬 they use a different format for timestamps :(

Copy link
Member

Choose a reason for hiding this comment

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

l: Can we add either a link explaining the new format or a 1-liner explaining the difference?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, will do that!

| `end()` | Same |
| `setTag()` | `setAttribute()` |
| `setData()` | `setAttribute()` |
| `setStatus()` | TODO: new signature |
Copy link
Member

Choose a reason for hiding this comment

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

we need a long term strategy for status, might be notable to write about in it's own section.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I'll go through all the "??" sections here tomorrow a bit 😓

| `startChild()` | Call `Sentry.startSpan()` independently |
| `isSuccess()` | ??? |
| `toTraceparent()` | ??? |
| `toContext()` | ??? |
Copy link
Member Author

Choose a reason for hiding this comment

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

Looking through the codebase, I can't find a single occurrence of this (toContext()) - do we need this anymore at all?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe downstream SDKs depend on this but I can't imagine a situation where this would be needed. Let's trash it.

| `isSuccess()` | ??? |
| `toTraceparent()` | ??? |
| `toContext()` | ??? |
| `updateWithContext()` | ??? |
Copy link
Member Author

Choose a reason for hiding this comment

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

Couldn't find any occurrence of updateWithContex(), so I think we can drop this?

| `setHttpStatus()` | ??? |
| `setName()` | TODO: `updateName()` |
| `startChild()` | Call `Sentry.startSpan()` independently |
| `isSuccess()` | ??? |
Copy link
Member Author

Choose a reason for hiding this comment

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

isSuccess() is not used by us (and really only checks the status), so I think we can deprecate/remove this.

| Old name | Replace with |
| --------------------------- | ----------------------------------------------------- |
| `name` | Same |
| `trimEnd` | Removed |
Copy link
Member Author

Choose a reason for hiding this comment

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

What should we do about trimEnd? 🤔 should we keep this somehow, or rework how this API works? I think with only spans this maybe also makes less sense overall, but not sure...?

Copy link
Member

Choose a reason for hiding this comment

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

trimEnd is just about idleTransactions. @mydea is there a way in the new performance API to inspect the child spans for a particular span and set its endTimestamp to the highest timestamp of the child spans? If so, we can drop this.

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 as we keep a list of the child spans, we should be able to keep the highest end timestamp and use this for idleSpan.end(highestTimestamp) 🤔 So I'd say this should be possible!

docs/v8-new-performance-apis.md Outdated Show resolved Hide resolved
docs/v8-new-performance-apis.md Outdated Show resolved Hide resolved
| `parentSpanId` | Same |
| `status` | TODO: new signature |
| `sampled` | `spanContext().traceFlags` |
| `startTimestamp` | `startTime` - note that this has a different format! |
Copy link
Member

Choose a reason for hiding this comment

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

l: Can we add either a link explaining the new format or a 1-liner explaining the difference?

Currently, `tracesSampler()` can receive an arbitrary `SamplingContext` passed as argument.
While this is not defined anywhere in detail, the shape of this context will change in v8. Going forward, this will mostly receive the attributes of the span, as well as some other relevant data of the span. Some properties we used to (sometimes) pass there, like `req` for node-based SDKs or `location` for browser tracing, will not be passed anymore.

### No more `undefined` spans
Copy link
Member

Choose a reason for hiding this comment

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

not new but just wanted to say again: big DX improvement!

@Lms24
Copy link
Member

Lms24 commented Jan 3, 2024

whoops forgot an overall comment: Take my "l:" suggestions as completely optional, depending on how important you think it is to be explicit here. IMO this mainly comes down to the target audience which iiuc is mainly internal comms. We should be very explicit though when we're using or linking to this doc in the official migration guide.

@mydea mydea force-pushed the fn/docs-new-performance-apis branch from 76f66e5 to ac0fca5 Compare January 4, 2024 10:38
@mydea mydea merged commit 09e4ecc into develop Jan 4, 2024
24 checks passed
@mydea mydea deleted the fn/docs-new-performance-apis branch January 4, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants