@mastra/observability 1.4.0-alpha.0 → 1.4.0-alpha.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/index.js CHANGED
@@ -18286,7 +18286,10 @@ var BaseSpan = class {
18286
18286
  this.name = options.name;
18287
18287
  this.type = options.type;
18288
18288
  this.attributes = deepClean(options.attributes, this.deepCleanOptions) || {};
18289
- this.metadata = deepClean(options.metadata, this.deepCleanOptions);
18289
+ this.metadata = deepClean(
18290
+ options.parent?.metadata || options.metadata ? { ...options.parent?.metadata, ...options.metadata } : void 0,
18291
+ this.deepCleanOptions
18292
+ );
18290
18293
  if (options.requestContext && options.requestContext.size() > 0) {
18291
18294
  this.requestContext = deepClean(options.requestContext.all, this.deepCleanOptions);
18292
18295
  }
@@ -18524,26 +18527,27 @@ var DefaultSpan = class extends BaseSpan {
18524
18527
  });
18525
18528
  }
18526
18529
  };
18527
- function generateSpanId() {
18528
- const bytes = new Uint8Array(8);
18529
- if (typeof crypto !== "undefined" && crypto.getRandomValues) {
18530
- crypto.getRandomValues(bytes);
18531
- } else {
18532
- for (let i = 0; i < 8; i++) {
18533
- bytes[i] = Math.floor(Math.random() * 256);
18530
+ function fillRandomBytes(bytes) {
18531
+ try {
18532
+ const webCrypto = globalThis.crypto;
18533
+ if (webCrypto?.getRandomValues) {
18534
+ webCrypto.getRandomValues.call(webCrypto, bytes);
18535
+ return;
18534
18536
  }
18537
+ } catch {
18535
18538
  }
18539
+ for (let i = 0; i < bytes.length; i++) {
18540
+ bytes[i] = Math.floor(Math.random() * 256);
18541
+ }
18542
+ }
18543
+ function generateSpanId() {
18544
+ const bytes = new Uint8Array(8);
18545
+ fillRandomBytes(bytes);
18536
18546
  return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
18537
18547
  }
18538
18548
  function generateTraceId() {
18539
18549
  const bytes = new Uint8Array(16);
18540
- if (typeof crypto !== "undefined" && crypto.getRandomValues) {
18541
- crypto.getRandomValues(bytes);
18542
- } else {
18543
- for (let i = 0; i < 16; i++) {
18544
- bytes[i] = Math.floor(Math.random() * 256);
18545
- }
18546
- }
18550
+ fillRandomBytes(bytes);
18547
18551
  return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
18548
18552
  }
18549
18553
  function isValidTraceId(traceId) {