retrace-sdk 0.13.0 → 0.13.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/transport.js +5 -2
- package/package.json +1 -1
package/dist/transport.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import WebSocket from "ws";
|
|
2
2
|
import { getConfig } from "./config.js";
|
|
3
3
|
import { classifyServerSignal } from "./errors.js";
|
|
4
|
+
// Client identifier sent on every request so the backend can attribute SDK usage/version.
|
|
5
|
+
// Keep in sync with package.json on release.
|
|
6
|
+
const CLIENT_ID = "typescript-sdk/0.13.1";
|
|
4
7
|
export class WSTransport {
|
|
5
8
|
ws = null;
|
|
6
9
|
connected = false;
|
|
@@ -265,7 +268,7 @@ export class WSTransport {
|
|
|
265
268
|
try {
|
|
266
269
|
await fetch(`${cfg.baseUrl}/api/v1/traces`, {
|
|
267
270
|
method: "POST",
|
|
268
|
-
headers: { "x-retrace-key": cfg.apiKey, "Content-Type": "application/json" },
|
|
271
|
+
headers: { "x-retrace-key": cfg.apiKey, "Content-Type": "application/json", "x-retrace-client": CLIENT_ID },
|
|
269
272
|
body,
|
|
270
273
|
keepalive: true,
|
|
271
274
|
signal: ctrl.signal,
|
|
@@ -310,7 +313,7 @@ export class HTTPTransport {
|
|
|
310
313
|
try {
|
|
311
314
|
const res = await fetch(url, {
|
|
312
315
|
method: "POST",
|
|
313
|
-
headers: { "x-retrace-key": cfg.apiKey, "Content-Type": "application/json" },
|
|
316
|
+
headers: { "x-retrace-key": cfg.apiKey, "Content-Type": "application/json", "x-retrace-client": CLIENT_ID },
|
|
314
317
|
body: payload,
|
|
315
318
|
});
|
|
316
319
|
if (res.ok)
|