Skip to content

Commit 4224da8

Browse files
committed
add another opt
1 parent fc081ce commit 4224da8

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

docs/platforms/javascript/common/tracing/instrumentation/automatic-instrumentation.mdx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ You will need to configure your web server [CORS](https://developer.mozilla.org/
7070

7171
</SdkOption>
7272

73-
<SdkOption name="beforeStartSpan" type='(span: Span) => Span'>
73+
<SdkOption name="beforeStartSpan" type='(options: StartSpanOptions) => StartSpanOptions'>
7474

7575
`beforeStartSpan` is called at the start of every `pageload` or `navigation` span, and is passed an object containing data about the span which will be started. With `beforeStartSpan` you can modify that data.
7676

@@ -94,6 +94,13 @@ By default, spans will be created for all requests.
9494

9595
</SdkOption>
9696

97+
<SdkOption name="onRequestSpanStart" type="(span: Span, requestInformation: { headers?: WebFetchHeaders }): void">
98+
99+
This callback is invoked directly after a span is started for an outgoing fetch or XHR request.
100+
You can use it to annotate the span with additional data or attributes, for example by setting attributes based on the passed request headers.
101+
102+
</SdkOption>
103+
97104
<SdkOption name="idleTimeout" type='number' defaultValue='1000'>
98105

99106
The idle time, measured in ms, to wait until the pageload/navigation span will be finished, if there are no unfinished spans. The pageload/navigation span will use the end timestamp of the last finished span as the endtime.
@@ -142,7 +149,7 @@ This option determines whether spans for long animation frames get created autom
142149

143150
</SdkOption>
144151

145-
<SdkOption name="enableInp" type='boolean' defaultValue='true' availableSince='7.104.0'>
152+
<SdkOption name="enableInp" type='boolean' defaultValue='true' availableSince='7.104.0' defaultNote="See note">
146153

147154
This option determines whether interactions spans automatically get created when an [Interaction to Next Paint (INP)](/product/insights/web-vitals/web-vitals-concepts/#interaction-to-next-paint-inp) event is detected. Interactions are scored and surfaced in the [Web Vitals](/product/insights/web-vitals/) module.
148155

src/components/sdkOption.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type Props = {
1212
availableSince?: string;
1313
categorySupported?: PlatformCategory[];
1414
children?: React.ReactNode;
15+
defaultNote?: string;
1516
defaultValue?: string;
1617
envVar?: string;
1718
};
@@ -22,6 +23,7 @@ export function SdkOption({
2223
type,
2324
availableSince,
2425
defaultValue,
26+
defaultNote,
2527
envVar,
2628
categorySupported = [],
2729
}: Props) {
@@ -34,7 +36,9 @@ export function SdkOption({
3436
<OptionDefRow label="Available since" value={availableSince} />
3537
)}
3638
{type && <OptionDefRow label="Type" value={type} />}
37-
{defaultValue && <OptionDefRow label="Default" value={defaultValue} />}
39+
{defaultValue && (
40+
<OptionDefRow label="Default" value={defaultValue} note={defaultNote} />
41+
)}
3842
<PlatformCategorySection supported={['server', 'serverless']}>
3943
<PlatformSection notSupported={['javascript.nextjs']}>
4044
{envVar && <OptionDefRow label="ENV Variable" value={envVar} />}
@@ -50,12 +54,21 @@ export function SdkOption({
5054
);
5155
}
5256

53-
function OptionDefRow({label, value}: {label: string; value: string}) {
57+
function OptionDefRow({
58+
label,
59+
value,
60+
note,
61+
}: {
62+
label: string;
63+
value: string;
64+
note?: string;
65+
}) {
5466
return (
5567
<tr>
5668
<th>{label}</th>
5769
<td>
5870
<code>{value}</code>
71+
{note && <small> ({note})</small>}
5972
</td>
6073
</tr>
6174
);

0 commit comments

Comments
 (0)