@sentry/react 11.0.0-alpha.1 → 11.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/profiler.js +10 -13
- package/build/cjs/profiler.js.map +1 -1
- package/build/cjs/reactrouter-compat-utils/instrumentation.js +27 -16
- package/build/cjs/reactrouter-compat-utils/instrumentation.js.map +1 -1
- package/build/cjs/reactrouter.js +7 -5
- package/build/cjs/reactrouter.js.map +1 -1
- package/build/cjs/reactrouterv3.js +6 -4
- package/build/cjs/reactrouterv3.js.map +1 -1
- package/build/cjs/tanstackrouter.js +20 -9
- package/build/cjs/tanstackrouter.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/profiler.js +12 -15
- package/build/esm/profiler.js.map +1 -1
- package/build/esm/reactrouter-compat-utils/instrumentation.js +29 -18
- package/build/esm/reactrouter-compat-utils/instrumentation.js.map +1 -1
- package/build/esm/reactrouter.js +9 -7
- package/build/esm/reactrouter.js.map +1 -1
- package/build/esm/reactrouterv3.js +8 -6
- package/build/esm/reactrouterv3.js.map +1 -1
- package/build/esm/tanstackrouter.js +23 -12
- package/build/esm/tanstackrouter.js.map +1 -1
- package/build/types/profiler.d.ts.map +1 -1
- package/build/types/reactrouter-compat-utils/instrumentation.d.ts.map +1 -1
- package/build/types/reactrouter.d.ts.map +1 -1
- package/build/types/reactrouterv3.d.ts.map +1 -1
- package/build/types/tanstackrouter.d.ts.map +1 -1
- package/build/types/vendor/tanstackrouter-types.d.ts +1 -0
- package/build/types/vendor/tanstackrouter-types.d.ts.map +1 -1
- package/package.json +5 -4
package/build/cjs/profiler.js
CHANGED
|
@@ -19,10 +19,9 @@ class Profiler extends React.Component {
|
|
|
19
19
|
name: `<${name}>`,
|
|
20
20
|
onlyIfParent: true,
|
|
21
21
|
attributes: {
|
|
22
|
-
|
|
23
|
-
[attributes.SENTRY_OP]: "ui.mount",
|
|
22
|
+
[attributes.SENTRY_OP]: op.UI_MOUNT,
|
|
24
23
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.react.profiler",
|
|
25
|
-
|
|
24
|
+
[attributes.UI_COMPONENT_NAME]: name
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
27
|
}
|
|
@@ -43,10 +42,9 @@ class Profiler extends React.Component {
|
|
|
43
42
|
onlyIfParent: true,
|
|
44
43
|
startTime: now,
|
|
45
44
|
attributes: {
|
|
46
|
-
|
|
47
|
-
[attributes.SENTRY_OP]: "ui.update",
|
|
45
|
+
[attributes.SENTRY_OP]: op.UI_UPDATE,
|
|
48
46
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.react.profiler",
|
|
49
|
-
|
|
47
|
+
[attributes.UI_COMPONENT_NAME]: this.props.name,
|
|
50
48
|
"ui.react.changed_props": changedProps
|
|
51
49
|
}
|
|
52
50
|
});
|
|
@@ -74,9 +72,9 @@ class Profiler extends React.Component {
|
|
|
74
72
|
name: `<${name}>`,
|
|
75
73
|
startTime,
|
|
76
74
|
attributes: {
|
|
77
|
-
[attributes.SENTRY_OP]: op.
|
|
75
|
+
[attributes.SENTRY_OP]: op.UI_RENDER,
|
|
78
76
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.react.profiler",
|
|
79
|
-
|
|
77
|
+
[attributes.UI_COMPONENT_NAME]: name
|
|
80
78
|
}
|
|
81
79
|
});
|
|
82
80
|
if (renderSpan) {
|
|
@@ -115,10 +113,9 @@ function useProfiler(name, options = {
|
|
|
115
113
|
name: `<${name}>`,
|
|
116
114
|
onlyIfParent: true,
|
|
117
115
|
attributes: {
|
|
118
|
-
|
|
119
|
-
[attributes.SENTRY_OP]: "ui.mount",
|
|
116
|
+
[attributes.SENTRY_OP]: op.UI_MOUNT,
|
|
120
117
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.react.profiler",
|
|
121
|
-
|
|
118
|
+
[attributes.UI_COMPONENT_NAME]: name
|
|
122
119
|
}
|
|
123
120
|
});
|
|
124
121
|
});
|
|
@@ -135,9 +132,9 @@ function useProfiler(name, options = {
|
|
|
135
132
|
onlyIfParent: true,
|
|
136
133
|
startTime,
|
|
137
134
|
attributes: {
|
|
138
|
-
[attributes.SENTRY_OP]: op.
|
|
135
|
+
[attributes.SENTRY_OP]: op.UI_RENDER,
|
|
139
136
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.react.profiler",
|
|
140
|
-
|
|
137
|
+
[attributes.UI_COMPONENT_NAME]: name
|
|
141
138
|
}
|
|
142
139
|
});
|
|
143
140
|
if (renderSpan) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiler.js","sources":["../../src/profiler.tsx"],"sourcesContent":["import { startInactiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, timestampInSeconds, withActiveSpan } from '@sentry/core';\nimport { SENTRY_OP } from '@sentry/conventions/attributes';\nimport { BROWSER_UI_RENDER_SPAN_OP } from '@sentry/conventions/op';\nimport * as React from 'react';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type ProfilerProps = {\n // The name of the component being profiled.\n name: string;\n // If the Profiler is disabled. False by default. This is useful if you want to disable profilers\n // in certain environments.\n disabled?: boolean;\n // If time component is on page should be displayed as spans. True by default.\n includeRender?: boolean;\n // If component updates should be displayed as spans. True by default.\n includeUpdates?: boolean;\n // Component that is being profiled.\n children?: React.ReactNode;\n // props given to component being profiled.\n updateProps: { [key: string]: unknown };\n};\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component<ProfilerProps> {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n protected _mountSpan: Span | undefined;\n /**\n * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate\n */\n protected _updateSpan: Span | undefined;\n\n public constructor(props: ProfilerProps) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n this._mountSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n attributes: {\n // TODO(conventions): Replace `'ui.mount'` with the `ui.mount` span op constant once it is released in `@sentry/conventions`.\n [SENTRY_OP]: 'ui.mount',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n }\n\n // If a component mounted, we can finish the mount activity.\n public componentDidMount(): void {\n if (this._mountSpan) {\n this._mountSpan.end();\n }\n }\n\n public shouldComponentUpdate({ updateProps, includeUpdates = true }: ProfilerProps): boolean {\n // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props have changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potentially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n const now = timestampInSeconds();\n this._updateSpan = withActiveSpan(this._mountSpan, () => {\n return startInactiveSpan({\n name: `<${this.props.name}>`,\n onlyIfParent: true,\n startTime: now,\n attributes: {\n // TODO(conventions): Replace `'ui.update'` with the `ui.update` span op constant once it is released in `@sentry/conventions`.\n [SENTRY_OP]: 'ui.update',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': this.props.name,\n 'ui.react.changed_props': changedProps,\n },\n });\n });\n }\n }\n\n return true;\n }\n\n public componentDidUpdate(): void {\n if (this._updateSpan) {\n this._updateSpan.end();\n this._updateSpan = undefined;\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n public componentWillUnmount(): void {\n const endTimestamp = timestampInSeconds();\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n const startTime = spanToJSON(this._mountSpan).end_timestamp;\n withActiveSpan(this._mountSpan, () => {\n const renderSpan = startInactiveSpan({\n onlyIfParent: true,\n name: `<${name}>`,\n startTime,\n attributes: {\n [SENTRY_OP]: BROWSER_UI_RENDER_SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\n }\n}\n\n// React.Component default props are defined as static property on the class\nObject.assign(Profiler, {\n defaultProps: {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n },\n});\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withProfiler<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps' | 'children'>>,\n): React.FC<P> {\n const componentDisplayName =\n options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <Profiler {...options} name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </Profiler>\n );\n\n Wrapped.displayName = `profiler(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name: string,\n options: { disabled?: boolean; hasRenderSpan?: boolean } = {\n disabled: false,\n hasRenderSpan: true,\n },\n): void {\n const [mountSpan] = React.useState(() => {\n if (options?.disabled) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n attributes: {\n // TODO(conventions): Replace `'ui.mount'` with the `ui.mount` span op constant once it is released in `@sentry/conventions`.\n [SENTRY_OP]: 'ui.mount',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.end();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n const startTime = spanToJSON(mountSpan).end_timestamp;\n const endTimestamp = timestampInSeconds();\n\n const renderSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n startTime,\n attributes: {\n [SENTRY_OP]: BROWSER_UI_RENDER_SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n 'ui.component_name': name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { Profiler, useProfiler, withProfiler };\n"],"names":["startInactiveSpan","SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","timestampInSeconds","withActiveSpan","spanToJSON","BROWSER_UI_RENDER_SPAN_OP","hoistNonReactStatics"],"mappings":";;;;;;;;;AAQO,MAAM,iBAAA,GAAoB;AAsBjC,MAAM,QAAA,SAAiB,MAAM,SAAA,CAAyB;AAAA,EAW7C,YAAY,KAAA,EAAsB;AACvC,IAAA,KAAA,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A,QACb,CAACC,qCAAgC,GAAG,wBAAA;AAAA,QACpC,mBAAA,EAAqB;AAAA;AACvB,KACD,CAAA;AAAA,EACH,CAAC,CAAA;AAED,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,SAAA,CAAU,GAAA,EAAI;AAAA,IAChB;AAEA,IAAA,OAAO,MAAY;AACjB,MAAA,IAAI,SAAA,IAAa,QAAQ,aAAA,EAAe;AACtC,QAAA,MAAM,SAAA,GAAYG,eAAA,CAAW,SAAS,CAAA,CAAE,aAAA;AACxC,QAAA,MAAM,eAAeF,uBAAA,EAAmB;AAExC,QAAA,MAAM,aAAaH,yBAAA,CAAkB;AAAA,UACnC,IAAA,EAAM,IAAI,IAAI,CAAA,CAAA,CAAA;AAAA,UACd,YAAA,EAAc,IAAA;AAAA,UACd,SAAA;AAAA,UACA,UAAA,EAAY;AAAA,YACV,CAACC,oBAAS,GAAGK,4BAAA;AAAA,YACb,CAACJ,qCAAgC,GAAG,wBAAA;AAAA,YACpC,mBAAA,EAAqB;AAAA;AACvB,SACD,CAAA;AACD,QAAA,IAAI,UAAA,EAAY;AAGd,UAAA,UAAA,CAAW,IAAI,YAAY,CAAA;AAAA,QAC7B;AAAA,MACF;AAAA,IACF,CAAA;AAAA,EAGF,CAAA,EAAG,EAAE,CAAA;AACP;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"profiler.js","sources":["../../src/profiler.tsx"],"sourcesContent":["import { startInactiveSpan } from '@sentry/browser';\nimport type { Span } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, timestampInSeconds, withActiveSpan } from '@sentry/core';\nimport { SENTRY_OP, UI_COMPONENT_NAME } from '@sentry/conventions/attributes';\nimport { UI_MOUNT, UI_RENDER, UI_UPDATE } from '@sentry/conventions/op';\nimport * as React from 'react';\nimport { hoistNonReactStatics } from './hoist-non-react-statics';\n\nexport const UNKNOWN_COMPONENT = 'unknown';\n\nexport type ProfilerProps = {\n // The name of the component being profiled.\n name: string;\n // If the Profiler is disabled. False by default. This is useful if you want to disable profilers\n // in certain environments.\n disabled?: boolean;\n // If time component is on page should be displayed as spans. True by default.\n includeRender?: boolean;\n // If component updates should be displayed as spans. True by default.\n includeUpdates?: boolean;\n // Component that is being profiled.\n children?: React.ReactNode;\n // props given to component being profiled.\n updateProps: { [key: string]: unknown };\n};\n\n/**\n * The Profiler component leverages Sentry's Tracing integration to generate\n * spans based on component lifecycles.\n */\nclass Profiler extends React.Component<ProfilerProps> {\n /**\n * The span of the mount activity\n * Made protected for the React Native SDK to access\n */\n protected _mountSpan: Span | undefined;\n /**\n * The span that represents the duration of time between shouldComponentUpdate and componentDidUpdate\n */\n protected _updateSpan: Span | undefined;\n\n public constructor(props: ProfilerProps) {\n super(props);\n const { name, disabled = false } = this.props;\n\n if (disabled) {\n return;\n }\n\n this._mountSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: UI_MOUNT,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n [UI_COMPONENT_NAME]: name,\n },\n });\n }\n\n // If a component mounted, we can finish the mount activity.\n public componentDidMount(): void {\n if (this._mountSpan) {\n this._mountSpan.end();\n }\n }\n\n public shouldComponentUpdate({ updateProps, includeUpdates = true }: ProfilerProps): boolean {\n // Only generate an update span if includeUpdates is true, if there is a valid mountSpan,\n // and if the updateProps have changed. It is ok to not do a deep equality check here as it is expensive.\n // We are just trying to give baseline clues for further investigation.\n if (includeUpdates && this._mountSpan && updateProps !== this.props.updateProps) {\n // See what props have changed between the previous props, and the current props. This is\n // set as data on the span. We just store the prop keys as the values could be potentially very large.\n const changedProps = Object.keys(updateProps).filter(k => updateProps[k] !== this.props.updateProps[k]);\n if (changedProps.length > 0) {\n const now = timestampInSeconds();\n this._updateSpan = withActiveSpan(this._mountSpan, () => {\n return startInactiveSpan({\n name: `<${this.props.name}>`,\n onlyIfParent: true,\n startTime: now,\n attributes: {\n [SENTRY_OP]: UI_UPDATE,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n [UI_COMPONENT_NAME]: this.props.name,\n 'ui.react.changed_props': changedProps,\n },\n });\n });\n }\n }\n\n return true;\n }\n\n public componentDidUpdate(): void {\n if (this._updateSpan) {\n this._updateSpan.end();\n this._updateSpan = undefined;\n }\n }\n\n // If a component is unmounted, we can say it is no longer on the screen.\n // This means we can finish the span representing the component render.\n public componentWillUnmount(): void {\n const endTimestamp = timestampInSeconds();\n const { name, includeRender = true } = this.props;\n\n if (this._mountSpan && includeRender) {\n const startTime = spanToJSON(this._mountSpan).end_timestamp;\n withActiveSpan(this._mountSpan, () => {\n const renderSpan = startInactiveSpan({\n onlyIfParent: true,\n name: `<${name}>`,\n startTime,\n attributes: {\n [SENTRY_OP]: UI_RENDER,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n [UI_COMPONENT_NAME]: name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n });\n }\n }\n\n public render(): React.ReactNode {\n return this.props.children;\n }\n}\n\n// React.Component default props are defined as static property on the class\nObject.assign(Profiler, {\n defaultProps: {\n disabled: false,\n includeRender: true,\n includeUpdates: true,\n },\n});\n\n/**\n * withProfiler is a higher order component that wraps a\n * component in a {@link Profiler} component. It is recommended that\n * the higher order component be used over the regular {@link Profiler} component.\n *\n * @param WrappedComponent component that is wrapped by Profiler\n * @param options the {@link ProfilerProps} you can pass into the Profiler\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withProfiler<P extends Record<string, any>>(\n WrappedComponent: React.ComponentType<P>,\n // We do not want to have `updateProps` given in options, it is instead filled through the HOC.\n options?: Pick<Partial<ProfilerProps>, Exclude<keyof ProfilerProps, 'updateProps' | 'children'>>,\n): React.FC<P> {\n const componentDisplayName =\n options?.name || WrappedComponent.displayName || WrappedComponent.name || UNKNOWN_COMPONENT;\n\n const Wrapped: React.FC<P> = (props: P) => (\n <Profiler {...options} name={componentDisplayName} updateProps={props}>\n <WrappedComponent {...props} />\n </Profiler>\n );\n\n Wrapped.displayName = `profiler(${componentDisplayName})`;\n\n // Copy over static methods from Wrapped component to Profiler HOC\n // See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over\n hoistNonReactStatics(Wrapped, WrappedComponent);\n return Wrapped;\n}\n\n/**\n *\n * `useProfiler` is a React hook that profiles a React component.\n *\n * @param name displayName of component being profiled\n */\nfunction useProfiler(\n name: string,\n options: { disabled?: boolean; hasRenderSpan?: boolean } = {\n disabled: false,\n hasRenderSpan: true,\n },\n): void {\n const [mountSpan] = React.useState(() => {\n if (options?.disabled) {\n return undefined;\n }\n\n return startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n attributes: {\n [SENTRY_OP]: UI_MOUNT,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n [UI_COMPONENT_NAME]: name,\n },\n });\n });\n\n React.useEffect(() => {\n if (mountSpan) {\n mountSpan.end();\n }\n\n return (): void => {\n if (mountSpan && options.hasRenderSpan) {\n const startTime = spanToJSON(mountSpan).end_timestamp;\n const endTimestamp = timestampInSeconds();\n\n const renderSpan = startInactiveSpan({\n name: `<${name}>`,\n onlyIfParent: true,\n startTime,\n attributes: {\n [SENTRY_OP]: UI_RENDER,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.react.profiler',\n [UI_COMPONENT_NAME]: name,\n },\n });\n if (renderSpan) {\n // Have to cast to Span because the type of _mountSpan is Span | undefined\n // and not getting narrowed properly\n renderSpan.end(endTimestamp);\n }\n }\n };\n // We only want this to run once.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n}\n\nexport { Profiler, useProfiler, withProfiler };\n"],"names":["startInacti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
_lazyRouteManifest,
|
|
160
160
|
_enableAsyncRouteHandlers
|
|
161
161
|
);
|
|
162
|
-
const currentSource = attributes$1[
|
|
162
|
+
const currentSource = attributes$1[attributes.SENTRY_SEGMENT_NAME_SOURCE];
|
|
163
163
|
const isImprovement = name && (!currentName || // No current name - always set
|
|
164
164
|
!hasBeenNamed && (currentSource !== "route" || source === "route") || // Not finalized - allow unless downgrading route→url
|
|
165
165
|
currentSource !== "route" && source === "route" || // URL → route upgrade
|
|
166
166
|
currentSource === "route" && source === "route" && currentNameHasWildcard);
|
|
167
167
|
if (isImprovement) {
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
const client = core.getClient();
|
|
169
|
+
const isUnparameterizedStreamedNavigation = source !== "route" && !!client && core.hasSpanStreamingEnabled(client);
|
|
170
|
+
activeRootSpan.updateName(isUnparameterizedStreamedNavigation ? core.NAVIGATION_SPAN_NAME_FALLBACK : name);
|
|
171
|
+
activeRootSpan.setAttribute(attributes.SENTRY_SEGMENT_NAME_SOURCE, source);
|
|
170
172
|
if (source === "route") {
|
|
171
173
|
activeRootSpan.setAttribute(attributes.URL_TEMPLATE, name);
|
|
172
174
|
}
|
|
@@ -371,9 +373,11 @@ function createReactRouterV6CompatibleTracingIntegration(options, version) {
|
|
|
371
373
|
const initPathName = browser.WINDOW.location?.pathname;
|
|
372
374
|
if (instrumentPageLoad && initPathName) {
|
|
373
375
|
browser.startBrowserTracingPageLoadSpan(client, {
|
|
374
|
-
|
|
376
|
+
// With span streaming, span names have to be low cardinality. The route is only resolved
|
|
377
|
+
// once the router renders, which updates the span name then.
|
|
378
|
+
name: core.hasSpanStreamingEnabled(client) ? core.PAGELOAD_SPAN_NAME_FALLBACK : initPathName,
|
|
375
379
|
attributes: {
|
|
376
|
-
[
|
|
380
|
+
[attributes.SENTRY_SEGMENT_NAME_SOURCE]: "url",
|
|
377
381
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "pageload",
|
|
378
382
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.pageload.react.reactrouter${version ? `_v${version}` : ""}`
|
|
379
383
|
}
|
|
@@ -543,8 +547,9 @@ function handleNavigation(opts) {
|
|
|
543
547
|
`[Tracing] Updated placeholder navigation name from "${oldName}" to "${name}" (will apply to real span)`
|
|
544
548
|
);
|
|
545
549
|
} else {
|
|
546
|
-
|
|
547
|
-
trackedNav.span.
|
|
550
|
+
const isUnparameterizedStreamedNavigation = source !== "route" && core.hasSpanStreamingEnabled(client);
|
|
551
|
+
trackedNav.span.updateName(isUnparameterizedStreamedNavigation ? core.NAVIGATION_SPAN_NAME_FALLBACK : name);
|
|
552
|
+
trackedNav.span.setAttribute(attributes.SENTRY_SEGMENT_NAME_SOURCE, source);
|
|
548
553
|
if (source === "route") {
|
|
549
554
|
trackedNav.span.setAttribute(attributes.URL_TEMPLATE, name);
|
|
550
555
|
}
|
|
@@ -570,10 +575,11 @@ function handleNavigation(opts) {
|
|
|
570
575
|
let navigationSpan;
|
|
571
576
|
try {
|
|
572
577
|
navigationSpan = browser.startBrowserTracingNavigationSpan(client, {
|
|
573
|
-
|
|
574
|
-
//
|
|
578
|
+
// Use placeholder's routeName in case it was updated. With span streaming, span names have to
|
|
579
|
+
// be low cardinality, so we can't fall back to the URL.
|
|
580
|
+
name: source === "route" || !core.hasSpanStreamingEnabled(client) ? placeholderEntry.routeName : core.NAVIGATION_SPAN_NAME_FALLBACK,
|
|
575
581
|
attributes: {
|
|
576
|
-
[
|
|
582
|
+
[attributes.SENTRY_SEGMENT_NAME_SOURCE]: source,
|
|
577
583
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "navigation",
|
|
578
584
|
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: `auto.navigation.react.reactrouter${version ? `_v${version}` : ""}`,
|
|
579
585
|
...source === "route" && { [attributes.URL_TEMPLATE]: placeholderEntry.routeName }
|
|
@@ -648,8 +654,10 @@ function updatePageloadTransaction({
|
|
|
648
654
|
);
|
|
649
655
|
core.getCurrentScope().setTransactionName(name || "/");
|
|
650
656
|
if (activeRootSpan) {
|
|
651
|
-
|
|
652
|
-
|
|
657
|
+
const client = core.getClient();
|
|
658
|
+
const isUnparameterizedStreamedPageload = source !== "route" && !!client && core.hasSpanStreamingEnabled(client);
|
|
659
|
+
activeRootSpan.updateName(isUnparameterizedStreamedPageload ? core.PAGELOAD_SPAN_NAME_FALLBACK : name);
|
|
660
|
+
activeRootSpan.setAttribute(attributes.SENTRY_SEGMENT_NAME_SOURCE, source);
|
|
653
661
|
if (source === "route") {
|
|
654
662
|
activeRootSpan.setAttribute(attributes.URL_TEMPLATE, name);
|
|
655
663
|
}
|
|
@@ -677,7 +685,7 @@ function shouldUpdateWildcardSpanName(currentName, currentSource, newName, newSo
|
|
|
677
685
|
}
|
|
678
686
|
function tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, routes, basename, spanType, allRoutes2) {
|
|
679
687
|
try {
|
|
680
|
-
const currentSource = spanJson.attributes[
|
|
688
|
+
const currentSource = spanJson.attributes[attributes.SENTRY_SEGMENT_NAME_SOURCE];
|
|
681
689
|
if (currentSource === "route" && currentName && !utils.transactionNameHasWildcard(currentName)) {
|
|
682
690
|
return;
|
|
683
691
|
}
|
|
@@ -699,8 +707,11 @@ function tryUpdateSpanNameBeforeEnd(span, spanJson, currentName, location, route
|
|
|
699
707
|
const isImprovement = shouldUpdateWildcardSpanName(currentName, currentSource, name, source, true);
|
|
700
708
|
const spanNotEnded = spanType === "pageload" || !spanJson.end_timestamp;
|
|
701
709
|
if (isImprovement && spanNotEnded) {
|
|
702
|
-
|
|
703
|
-
|
|
710
|
+
const client = core.getClient();
|
|
711
|
+
const isUnparameterizedStreamedSpan = source !== "route" && !!client && core.hasSpanStreamingEnabled(client);
|
|
712
|
+
const fallbackName = spanType === "pageload" ? core.PAGELOAD_SPAN_NAME_FALLBACK : core.NAVIGATION_SPAN_NAME_FALLBACK;
|
|
713
|
+
span.updateName(isUnparameterizedStreamedSpan ? fallbackName : name);
|
|
714
|
+
span.setAttribute(attributes.SENTRY_SEGMENT_NAME_SOURCE, source);
|
|
704
715
|
if (source === "route") {
|
|
705
716
|
span.setAttribute(attributes.URL_TEMPLATE, name);
|
|
706
717
|
}
|
|
@@ -725,7 +736,7 @@ function patchSpanEnd(span, location, routes, basename, spanType) {
|
|
|
725
736
|
const endTimestamp = args.length > 0 ? args[0] : Date.now() / 1e3;
|
|
726
737
|
const spanJson = core.spanToJSON(span);
|
|
727
738
|
const currentName = spanJson.name;
|
|
728
|
-
const currentSource = spanJson.attributes[
|
|
739
|
+
const currentSource = spanJson.attributes[attributes.SENTRY_SEGMENT_NAME_SOURCE];
|
|
729
740
|
const cleanupNavigationSpan = () => {
|
|
730
741
|
const client = core.getClient();
|
|
731
742
|
if (client && spanType === "navigation") {
|