@dynatrace/rum-javascript-sdk 1.329.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/LICENSE +174 -0
- package/README.md +402 -0
- package/dist/api/constants.d.ts +1 -0
- package/dist/api/constants.js +2 -0
- package/dist/api/dynatrace-error.d.ts +3 -0
- package/dist/api/dynatrace-error.js +7 -0
- package/dist/api/global-adapter.d.ts +1 -0
- package/dist/api/global-adapter.js +4 -0
- package/dist/api/index.d.ts +65 -0
- package/dist/api/index.js +110 -0
- package/dist/api/logging.d.ts +2 -0
- package/dist/api/logging.js +8 -0
- package/dist/api/promises/index.d.ts +85 -0
- package/dist/api/promises/index.js +104 -0
- package/dist/api/promises/user-actions.d.ts +35 -0
- package/dist/api/promises/user-actions.js +48 -0
- package/dist/api/promises/wait-for-agent.d.ts +2 -0
- package/dist/api/promises/wait-for-agent.js +77 -0
- package/dist/api/promises/wait-for-send-exception-event.d.ts +9 -0
- package/dist/api/promises/wait-for-send-exception-event.js +18 -0
- package/dist/api/promises/wait-for-user-actions.d.ts +9 -0
- package/dist/api/promises/wait-for-user-actions.js +18 -0
- package/dist/api/type-guards/is-valid-agent.d.ts +2 -0
- package/dist/api/type-guards/is-valid-agent.js +4 -0
- package/dist/api/user-actions.d.ts +62 -0
- package/dist/api/user-actions.js +99 -0
- package/dist/testing/install.d.ts +15 -0
- package/dist/testing/install.js +19 -0
- package/dist/testing/test.d.ts +111 -0
- package/dist/testing/test.js +229 -0
- package/dist/types/api/dynatrace-api-types.d.ts +319 -0
- package/dist/types/api/dynatrace-api-types.js +7 -0
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/api/index.js +2 -0
- package/dist/types/index-typedoc.d.ts +31 -0
- package/dist/types/index-typedoc.js +32 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.js +5 -0
- package/dist/types/internal/beacon-query.d.ts +29 -0
- package/dist/types/internal/beacon-query.js +32 -0
- package/dist/types/internal/data-dt-config-scope.d.ts +10 -0
- package/dist/types/internal/data-dt-config-scope.js +12 -0
- package/dist/types/internal/feature-hashes.d.ts +19 -0
- package/dist/types/internal/feature-hashes.js +22 -0
- package/dist/types/internal/index.d.ts +3 -0
- package/dist/types/internal/index.js +4 -0
- package/dist/types/rum-events/event-context/event-context.d.ts +364 -0
- package/dist/types/rum-events/event-context/event-context.js +106 -0
- package/dist/types/rum-events/event-context/index.d.ts +1 -0
- package/dist/types/rum-events/event-context/index.js +2 -0
- package/dist/types/rum-events/event-updates.d.ts +4 -0
- package/dist/types/rum-events/event-updates.js +2 -0
- package/dist/types/rum-events/index.d.ts +19 -0
- package/dist/types/rum-events/index.js +20 -0
- package/dist/types/rum-events/json-event.d.ts +84 -0
- package/dist/types/rum-events/json-event.js +2 -0
- package/dist/types/rum-events/rum-biz-event.d.ts +10 -0
- package/dist/types/rum-events/rum-biz-event.js +15 -0
- package/dist/types/rum-events/rum-event.d.ts +13 -0
- package/dist/types/rum-events/rum-event.js +3 -0
- package/dist/types/rum-events/rum-internal-selfmonitoring-event.d.ts +114 -0
- package/dist/types/rum-events/rum-internal-selfmonitoring-event.js +99 -0
- package/dist/types/rum-events/rum-long-task-event.d.ts +18 -0
- package/dist/types/rum-events/rum-long-task-event.js +10 -0
- package/dist/types/rum-events/rum-page-summary-event.d.ts +370 -0
- package/dist/types/rum-events/rum-page-summary-event.js +184 -0
- package/dist/types/rum-events/rum-selfmonitoring-event.d.ts +39 -0
- package/dist/types/rum-events/rum-selfmonitoring-event.js +32 -0
- package/dist/types/rum-events/rum-session-properties-event.d.ts +9 -0
- package/dist/types/rum-events/rum-session-properties-event.js +3 -0
- package/dist/types/rum-events/rum-standalone-csp-rule-violation-event.d.ts +16 -0
- package/dist/types/rum-events/rum-standalone-csp-rule-violation-event.js +3 -0
- package/dist/types/rum-events/rum-standalone-exception-event.d.ts +16 -0
- package/dist/types/rum-events/rum-standalone-exception-event.js +2 -0
- package/dist/types/rum-events/rum-standalone-navigation-event.d.ts +23 -0
- package/dist/types/rum-events/rum-standalone-navigation-event.js +6 -0
- package/dist/types/rum-events/rum-user-action-event.d.ts +187 -0
- package/dist/types/rum-events/rum-user-action-event.js +78 -0
- package/dist/types/rum-events/rum-user-interaction-event.d.ts +302 -0
- package/dist/types/rum-events/rum-user-interaction-event.js +131 -0
- package/dist/types/rum-events/rum-visibility-change-event.d.ts +15 -0
- package/dist/types/rum-events/rum-visibility-change-event.js +6 -0
- package/dist/types/rum-events/rum-web-request-event.d.ts +269 -0
- package/dist/types/rum-events/rum-web-request-event.js +143 -0
- package/dist/types/rum-events/schema-versions.d.ts +4 -0
- package/dist/types/rum-events/schema-versions.js +5 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/csp-fields.d.ts +38 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/csp-fields.js +23 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/exception-fields.d.ts +26 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/exception-fields.js +19 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/general-rum-error-fields.d.ts +66 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/general-rum-error-fields.js +66 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/general-rum-event-fields.d.ts +142 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/general-rum-event-fields.js +98 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/http-namespace.d.ts +16 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/http-namespace.js +11 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/index.d.ts +9 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/index.js +10 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/navigation-fields.d.ts +48 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/navigation-fields.js +47 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/page-source-fields.d.ts +9 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/page-source-fields.js +5 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/request-fields.d.ts +14 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/request-fields.js +10 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/view-source-fields.d.ts +14 -0
- package/dist/types/rum-events/shared-namespaces-and-fields/view-source-fields.js +9 -0
- package/dist/types/user-actions/index.d.ts +3 -0
- package/dist/types/user-actions/index.js +4 -0
- package/dist/types/user-actions/user-action-end-event.d.ts +28 -0
- package/dist/types/user-actions/user-action-end-event.js +2 -0
- package/dist/types/user-actions/user-action-start-options.d.ts +23 -0
- package/dist/types/user-actions/user-action-start-options.js +2 -0
- package/dist/types/user-actions/user-action-tracker.d.ts +72 -0
- package/dist/types/user-actions/user-action-tracker.js +2 -0
- package/package.json +115 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
package/README.md
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
# @dynatrace/rum-javascript-sdk
|
|
2
|
+
|
|
3
|
+
A JavaScript API for interacting with the Dynatrace Real User Monitoring (RUM) JavaScript. This package provides both synchronous and asynchronous wrappers for the Dynatrace RUM API, along with TypeScript support and testing utilities.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @dynatrace/rum-javascript-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
This package provides two main API approaches for interacting with the Dynatrace RUM JavaScript, as well as types and a Playwright testing framework:
|
|
14
|
+
|
|
15
|
+
- **Synchronous API**: Safe wrapper functions that gracefully handle cases where the RUM JavaScript is not available
|
|
16
|
+
- **Asynchronous API**: Promise-based functions that wait for the RUM JavaScript to become available
|
|
17
|
+
- **User Actions API**: Manual control over user action creation and lifecycle (see [USERACTIONS.md](./USERACTIONS.md))
|
|
18
|
+
- **TypeScript Support**: Comprehensive type definitions for all RUM API functions
|
|
19
|
+
- **Testing Framework**: Playwright-based utilities for testing RUM integration
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Synchronous API (Recommended for most use cases)
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { sendEvent, identifyUser } from '@dynatrace/rum-javascript-sdk/api';
|
|
27
|
+
|
|
28
|
+
// Send a custom event - safely handles cases where RUM JavaScript is not loaded
|
|
29
|
+
sendEvent({
|
|
30
|
+
'event_properties.component_name': 'UserProfile',
|
|
31
|
+
'event_properties.action': 'view'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Identify the current user
|
|
35
|
+
identifyUser('user@example.com');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Asynchronous API (When you need to ensure RUM JavaScript is available)
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { sendEvent, identifyUser } from '@dynatrace/rum-javascript-sdk/api/promises';
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
// Wait for RUM JavaScript to be available (with 10s timeout by default)
|
|
45
|
+
await sendEvent({
|
|
46
|
+
'event_properties.component_name': 'UserProfile',
|
|
47
|
+
'event_properties.action': 'view'
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
await identifyUser('user@example.com');
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('RUM JavaScript not available:', error);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## API Reference
|
|
57
|
+
|
|
58
|
+
### Synchronous API (`@dynatrace/rum-javascript-sdk/api`)
|
|
59
|
+
|
|
60
|
+
The synchronous API provides safe wrapper functions that gracefully handle cases where the Dynatrace RUM JavaScript is not available. These functions will execute as no-ops if the JavaScript is not loaded, making them safe to use in any environment.
|
|
61
|
+
|
|
62
|
+
#### `sendEvent(fields, eventContext?): void`
|
|
63
|
+
|
|
64
|
+
Sends a custom event to Dynatrace RUM.
|
|
65
|
+
|
|
66
|
+
**Parameters:**
|
|
67
|
+
- `fields: ApiCreatedEventPropertiesEvent` - Event properties object. Must be serializable JSON with properties prefixed with `event_properties.`, plus optional `duration` and `start_time` properties.
|
|
68
|
+
- `eventContext?: unknown` - Optional context for event modification callbacks.
|
|
69
|
+
|
|
70
|
+
**Example:**
|
|
71
|
+
```typescript
|
|
72
|
+
import { sendEvent } from '@dynatrace/rum-javascript-sdk/api';
|
|
73
|
+
|
|
74
|
+
sendEvent({
|
|
75
|
+
'event_properties.page_name': 'checkout',
|
|
76
|
+
'event_properties.step': 'payment',
|
|
77
|
+
'event_properties.amount': 99.99,
|
|
78
|
+
'duration': 1500,
|
|
79
|
+
'start_time': Date.now()
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### `addEventModifier(eventModifier): Unsubscriber | undefined`
|
|
84
|
+
|
|
85
|
+
Registers a function to modify events before they are sent to Dynatrace.
|
|
86
|
+
|
|
87
|
+
**Parameters:**
|
|
88
|
+
- `eventModifier: (jsonEvent: Readonly<JSONEvent>, eventContext?: EventContext) => JSONEvent | null` - Function that receives an event and returns a modified version or null to cancel the event.
|
|
89
|
+
|
|
90
|
+
**Returns:**
|
|
91
|
+
- `Unsubscriber | undefined` - Function to remove the modifier, or undefined if the RUM JavaScript is not available.
|
|
92
|
+
|
|
93
|
+
**Example:**
|
|
94
|
+
```typescript
|
|
95
|
+
import { addEventModifier } from '@dynatrace/rum-javascript-sdk/api';
|
|
96
|
+
|
|
97
|
+
const unsubscribe = addEventModifier((event, context) => {
|
|
98
|
+
// Add user context to all events
|
|
99
|
+
return {
|
|
100
|
+
...event,
|
|
101
|
+
'event_properties.user_tier': 'premium'
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Later, remove the modifier
|
|
106
|
+
unsubscribe?.();
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### `runHealthCheck(config?): Promise<unknown[] | undefined> | undefined`
|
|
110
|
+
|
|
111
|
+
Runs a health check on the RUM JavaScript to diagnose potential issues.
|
|
112
|
+
|
|
113
|
+
**Parameters:**
|
|
114
|
+
- `config?: HealthCheckConfig` - Optional configuration object:
|
|
115
|
+
- `logVerbose?: boolean` - Include verbose information in the health check
|
|
116
|
+
- `returnDiagnosticData?: boolean` - Return diagnostic data as array instead of just logging
|
|
117
|
+
- `runDetailedOverrideCheck?: boolean` - Log additional information about overridden native APIs
|
|
118
|
+
|
|
119
|
+
**Returns:**
|
|
120
|
+
- `Promise<unknown[] | undefined> | undefined` - Promise resolving to diagnostic data (if requested), or undefined if the RUM JavaScript is not available.
|
|
121
|
+
|
|
122
|
+
**Example:**
|
|
123
|
+
```typescript
|
|
124
|
+
import { runHealthCheck } from '@dynatrace/rum-javascript-sdk/api';
|
|
125
|
+
|
|
126
|
+
const diagnostics = await runHealthCheck({
|
|
127
|
+
logVerbose: true,
|
|
128
|
+
returnDiagnosticData: true
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
if (diagnostics) {
|
|
132
|
+
console.log('RUM Health Check Results:', diagnostics);
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### `identifyUser(value): void`
|
|
137
|
+
|
|
138
|
+
Associates the current session with a specific user identifier.
|
|
139
|
+
|
|
140
|
+
**Parameters:**
|
|
141
|
+
- `value: string` - User identifier (name, email, user ID, etc.)
|
|
142
|
+
|
|
143
|
+
**Example:**
|
|
144
|
+
```typescript
|
|
145
|
+
import { identifyUser } from '@dynatrace/rum-javascript-sdk/api';
|
|
146
|
+
|
|
147
|
+
// Identify user after login
|
|
148
|
+
identifyUser('john.doe@example.com');
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### `sendSessionPropertyEvent(fields): void`
|
|
152
|
+
|
|
153
|
+
Sends session-level properties that will be attached to all subsequent events in the session.
|
|
154
|
+
|
|
155
|
+
**Parameters:**
|
|
156
|
+
- `fields: ApiCreatedSessionPropertiesEvent` - Session properties object. All keys must be prefixed with `session_properties.` and follow naming conventions (lowercase, numbers, underscores, dots).
|
|
157
|
+
|
|
158
|
+
**Example:**
|
|
159
|
+
```typescript
|
|
160
|
+
import { sendSessionPropertyEvent } from '@dynatrace/rum-javascript-sdk/api';
|
|
161
|
+
|
|
162
|
+
sendSessionPropertyEvent({
|
|
163
|
+
'session_properties.user_type': 'premium',
|
|
164
|
+
'session_properties.subscription_tier': 'gold',
|
|
165
|
+
'session_properties.region': 'us_east'
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### `sendExceptionEvent(error, fields?): void`
|
|
170
|
+
|
|
171
|
+
Sends an exception event. Marks the exception event with `characteristics.is_api_reported` and `error.source` = `api` to make it clear on DQL side where errors are coming from.
|
|
172
|
+
Only available if the Errors module is enabled.
|
|
173
|
+
|
|
174
|
+
**Parameters:**
|
|
175
|
+
|
|
176
|
+
- `error: Error` - The error object to report. Must be an instance of the standard JavaScript `Error` class.
|
|
177
|
+
- `fields: ApiCreatedEventPropertiesEvent` - Optional Event properties object. Must be serializable JSON with properties prefixed with `event_properties.`, plus optional `duration` and `start_time` properties.
|
|
178
|
+
|
|
179
|
+
**Example:**
|
|
180
|
+
```typescript
|
|
181
|
+
import { sendExceptionEvent } from '@dynatrace/rum-javascript-sdk/api';
|
|
182
|
+
|
|
183
|
+
const yourError = new Error("Your Error Message");
|
|
184
|
+
|
|
185
|
+
sendExceptionEvent(yourError);
|
|
186
|
+
```
|
|
187
|
+
```typescript
|
|
188
|
+
import { sendExceptionEvent } from '@dynatrace/rum-javascript-sdk/api';
|
|
189
|
+
|
|
190
|
+
const yourError = new Error("Your Error Message");
|
|
191
|
+
|
|
192
|
+
sendExceptionEvent(yourError, { "event_properties.component": "myExampleComponent" });
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Asynchronous API (`@dynatrace/rum-javascript-sdk/promises`)
|
|
196
|
+
|
|
197
|
+
The asynchronous API provides Promise-based functions that wait for the Dynatrace RUM JavaScript to become available. These functions will throw a `DynatraceError` if the RUM JavaScript is not available within the specified timeout. This is useful for scenarios where you don't want to
|
|
198
|
+
enable the RUM JavaScript before the user gives their consent.
|
|
199
|
+
|
|
200
|
+
#### `sendEvent(fields, eventContext?, timeout?): Promise<void>`
|
|
201
|
+
|
|
202
|
+
Async wrapper for sending custom events, with automatic waiting for RUM JavaScript availability.
|
|
203
|
+
|
|
204
|
+
**Parameters:**
|
|
205
|
+
- `fields: ApiCreatedEventPropertiesEvent` - Event properties object
|
|
206
|
+
- `eventContext?: unknown` - Optional context for event modification callbacks
|
|
207
|
+
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
208
|
+
|
|
209
|
+
**Throws:**
|
|
210
|
+
- `DynatraceError` - If RUM JavaScript is not available within timeout
|
|
211
|
+
|
|
212
|
+
**Example:**
|
|
213
|
+
```typescript
|
|
214
|
+
import { sendEvent } from '@dynatrace/rum-javascript-sdk/api/promises';
|
|
215
|
+
|
|
216
|
+
try {
|
|
217
|
+
await sendEvent({
|
|
218
|
+
'event_properties.conversion': 'purchase',
|
|
219
|
+
'event_properties.value': 149.99
|
|
220
|
+
}, undefined, 15000); // 15 second timeout
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error('Failed to send event:', error.message);
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
#### `addEventModifier(eventModifier, timeout?): Promise<Unsubscriber>`
|
|
227
|
+
|
|
228
|
+
Async wrapper for registering event modifiers, with automatic waiting for RUM JavaScript availability.
|
|
229
|
+
|
|
230
|
+
**Parameters:**
|
|
231
|
+
- `eventModifier: (jsonEvent: Readonly<JSONEvent>, eventContext?: EventContext) => JSONEvent | null` - Event modifier function
|
|
232
|
+
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
233
|
+
|
|
234
|
+
**Returns:**
|
|
235
|
+
- `Promise<Unsubscriber>` - Promise resolving to unsubscriber function
|
|
236
|
+
|
|
237
|
+
**Example:**
|
|
238
|
+
```typescript
|
|
239
|
+
import { addEventModifier } from '@dynatrace/rum-javascript-sdk/api/promises';
|
|
240
|
+
|
|
241
|
+
const unsubscribe = await addEventModifier((event) => ({
|
|
242
|
+
...event,
|
|
243
|
+
'event_properties.environment': 'production'
|
|
244
|
+
}));
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### `runHealthCheck(config?, timeout?): Promise<unknown[] | undefined>`
|
|
248
|
+
|
|
249
|
+
Async wrapper for running health checks, with automatic waiting for RUM JavaScript availability.
|
|
250
|
+
|
|
251
|
+
**Parameters:**
|
|
252
|
+
- `config?: HealthCheckConfig` - Optional health check configuration
|
|
253
|
+
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
254
|
+
|
|
255
|
+
**Returns:**
|
|
256
|
+
- `Promise<unknown[] | undefined>` - Promise resolving to diagnostic data
|
|
257
|
+
|
|
258
|
+
#### `identifyUser(value, timeout?): Promise<void>`
|
|
259
|
+
|
|
260
|
+
Async wrapper for user identification, with automatic waiting for RUM JavaScript availability.
|
|
261
|
+
|
|
262
|
+
**Parameters:**
|
|
263
|
+
- `value: string` - User identifier
|
|
264
|
+
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
265
|
+
|
|
266
|
+
#### `sendSessionPropertyEvent(fields, timeout?): Promise<void>`
|
|
267
|
+
|
|
268
|
+
Async wrapper for sending session properties, with automatic waiting for RUM JavaScript availability.
|
|
269
|
+
|
|
270
|
+
**Parameters:**
|
|
271
|
+
- `fields: ApiCreatedSessionPropertiesEvent` - Session properties object
|
|
272
|
+
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
273
|
+
|
|
274
|
+
#### `sendExceptionEvent(error, fields?): void`
|
|
275
|
+
|
|
276
|
+
Async wrapper for sending an exception event, with automatic waiting for RUM JavaScript availability.
|
|
277
|
+
Marks the exception event with `characteristics.is_api_reported` and `error.source` = `api` to make it clear on DQL side where errors are coming from.
|
|
278
|
+
Only available if the Errors module is enabled.
|
|
279
|
+
|
|
280
|
+
**Parameters:**
|
|
281
|
+
|
|
282
|
+
- `error: Error` - The error object to report. Must be an instance of the standard JavaScript `Error` class.
|
|
283
|
+
- `fields: ApiCreatedEventPropertiesEvent` - Optional Event properties object. Must be serializable JSON with properties prefixed with `event_properties.`, plus optional `duration` and `start_time` properties.
|
|
284
|
+
|
|
285
|
+
### User Actions API
|
|
286
|
+
|
|
287
|
+
Both synchronous and asynchronous wrappers are available for the User Actions API. For detailed documentation and examples, see [USERACTIONS.md](./USERACTIONS.md).
|
|
288
|
+
|
|
289
|
+
**Synchronous API:**
|
|
290
|
+
```typescript
|
|
291
|
+
import {
|
|
292
|
+
createUserAction,
|
|
293
|
+
subscribeToUserActions,
|
|
294
|
+
setAutomaticUserActionDetection,
|
|
295
|
+
getCurrentUserAction
|
|
296
|
+
} from '@dynatrace/rum-javascript-sdk/api';
|
|
297
|
+
|
|
298
|
+
// Create a manual user action
|
|
299
|
+
const userAction = createUserAction({ autoClose: false });
|
|
300
|
+
// perform work
|
|
301
|
+
userAction?.finish();
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Asynchronous API:**
|
|
305
|
+
```typescript
|
|
306
|
+
import { createUserAction } from '@dynatrace/rum-javascript-sdk/api/promises';
|
|
307
|
+
|
|
308
|
+
const userAction = await createUserAction({ autoClose: false });
|
|
309
|
+
// perform work
|
|
310
|
+
userAction.finish();
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Error Handling
|
|
314
|
+
|
|
315
|
+
### DynatraceError
|
|
316
|
+
|
|
317
|
+
Both APIs export a `DynatraceError` class for handling RUM-specific errors:
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
import { sendEvent, DynatraceError } from '@dynatrace/rum-javascript-sdk/promises';
|
|
321
|
+
|
|
322
|
+
try {
|
|
323
|
+
await sendEvent({ 'event_properties.test': 'value' });
|
|
324
|
+
} catch (error) {
|
|
325
|
+
if (error instanceof DynatraceError) {
|
|
326
|
+
console.error('RUM API Error:', error.message);
|
|
327
|
+
// Handle RUM-specific error
|
|
328
|
+
} else {
|
|
329
|
+
console.error('Unexpected error:', error);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## TypeScript Support
|
|
335
|
+
|
|
336
|
+
For detailed type information and usage examples, see [types.md](./types.md).
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
import type {
|
|
340
|
+
ApiCreatedEventPropertiesEvent,
|
|
341
|
+
ApiCreatedSessionPropertiesEvent,
|
|
342
|
+
HealthCheckConfig,
|
|
343
|
+
JSONEvent,
|
|
344
|
+
EventContext
|
|
345
|
+
} from '@dynatrace/rum-javascript-sdk/types';
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Testing
|
|
349
|
+
|
|
350
|
+
For testing applications that use this RUM API, see the testing framework documentation in [testing.md](./testing.md).
|
|
351
|
+
|
|
352
|
+
The testing framework provides Playwright fixtures for:
|
|
353
|
+
- Waiting for and validating RUM events
|
|
354
|
+
- Asserting on specific event properties
|
|
355
|
+
- Testing RUM integration in end-to-end scenarios
|
|
356
|
+
|
|
357
|
+
## Best Practices
|
|
358
|
+
|
|
359
|
+
### When to Use Synchronous vs Asynchronous API
|
|
360
|
+
|
|
361
|
+
**Use Synchronous API when:**
|
|
362
|
+
- You want graceful degradation when the RUM JavaScript is not available
|
|
363
|
+
- You're instrumenting existing code and don't want to change control flow
|
|
364
|
+
- You're okay with events being dropped if the RUM JavaScript isn't loaded
|
|
365
|
+
|
|
366
|
+
**Use Asynchronous API when:**
|
|
367
|
+
- You need to ensure events are actually sent
|
|
368
|
+
- You want to handle RUM JavaScript availability errors explicitly
|
|
369
|
+
- You're building critical instrumentation that must not fail silently
|
|
370
|
+
|
|
371
|
+
### Event Property Naming
|
|
372
|
+
|
|
373
|
+
Follow prefix custom event properties with `event_properties.`:
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
// ✅ Good - properties with prefix are accepted
|
|
377
|
+
sendEvent({
|
|
378
|
+
'event_properties.action': 'login',
|
|
379
|
+
'event_properties.method': 'oauth',
|
|
380
|
+
'event_properties.page_name': 'dashboard',
|
|
381
|
+
'event_properties.load_time': 1234
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
// ❌ Avoid - properties without prefix are ignored
|
|
385
|
+
sendEvent({
|
|
386
|
+
'action': 'click',
|
|
387
|
+
'data': 'some_value'
|
|
388
|
+
});
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Session Properties
|
|
392
|
+
|
|
393
|
+
Use session properties for data that applies to the entire user session:
|
|
394
|
+
|
|
395
|
+
```typescript
|
|
396
|
+
// Set once per session
|
|
397
|
+
sendSessionPropertyEvent({
|
|
398
|
+
'session_properties.subscription_type': 'premium',
|
|
399
|
+
'session_properties.region': 'europe',
|
|
400
|
+
'session_properties.app_version': '2.1.0'
|
|
401
|
+
});
|
|
402
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOG_PREFIX = "[Dynatrace RUM JavaScript API]";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const LOG_PREFIX = "[Dynatrace RUM JavaScript API]";
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc291cmNlL2FwaS9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHLGdDQUFnQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IExPR19QUkVGSVggPSBcIltEeW5hdHJhY2UgUlVNIEphdmFTY3JpcHQgQVBJXVwiO1xuIl19
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LOG_PREFIX } from "./constants.js";
|
|
2
|
+
export class DynatraceError extends Error {
|
|
3
|
+
constructor(message, cause) {
|
|
4
|
+
super(`${LOG_PREFIX} ${message}`, { cause });
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYXRyYWNlLWVycm9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc291cmNlL2FwaS9keW5hdHJhY2UtZXJyb3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRTVDLE1BQU0sT0FBTyxjQUFlLFNBQVEsS0FBSztJQUNyQyxZQUFZLE9BQWUsRUFBRSxLQUFlO1FBQ3hDLEtBQUssQ0FBQyxHQUFHLFVBQVUsSUFBSSxPQUFPLEVBQUUsRUFBRSxFQUFFLEtBQUssRUFBRSxDQUFDLENBQUM7SUFDakQsQ0FBQztDQUNKIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgTE9HX1BSRUZJWCB9IGZyb20gXCIuL2NvbnN0YW50cy5qc1wiO1xuXG5leHBvcnQgY2xhc3MgRHluYXRyYWNlRXJyb3IgZXh0ZW5kcyBFcnJvciB7XG4gICAgY29uc3RydWN0b3IobWVzc2FnZTogc3RyaW5nLCBjYXVzZT86IHVua25vd24pIHtcbiAgICAgICAgc3VwZXIoYCR7TE9HX1BSRUZJWH0gJHttZXNzYWdlfWAsIHsgY2F1c2UgfSk7XG4gICAgfVxufVxuIl19
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getGlobal(prop: keyof typeof globalThis): typeof globalThis[typeof prop];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export function getGlobal(prop) {
|
|
2
|
+
return globalThis[prop];
|
|
3
|
+
}
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xvYmFsLWFkYXB0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvYXBpL2dsb2JhbC1hZGFwdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sVUFBVSxTQUFTLENBQUMsSUFBNkI7SUFDbkQsT0FBTyxVQUFVLENBQUMsSUFBSSxDQUFDLENBQUM7QUFDNUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBnZXRHbG9iYWwocHJvcDoga2V5b2YgdHlwZW9mIGdsb2JhbFRoaXMpOiB0eXBlb2YgZ2xvYmFsVGhpc1t0eXBlb2YgcHJvcF0ge1xuICAgIHJldHVybiBnbG9iYWxUaGlzW3Byb3BdO1xufVxuIl19
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ApiCreatedEventPropertiesEvent, ApiCreatedSessionPropertiesEvent, EventContext, HealthCheckConfig, JSONEvent, Unsubscriber } from "../types/index.js";
|
|
2
|
+
export { DynatraceError } from "./dynatrace-error.js";
|
|
3
|
+
/**
|
|
4
|
+
* Safe wrapper for {@link dynatrace.sendEvent} which reverts to a noop if RUM JavaScript is not available.
|
|
5
|
+
*
|
|
6
|
+
* @param fields Must be a valid JSON object and cannot contain functions, undefined, Infinity and NaN as
|
|
7
|
+
* values, otherwise they will be replaced with null. The `fields` need to be serializable
|
|
8
|
+
* using JSON.stringify. The resulting event will be populated with `fields` parameter, and
|
|
9
|
+
* modified with additional properties, thus also empty objects are valid. Only properties
|
|
10
|
+
* prefixed with `event_properties.`, the `duration` property and the `start_time` property are
|
|
11
|
+
* allowed.
|
|
12
|
+
* @param eventContext An optional context that can be used to manipulate the
|
|
13
|
+
* result event within the modification callback.
|
|
14
|
+
*/
|
|
15
|
+
export declare function sendEvent(fields: ApiCreatedEventPropertiesEvent, eventContext?: unknown): void;
|
|
16
|
+
/**
|
|
17
|
+
* Safe wrapper for {@link dynatrace.addEventModifier} which reverts to a noop if RUM JavaScript is not available.
|
|
18
|
+
*
|
|
19
|
+
* @param eventModifier The modifier function to modify a given (readonly) JSONEvent. It receives an optional context
|
|
20
|
+
* depending on the type of event, if available. The returned event must be a new object, otherwise
|
|
21
|
+
* modification will be ignored.
|
|
22
|
+
* @returns The unsubscriber function to turn off event modification, or undefined if RUM JavaScript is not available.
|
|
23
|
+
*/
|
|
24
|
+
export declare function addEventModifier(eventModifier: (jsonEvent: Readonly<JSONEvent>, eventContext?: EventContext) => JSONEvent | null): Unsubscriber | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Safe wrapper for {@link dynatrace.runHealthCheck} which reverts to a noop if RUM JavaScript is not available.
|
|
27
|
+
*
|
|
28
|
+
* @param config The optional configuration object for the health check.
|
|
29
|
+
* @param config.logVerbose If true, verbose information is included in the health check.
|
|
30
|
+
* @param config.returnDiagnosticData If true, the diagnostic data is returned as array instead of just being logged.
|
|
31
|
+
* @param config.runDetailedOverrideCheck If true, additional information will be logged to the console for overridden native APIs.
|
|
32
|
+
* @returns A promise that settles as soon as the health check has been performed, or undefined if RUM JavaScript is not available.
|
|
33
|
+
*/
|
|
34
|
+
export declare function runHealthCheck(config?: HealthCheckConfig): Promise<unknown[] | undefined> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Safe wrapper for {@link dynatrace.identifyUser} which reverts to a noop if RUM JavaScript is not available.
|
|
37
|
+
*
|
|
38
|
+
* @param value The name of the user. For example, use a name, userid, or your user's email address.
|
|
39
|
+
*/
|
|
40
|
+
export declare function identifyUser(value: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Safe wrapper for {@link dynatrace.sendSessionPropertyEvent} which reverts to a noop if RUM JavaScript is not available.
|
|
43
|
+
*
|
|
44
|
+
* @param fields Must be a valid JSON object and cannot contain functions, undefined, Infinity and NaN as
|
|
45
|
+
* values, otherwise they will be replaced with null. The `fields` need to be serializable
|
|
46
|
+
* using JSON.stringify. All keys must be prefixed with "session_properties.*" and must contain only
|
|
47
|
+
* lower-case characters, numbers, underscores or dots. Each dot must be followed by a lower-case
|
|
48
|
+
* character. Each underscore must be followed by a lower-case character or number.
|
|
49
|
+
*/
|
|
50
|
+
export declare function sendSessionPropertyEvent(fields: ApiCreatedSessionPropertiesEvent): void;
|
|
51
|
+
/**
|
|
52
|
+
* This function is only available if the Error module is enabled
|
|
53
|
+
*
|
|
54
|
+
* @param error Must be a valid instance of the Error class. If an invalid value is provided, the error will not be processed or sent.
|
|
55
|
+
* @param fields Optional: Must be a valid JSON object and cannot contain functions, undefined, Infinity and NaN as
|
|
56
|
+
* values, otherwise they will be replaced with null. The `fields` need to be serializable
|
|
57
|
+
* using JSON.stringify. The resulting event will contain the provided `fields`, and is
|
|
58
|
+
* modified with additional properties, thus also empty objects are valid. Only properties
|
|
59
|
+
* prefixed with `event_properties.`, the `duration` property and the `start_time` property are
|
|
60
|
+
* allowed. String properties are limited to 5000 characters, exceeding characters are cut off.
|
|
61
|
+
* All event property keys must contain only alphabetic characters, numbers,
|
|
62
|
+
* underscores or dots. Each dot must be followed by an alphabetic character. Each underscore
|
|
63
|
+
* must be followed by an alphabetic character or number.
|
|
64
|
+
*/
|
|
65
|
+
export declare function sendExceptionEvent(error: Error, fields?: ApiCreatedEventPropertiesEvent): void;
|