@dynatrace/rum-javascript-sdk 1.343.6 → 1.345.1
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/dist/api/compat/agent-api-versions.d.ts +91 -0
- package/dist/api/compat/agent-api-versions.js +81 -0
- package/dist/api/index.d.ts +20 -0
- package/dist/api/index.js +57 -6
- package/dist/api/promises/index.d.ts +12 -0
- package/dist/api/promises/index.js +16 -1
- package/dist/api/promises/user-actions.d.ts +4 -1
- package/dist/api/promises/user-actions.js +5 -2
- package/dist/api/promises/wait-for-agent.js +26 -1
- package/dist/api/user-actions.d.ts +4 -1
- package/dist/api/user-actions.js +5 -2
- package/dist/types/api/dynatrace-api-types.d.ts +55 -3
- package/dist/types/api/dynatrace-api-types.js +1 -1
- package/dist/types/internal/feature-hashes.d.ts +1 -0
- package/dist/types/internal/feature-hashes.js +2 -1
- package/dist/types/rum-events/open-fields.d.ts +8 -1
- package/dist/types/rum-events/open-fields.js +14 -2
- package/dist/types/rum-events/rum-event-keys.d.ts +3 -0
- package/dist/types/rum-events/rum-event-keys.js +4 -1
- package/dist/types/rum-events/rum-internal-selfmonitoring-event.d.ts +5 -1
- package/dist/types/rum-events/rum-internal-selfmonitoring-event.js +5 -1
- package/dist/types/rum-events/rum-new-user-event.d.ts +0 -1
- package/dist/types/rum-events/rum-new-user-event.js +1 -1
- package/dist/types/rum-events/rum-user-action-event.d.ts +1 -1
- package/dist/types/rum-events/rum-user-action-event.js +1 -1
- package/dist/types/rum-events/rum-web-request-event.d.ts +8 -2
- package/dist/types/rum-events/rum-web-request-event.js +5 -1
- package/dist/types/testing/snapshot-defaults.d.ts +1 -1
- package/dist/types/testing/snapshot-defaults.js +4 -2
- package/docs/1-overview.md +32 -0
- package/docs/3-useractions.md +17 -3
- package/docs/5-browser-apis.md +205 -199
- package/docs/6-standalone-health-check.md +33 -0
- package/package.json +8 -2
|
@@ -26,7 +26,9 @@ export const DEFAULT_IGNORED_FIELDS = [
|
|
|
26
26
|
"span.id" /* RumEventKeys.SPAN$ID */,
|
|
27
27
|
"dt.rum.sfm_events" /* RumEventKeys.DT$RUM$SFM_EVENTS */,
|
|
28
28
|
"dt.rum.agent.version" /* RumEventKeys.DT$RUM$AGENT$VERSION */,
|
|
29
|
-
"dt.support.last_user_input" /* RumEventKeys.DT$SUPPORT$LAST_USER_INPUT
|
|
29
|
+
"dt.support.last_user_input" /* RumEventKeys.DT$SUPPORT$LAST_USER_INPUT */,
|
|
30
|
+
"dt.support.user_action.unattributed_instance_id" /* RumEventKeys.DT$SUPPORT$USER_ACTION$UNATTRIBUTED_INSTANCE_ID */,
|
|
31
|
+
"dt.support.request.retrieve_time" /* RumEventKeys.DT$SUPPORT$REQUEST$RETRIEVE_TIME */
|
|
30
32
|
];
|
|
31
33
|
/**
|
|
32
34
|
* Default properties that are removed entirely from snapshots to prevent flaky tests.
|
|
@@ -62,4 +64,4 @@ export const DEFAULT_IGNORED_EVENTS = [
|
|
|
62
64
|
* Placeholder value used to replace ignored property values.
|
|
63
65
|
*/
|
|
64
66
|
export const IGNORED_PLACEHOLDER = "[IGNORED]";
|
|
65
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic25hcHNob3QtZGVmYXVsdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zb3VyY2UvdHlwZXMvdGVzdGluZy9zbmFwc2hvdC1kZWZhdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQTs7OztHQUlHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sc0JBQXNCLEdBQUc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0NBdUM1QixDQUFDO0FBRVg7OztHQUdHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sc0JBQXNCLEdBQUc7SUFDbEMsNkRBQTZEO0lB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rc1xuICAgIFwibG9uZ190YXNrLipcIixcblxuICAgIC8vIFZpZXdwb3J0L3NjcmVlbiBkaW1lbnNpb25zICh2YXJ5IGJ5IHRlc3QgZW52aXJvbm1lbnQpXG4gICAgXCJicm93c2VyLndpbmRvdy4qXCIsXG4gICAgXCJkZXZpY2Uuc2NyZWVuLipcIixcbiAgICBSdW1FdmVudEtleXMuREVWSUNFJEJBVFRFUlkkTEVWRUxcbl0gYXMgY29uc3Q7XG5cbi8qKlxuICogRGVmYXVsdCBldmVudCBwYXR0ZXJucyB0aGF0IGFyZSBpZ25vcmVkIGR1cmluZyBzbmFwc2hvdCBjb21wYXJpc29uLlxuICogVGhlc2UgZXZlbnRzIGFyZSB2b2xhdGlsZSBhbmQgbWF5IG9yIG1heSBub3QgYmUgcmVjb3JkZWQgZGVwZW5kaW5nIG9uIGJyb3dzZXIgcGVyZm9ybWFuY2UuXG4gKi9cbmV4cG9ydCBjb25zdCBERUZBVUxUX0lHTk9SRURfRVZFTlRTID0gW1xuICAgIHsgW1J1bUV2ZW50S2V5cy5DSEFSQUNURVJJU1RJQ1MkSEFTX0xPTkdfVEFTS106IHRydWUgfSxcbiAgICB7IFtSdW1FdmVudEtleXMuQ0hBUkFDVEVSSVNUSUNTJElTX1NFTEZfTU9OSVRPUklOR106IHRydWUgfVxuXSBhcyBjb25zdDtcblxuLyoqXG4gKiBQbGFjZWhvbGRlciB2YWx1ZSB1c2VkIHRvIHJlcGxhY2UgaWdub3JlZCBwcm9wZXJ0eSB2YWx1ZXMuXG4gKi9cbmV4cG9ydCBjb25zdCBJR05PUkVEX1BMQUNFSE9MREVSID0gXCJbSUdOT1JFRF1cIjtcbiJdfQ==
|
package/docs/1-overview.md
CHANGED
|
@@ -57,6 +57,22 @@ try {
|
|
|
57
57
|
}
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
### Checking whether RUM JavaScript is enabled
|
|
61
|
+
|
|
62
|
+
Use `isEnabled()` to check whether RUM JavaScript is currently active — reflecting the current opt-in mode
|
|
63
|
+
and consent state — before running code that only makes sense when monitoring is on.
|
|
64
|
+
The synchronous wrapper returns `false` when RUM JavaScript is not available.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { isEnabled } from '@dynatrace/rum-javascript-sdk/api';
|
|
68
|
+
|
|
69
|
+
// Skip expensive instrumentation setup when monitoring is off
|
|
70
|
+
if (isEnabled()) {
|
|
71
|
+
runExpensiveProfilingSetup();
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
|
|
60
76
|
## API Reference
|
|
61
77
|
|
|
62
78
|
### Synchronous API (`@dynatrace/rum-javascript-sdk/api`)
|
|
@@ -83,6 +99,22 @@ Manual control over user action creation and lifecycle via {@link API.UserAction
|
|
|
83
99
|
|
|
84
100
|
The {@link SDK.DynatraceError} class is thrown by the asynchronous API when the RUM JavaScript is not available within the specified timeout.
|
|
85
101
|
|
|
102
|
+
## Version Compatibility
|
|
103
|
+
|
|
104
|
+
The on-page RUM JavaScript agent publishes a public API version via the {@link API.dynatrace.apiVersion | `dynatrace.apiVersion`} property. The SDK reads this value to detect when it is out of sync with the agent:
|
|
105
|
+
|
|
106
|
+
- **Legacy agents** that predate API versioning expose `apiVersion` as `undefined`. They are treated as fully compatible and behave exactly as before.
|
|
107
|
+
- **Known versions** (an `apiVersion` the SDK recognizes) are used as-is.
|
|
108
|
+
- **Newer-than-SDK agents** (an `apiVersion` higher than the SDK knows about) still work, but the SDK emits a one-time console warning so you know some newer features may not be available:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
RUM JavaScript agent API version <N> is newer than the maximum supported by this SDK (<MAX>). Some features may not be available. Consider updating @dynatrace/rum-javascript-sdk.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The warning is logged at most once per page load, and is shared across both the synchronous and asynchronous (promises) entry points. To resolve it, update `@dynatrace/rum-javascript-sdk` to a version that matches the deployed agent.
|
|
115
|
+
|
|
116
|
+
In addition to the console warning, when the agent is newer than the SDK, the SDK reports the mismatch back to the agent so it surfaces in monitoring. If the on-page agent exposes the {@link API.dynatrace.reportApiMismatch | `dynatrace.reportApiMismatch`} method, the SDK calls it with the detected {@link API.ApiMismatchDetails | mismatch details} (`reason`, `agentApiVersion`, and `sdkMaxKnownApiVersion`). The agent records this as an internal self-monitoring event (surfaced in the RUM JavaScript health check), deduplicated to at most once per page load. Agents that predate this method — including earlier `apiVersion: 1` builds — do not expose it; against those agents the SDK falls back to the console warning only. This method is feature-detected, so it never fails when the agent lacks it.
|
|
117
|
+
|
|
86
118
|
## TypeScript Support
|
|
87
119
|
|
|
88
120
|
For detailed type information and usage examples, see [Dynatrace Api Types](./2-types.md).
|
package/docs/3-useractions.md
CHANGED
|
@@ -64,7 +64,7 @@ User actions can complete for various reasons, indicated by the `user_action.com
|
|
|
64
64
|
|
|
65
65
|
- **`page_hide`** - The user action completed because the page was dismissed (user navigated away, closed the tab, or the page hide event was fired).
|
|
66
66
|
|
|
67
|
-
- **`timeout`** - The user action
|
|
67
|
+
- **`timeout`** - The user action reached the maximum allowed duration and was forcefully completed to prevent indefinitely running actions. This reason is also reported when a `duration` would otherwise exceed the maximum and is capped to it — for example after a backdated `startTime`, or a long pause in JavaScript execution such as a backgrounded tab.
|
|
68
68
|
|
|
69
69
|
## API approaches
|
|
70
70
|
|
|
@@ -334,7 +334,11 @@ dynatrace.userActions?.create({ customName: "Add to Cart"});
|
|
|
334
334
|
|
|
335
335
|
## Disable automatic detection
|
|
336
336
|
|
|
337
|
-
|
|
337
|
+
Pause automatic user action detection when it interferes with manual user action handling. This is particularly useful for single-page applications with complex routing logic.
|
|
338
|
+
|
|
339
|
+
Changing automatic detection only affects the creation of future automatic user actions. It does not complete, interrupt,
|
|
340
|
+
or otherwise affect the currently active user action. The active action continues tracking activity and follows its
|
|
341
|
+
configured completion behavior.
|
|
338
342
|
|
|
339
343
|
### Basic usage
|
|
340
344
|
|
|
@@ -355,7 +359,7 @@ async function handleNavigation(route) {
|
|
|
355
359
|
```
|
|
356
360
|
|
|
357
361
|
:::caution
|
|
358
|
-
|
|
362
|
+
While automatic detection is disabled, no new user actions are created automatically. You must create new user actions manually using the {@link API.UserActions.create | `create()`} function.
|
|
359
363
|
:::
|
|
360
364
|
|
|
361
365
|
### Re-enable automatic detection
|
|
@@ -533,6 +537,16 @@ await processData();
|
|
|
533
537
|
userAction?.complete();
|
|
534
538
|
```
|
|
535
539
|
|
|
540
|
+
:::note
|
|
541
|
+
A user action's maximum duration is measured from its `startTime`, not from when it was created — so setting an earlier start time consumes part of that budget and changes when the action times out:
|
|
542
|
+
|
|
543
|
+
- If the start time is backdated far enough that the maximum duration is **already exceeded**, the action completes **immediately** with `user_action.complete_reason: timeout`.
|
|
544
|
+
- Otherwise the maximum-duration timeout is re-aligned to fire at `startTime + maximum duration`, instead of running the full maximum from the creation time.
|
|
545
|
+
- The reported `duration` can **never exceed** the maximum allowed duration. If a backdated start time — or a long pause in JavaScript execution, such as a backgrounded tab or sleeping device — would push it over, the `duration` is capped to the maximum and `user_action.complete_reason` is set to `timeout`.
|
|
546
|
+
|
|
547
|
+
Set the start time to a past timestamp marking when the real work began. Future start times are rejected — see [Don't set startTime in the future](#dont-set-starttime-in-the-future).
|
|
548
|
+
:::
|
|
549
|
+
|
|
536
550
|
### Handle framework-specific routing
|
|
537
551
|
|
|
538
552
|
Integrate with popular frameworks like React Router:
|