@obtrace/browser 1.0.0 → 2.0.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 CHANGED
@@ -21,7 +21,6 @@ import { initBrowserSDK } from "@obtrace/sdk-browser/browser";
21
21
 
22
22
  const sdk = initBrowserSDK({
23
23
  apiKey: "obt_live_...",
24
- ingestBaseUrl: "https://ingest.obtrace.io",
25
24
  serviceName: "web-app",
26
25
  });
27
26
  ```
@@ -35,7 +34,6 @@ import { initBrowserSDK, SemanticMetrics } from "@obtrace/sdk-browser/browser";
35
34
 
36
35
  const sdk = initBrowserSDK({
37
36
  apiKey: "<API_KEY>",
38
- ingestBaseUrl: "https://inject.obtrace.ai",
39
37
  serviceName: "web-app",
40
38
  tenantId: "tenant-prod",
41
39
  projectId: "project-prod",
package/dist/auto.js CHANGED
@@ -63,11 +63,11 @@ function merge(...sources) {
63
63
  }
64
64
  }
65
65
  }
66
- if (!merged.apiKey || !merged.ingestBaseUrl)
66
+ if (!merged.apiKey)
67
67
  return null;
68
68
  return {
69
69
  apiKey: merged.apiKey,
70
- ingestBaseUrl: merged.ingestBaseUrl,
70
+ ingestBaseUrl: merged.ingestBaseUrl || "https://ingest.obtrace.ai",
71
71
  serviceName: merged.serviceName || "web-app",
72
72
  appId: merged.appId,
73
73
  env: merged.env || "production",
@@ -148,6 +148,7 @@ function userAttrs() {
148
148
  return attrs;
149
149
  }
150
150
  export function initBrowserSDK(config) {
151
+ config.ingestBaseUrl = config.ingestBaseUrl || "https://ingest.obtrace.ai";
151
152
  for (const entry of instances) {
152
153
  if (entry.config.apiKey === config.apiKey && entry.config.ingestBaseUrl === config.ingestBaseUrl && entry.config.serviceName === config.serviceName) {
153
154
  return entry.sdk;
@@ -191,7 +192,7 @@ export function initBrowserSDK(config) {
191
192
  },
192
193
  body: JSON.stringify({
193
194
  sdk: "@obtrace/browser",
194
- sdk_version: "1.0.0",
195
+ sdk_version: "2.0.0",
195
196
  service_name: config.serviceName,
196
197
  service_version: config.serviceVersion ?? "",
197
198
  runtime: "browser",
@@ -13622,9 +13622,10 @@ var ObtraceClient = class {
13622
13622
  active = true;
13623
13623
  replayTimer = null;
13624
13624
  constructor(config) {
13625
- if (!config.apiKey || !config.ingestBaseUrl || !config.serviceName) {
13626
- throw new Error("apiKey, ingestBaseUrl and serviceName are required");
13625
+ if (!config.apiKey || !config.serviceName) {
13626
+ throw new Error("apiKey and serviceName are required");
13627
13627
  }
13628
+ config.ingestBaseUrl = config.ingestBaseUrl || "https://ingest.obtrace.ai";
13628
13629
  this.config = {
13629
13630
  requestTimeoutMs: 5e3,
13630
13631
  defaultHeaders: {},
@@ -27767,7 +27768,7 @@ patchBrowser(Zone$1);
27767
27768
 
27768
27769
  // src/core/otel-web-setup.ts
27769
27770
  function setupOtelWeb(config) {
27770
- const baseUrl = config.ingestBaseUrl.replace(/\/$/, "");
27771
+ const baseUrl = (config.ingestBaseUrl || "https://ingest.obtrace.ai").replace(/\/$/, "");
27771
27772
  const authHeaders = {
27772
27773
  Authorization: `Bearer ${config.apiKey}`,
27773
27774
  ...config.appId ? { "X-Obtrace-App-ID": config.appId } : {},
@@ -28515,6 +28516,7 @@ function userAttrs() {
28515
28516
  return attrs;
28516
28517
  }
28517
28518
  function initBrowserSDK(config) {
28519
+ config.ingestBaseUrl = config.ingestBaseUrl || "https://ingest.obtrace.ai";
28518
28520
  for (const entry2 of instances) {
28519
28521
  if (entry2.config.apiKey === config.apiKey && entry2.config.ingestBaseUrl === config.ingestBaseUrl && entry2.config.serviceName === config.serviceName) {
28520
28522
  return entry2.sdk;
@@ -28558,7 +28560,7 @@ function initBrowserSDK(config) {
28558
28560
  },
28559
28561
  body: JSON.stringify({
28560
28562
  sdk: "@obtrace/browser",
28561
- sdk_version: "1.0.0",
28563
+ sdk_version: "2.0.0",
28562
28564
  service_name: config.serviceName,
28563
28565
  service_version: config.serviceVersion ?? "",
28564
28566
  runtime: "browser",