@dash0/sdk-web 0.16.2 → 0.17.0
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/README.md +3 -3
- package/dist/dash0.iife.js +1 -1
- package/dist/dash0.iife.js.map +1 -1
- package/dist/dash0.js +1 -1
- package/dist/dash0.js.map +1 -1
- package/dist/dash0.umd.cjs +1 -1
- package/dist/dash0.umd.cjs.map +1 -1
- package/dist/modules/api/init.js +1 -0
- package/dist/modules/instrumentations/errors/unhandled-error.js +1 -1
- package/dist/modules/instrumentations/http/fetch.js +3 -1
- package/dist/modules/transport/fetch.js +1 -1
- package/dist/modules/utils/wrap.js +1 -0
- package/dist/modules/vars.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types/errors.d.ts +5 -0
- package/dist/types/types/options.d.ts +1 -1
- package/dist/types/vars.d.ts +5 -0
- package/package.json +1 -1
- package/src/api/init.ts +1 -0
- package/src/instrumentations/errors/unhandled-error.ts +1 -1
- package/src/instrumentations/http/fetch.ts +13 -1
- package/src/transport/fetch.ts +1 -1
- package/src/types/errors.ts +6 -0
- package/src/types/options.ts +1 -0
- package/src/utils/wrap.ts +1 -0
- package/src/vars.ts +7 -0
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
debug,
|
|
3
|
+
observeResourcePerformance,
|
|
4
|
+
perf,
|
|
5
|
+
win,
|
|
6
|
+
setTimeout,
|
|
7
|
+
isSameOrigin,
|
|
8
|
+
wrap,
|
|
9
|
+
parseUrl,
|
|
10
|
+
clearTimeout,
|
|
11
|
+
} from "../../utils";
|
|
2
12
|
import { isUrlIgnored, matchesAny } from "../../utils/ignore-rules";
|
|
3
13
|
import {
|
|
4
14
|
addAttribute,
|
|
@@ -156,6 +166,8 @@ function isGraphQLQuery(input: RequestInfo | URL, init?: RequestInit) {
|
|
|
156
166
|
|
|
157
167
|
function tryCaptureHttpHeaders(headers: Headers, span: InProgressSpan, getAttributeKey: (headerKey: string) => string) {
|
|
158
168
|
try {
|
|
169
|
+
if (!vars.headersToCapture.length) return;
|
|
170
|
+
|
|
159
171
|
headers.forEach((value, key) => {
|
|
160
172
|
if (vars.headersToCapture.some((rxp) => rxp.test(key))) {
|
|
161
173
|
addAttribute(span.attributes, getAttributeKey(key), value);
|
package/src/transport/fetch.ts
CHANGED
|
@@ -12,7 +12,7 @@ export async function send(path: string, body: unknown): Promise<void> {
|
|
|
12
12
|
let isCompressed = false;
|
|
13
13
|
|
|
14
14
|
// Try to compress if supported
|
|
15
|
-
if (typeof CompressionStream !== "undefined") {
|
|
15
|
+
if (typeof CompressionStream !== "undefined" && vars.enableTransportCompression) {
|
|
16
16
|
requestBody = await compressWithGzip(jsonString);
|
|
17
17
|
byteLength = requestBody.byteLength;
|
|
18
18
|
isCompressed = true;
|
package/src/types/errors.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { KeyValue } from "./otlp";
|
|
2
|
+
|
|
1
3
|
export type ErrorLike = {
|
|
2
4
|
message: string;
|
|
3
5
|
name?: string;
|
|
@@ -6,4 +8,8 @@ export type ErrorLike = {
|
|
|
6
8
|
|
|
7
9
|
export type ReportErrorOpts = {
|
|
8
10
|
componentStack: string | null | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Additional attributes to add to the error span
|
|
13
|
+
*/
|
|
14
|
+
attributes?: KeyValue[];
|
|
9
15
|
};
|
package/src/types/options.ts
CHANGED
package/src/utils/wrap.ts
CHANGED
package/src/vars.ts
CHANGED
|
@@ -165,6 +165,12 @@ export type Vars = {
|
|
|
165
165
|
urlAttributeScrubber: UrlAttributeScrubber;
|
|
166
166
|
|
|
167
167
|
pageViewInstrumentation: PageViewInstrumentationSettings;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Enables telemetry transport compression using gzip.
|
|
171
|
+
* experimental - in rare cases causes Chrome to crash to use at your own risk.
|
|
172
|
+
*/
|
|
173
|
+
enableTransportCompression: boolean;
|
|
168
174
|
};
|
|
169
175
|
|
|
170
176
|
export const vars: Vars = {
|
|
@@ -191,4 +197,5 @@ export const vars: Vars = {
|
|
|
191
197
|
trackVirtualPageViews: true,
|
|
192
198
|
includeParts: [],
|
|
193
199
|
},
|
|
200
|
+
enableTransportCompression: false,
|
|
194
201
|
};
|