Skip to content

Commit ac0fca5

Browse files
committed
adjust for new current status
1 parent 40fda3e commit ac0fca5

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

docs/v8-new-performance-apis.md

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# New Performance APIs in v8
22

3-
> [!WARNING]
4-
> This document is WIP. We are working on this while we are preparing v8.
3+
> [!WARNING] This document is WIP. We are working on this while we are preparing v8.
54
65
In v8.0.0, we moved to new performance APIs. These APIs have been introduced in v7, so they can already be used there.
76
However, in v8 we have removed the old performance APIs, so you have to update your manual instrumentation usage to the
@@ -34,8 +33,8 @@ which can have a nested tree of **Spans**.
3433
## The new model: Goodbye Transactions, Hello Spans Everywhere!
3534

3635
In the new model, transactions are conceptually gone. Instead, you will _always_ operate on spans, no matter where in
37-
the tree you are. Note that in the background, spans _may_ still be grouped into a transaction for the Sentry UI. However, this
38-
happens transparently, and from an SDK perspective, all you have to think about are spans.
36+
the tree you are. Note that in the background, spans _may_ still be grouped into a transaction for the Sentry UI.
37+
However, this happens transparently, and from an SDK perspective, all you have to think about are spans.
3938

4039
## The Span schema
4140

@@ -47,40 +46,40 @@ below to see which things used to exist, and how they can/should be mapped going
4746
| --------------------- | ---------------------------------------------------- |
4847
| `traceId` | `spanContext().traceId` |
4948
| `spanId` | `spanContext().spanId` |
50-
| `parentSpanId` | Unchanged |
51-
| `status` | TODO: new signature |
52-
| `sampled` | `spanContext().traceFlags` |
49+
| `parentSpanId` | Unchanged |
50+
| `status` | use utility method TODO |
51+
| `sampled` | `spanIsSampled(span)` |
5352
| `startTimestamp` | `startTime` - note that this has a different format! |
54-
| `tags` | Use `attributes` instead, or set tags on the scope |
55-
| `data` | Use `attributes` instead. |
56-
| `transaction` | Removed |
53+
| `tags` | `spanGetAttributes(span)`, or set tags on the scope |
54+
| `data` | `spanGetAttributes(span)` |
55+
| `transaction` | ??? Removed |
5756
| `instrumenter` | Removed |
5857
| `finish()` | `end()` |
5958
| `end()` | Same |
60-
| `setTag()` | `setAttribute()` |
59+
| `setTag()` | `setAttribute()`, or set tags on the scope |
6160
| `setData()` | `setAttribute()` |
6261
| `setStatus()` | TODO: new signature |
63-
| `setHttpStatus()` | ??? |
64-
| `setName()` | TODO: `updateName()` |
62+
| `setHttpStatus()` | ??? TODO |
63+
| `setName()` | `updateName()` |
6564
| `startChild()` | Call `Sentry.startSpan()` independently |
66-
| `isSuccess()` | ??? |
67-
| `toTraceparent()` | ??? |
68-
| `toContext()` | ??? |
69-
| `updateWithContext()` | ??? |
70-
| `getTraceContext()` | ??? |
65+
| `isSuccess()` | Removed (TODO) |
66+
| `toTraceparent()` | `spanToTraceHeader(span)` |
67+
| `toContext()` | Removed |
68+
| `updateWithContext()` | Removed |
69+
| `getTraceContext()` | `spanToTraceContext(span)` |
7170

7271
In addition, a transaction has this API:
7372

74-
| Old name | Replace with |
75-
| --------------------------- | ----------------------------------------------------- |
76-
| `name` | Same |
77-
| `trimEnd` | Removed |
78-
| `parentSampled` | `spanContext().traceFlags` & `spanContext().isRemote` |
79-
| `metadata` | Removed |
80-
| `setContext()` | Set context on scope instead |
81-
| `setMeasurement()` | ??? |
82-
| `setMetadata()` | Removed |
83-
| `getDynamicSamplingContext` | Removed - use global method instead (??) |
73+
| Old name | Replace with |
74+
| --------------------------- | ------------------------------------------------ |
75+
| `name` | `spanGetName(span)` (TODO) |
76+
| `trimEnd` | Removed |
77+
| `parentSampled` | `spanIsSampled(span)` & `spanContext().isRemote` |
78+
| `metadata` | `spanGetMetadata(span)` |
79+
| `setContext()` | Set context on scope instead |
80+
| `setMeasurement()` | ??? TODO |
81+
| `setMetadata()` | `spanSetMetadata(span, metadata)` |
82+
| `getDynamicSamplingContext` | ??? TODO |
8483

8584
### Attributes vs. Data vs. Tags vs. Context
8685

@@ -227,14 +226,18 @@ In addition to generally changing the performance APIs, there are also some smal
227226

228227
### Changed `SamplingContext` for `tracesSampler()`
229228

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

233234
### No more `undefined` spans
234235

235-
In v7, the performance APIs `startSpan()` / `startInactiveSpan()` / `startSpanManual()` would receive an `undefined` span if tracing was disabled or the span was not sampled.
236+
In v7, the performance APIs `startSpan()` / `startInactiveSpan()` / `startSpanManual()` would receive an `undefined`
237+
span if tracing was disabled or the span was not sampled.
236238

237-
In v8, aligning with OpenTelemetry, these will _always_ return a span - _but_ the span may eb a Noop-Span, meaning a span that is never sent. This means you don't have to guard everywhere in your code anymore for the span to exist:
239+
In v8, aligning with OpenTelemetry, these will _always_ return a span - _but_ the span may eb a Noop-Span, meaning a
240+
span that is never sent. This means you don't have to guard everywhere in your code anymore for the span to exist:
238241

239242
```ts
240243
Sentry.startSpan((span: Span | undefined) => {

0 commit comments

Comments
 (0)