@lmnr-ai/lmnr 0.6.12 → 0.6.13

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.mjs CHANGED
@@ -3,9 +3,9 @@ import { trace } from "@opentelemetry/api";
3
3
 
4
4
  // src/utils.ts
5
5
  import { TraceFlags } from "@opentelemetry/api";
6
- import path from "path";
6
+ import * as path from "path";
7
7
  import pino from "pino";
8
- import pinoPretty from "pino-pretty";
8
+ import { PinoPretty } from "pino-pretty";
9
9
  import { fileURLToPath } from "url";
10
10
  import { v4 as uuidv4 } from "uuid";
11
11
 
@@ -52,7 +52,7 @@ var LaminarAttributes = {
52
52
  function initializeLogger(options) {
53
53
  const colorize = options?.colorize ?? true;
54
54
  const level = options?.level ?? process.env.LMNR_LOG_LEVEL?.toLowerCase()?.trim() ?? "info";
55
- return pino(pinoPretty({
55
+ return pino(PinoPretty({
56
56
  colorize,
57
57
  minimumLevel: level
58
58
  }));
@@ -432,7 +432,7 @@ var AgentResource = class extends BaseResource {
432
432
  };
433
433
 
434
434
  // package.json
435
- var version = "0.6.12";
435
+ var version = "0.6.13";
436
436
 
437
437
  // src/version.ts
438
438
  var getLangVersion = () => {
@@ -1901,13 +1901,6 @@ var PlaywrightInstrumentation = class extends InstrumentationBase {
1901
1901
  await page.evaluate(() => {
1902
1902
  const HEARTBEAT_INTERVAL = 1e3;
1903
1903
  window.lmnrRrwebEventsBatch = /* @__PURE__ */ new Set();
1904
- window.lmnrPageIsFocused = true;
1905
- window.addEventListener("blur", () => {
1906
- window.lmnrPageIsFocused = false;
1907
- });
1908
- window.addEventListener("focus", () => {
1909
- window.lmnrPageIsFocused = true;
1910
- });
1911
1904
  const compressEventData = async (data) => {
1912
1905
  const jsonString = JSON.stringify(data);
1913
1906
  const blob = new Blob([jsonString], { type: "application/json" });
@@ -1922,9 +1915,6 @@ var PlaywrightInstrumentation = class extends InstrumentationBase {
1922
1915
  return Array.from(events);
1923
1916
  };
1924
1917
  setInterval(() => {
1925
- if (!window.lmnrPageIsFocused) {
1926
- return;
1927
- }
1928
1918
  window.lmnrRrweb.record.addCustomEvent("heartbeat", {
1929
1919
  title: document.title,
1930
1920
  url: document.URL
@@ -1932,15 +1922,15 @@ var PlaywrightInstrumentation = class extends InstrumentationBase {
1932
1922
  }, HEARTBEAT_INTERVAL);
1933
1923
  window.lmnrRrweb.record({
1934
1924
  async emit(event) {
1935
- if (!window.lmnrPageIsFocused) {
1936
- return;
1937
- }
1938
1925
  const compressedEvent = {
1939
1926
  ...event,
1940
1927
  data: await compressEventData(event.data)
1941
1928
  };
1942
1929
  window.lmnrRrwebEventsBatch.add(compressedEvent);
1943
- }
1930
+ },
1931
+ recordCanvas: true,
1932
+ collectFonts: true,
1933
+ recordCrossOriginIframes: true
1944
1934
  });
1945
1935
  });
1946
1936
  });
@@ -2876,13 +2866,6 @@ var PuppeteerInstrumentation = class extends InstrumentationBase3 {
2876
2866
  await page.evaluate(() => {
2877
2867
  const HEARTBEAT_INTERVAL = 1e3;
2878
2868
  window.lmnrRrwebEventsBatch = /* @__PURE__ */ new Set();
2879
- window.lmnrPageIsFocused = true;
2880
- window.addEventListener("blur", () => {
2881
- window.lmnrPageIsFocused = false;
2882
- });
2883
- window.addEventListener("focus", () => {
2884
- window.lmnrPageIsFocused = true;
2885
- });
2886
2869
  const compressEventData = async (data) => {
2887
2870
  const jsonString = JSON.stringify(data);
2888
2871
  const blob = new Blob([jsonString], { type: "application/json" });
@@ -2897,9 +2880,6 @@ var PuppeteerInstrumentation = class extends InstrumentationBase3 {
2897
2880
  return Array.from(events);
2898
2881
  };
2899
2882
  setInterval(() => {
2900
- if (!window.lmnrPageIsFocused) {
2901
- return;
2902
- }
2903
2883
  window.lmnrRrweb.record.addCustomEvent("heartbeat", {
2904
2884
  title: document.title,
2905
2885
  url: document.URL
@@ -2907,15 +2887,15 @@ var PuppeteerInstrumentation = class extends InstrumentationBase3 {
2907
2887
  }, HEARTBEAT_INTERVAL);
2908
2888
  window.lmnrRrweb.record({
2909
2889
  async emit(event) {
2910
- if (!window.lmnrPageIsFocused) {
2911
- return;
2912
- }
2913
2890
  const compressedEvent = {
2914
2891
  ...event,
2915
2892
  data: await compressEventData(event.data)
2916
2893
  };
2917
2894
  window.lmnrRrwebEventsBatch.add(compressedEvent);
2918
- }
2895
+ },
2896
+ recordCanvas: true,
2897
+ collectFonts: true,
2898
+ recordCrossOriginIframes: true
2919
2899
  });
2920
2900
  });
2921
2901
  });
@@ -3384,10 +3364,11 @@ function observeBase({
3384
3364
  }, fn, thisArg, ...args) {
3385
3365
  let entityContext = context4.active();
3386
3366
  const currentAssociationProperties = entityContext.getValue(ASSOCIATION_PROPERTIES_KEY);
3367
+ const { "span_type": spanType, ...rest } = associationProperties ?? {};
3387
3368
  if (associationProperties) {
3388
3369
  entityContext = entityContext.setValue(
3389
3370
  ASSOCIATION_PROPERTIES_KEY,
3390
- { ...currentAssociationProperties ?? {}, ...associationProperties }
3371
+ { ...currentAssociationProperties ?? {}, ...rest }
3391
3372
  );
3392
3373
  }
3393
3374
  if (parentSpanContext) {
@@ -3404,6 +3385,9 @@ function observeBase({
3404
3385
  {},
3405
3386
  entityContext,
3406
3387
  async (span) => {
3388
+ if (spanType) {
3389
+ span.setAttribute(SPAN_TYPE, spanType);
3390
+ }
3407
3391
  if (shouldSendTraces() && !ignoreInput) {
3408
3392
  try {
3409
3393
  const spanInput = inputParameters ?? args;
@@ -3427,12 +3411,7 @@ function observeBase({
3427
3411
  logger8.warn(`Failed to serialize input: ${error instanceof Error ? error.message : String(error)}`);
3428
3412
  }
3429
3413
  }
3430
- const { "span_type": spanType, ...rest } = associationProperties ?? {};
3431
- entityContext = entityContext.setValue(
3432
- ASSOCIATION_PROPERTIES_KEY,
3433
- { ...currentAssociationProperties ?? {}, ...rest }
3434
- );
3435
- Object.entries(rest).forEach(([key, value]) => {
3414
+ Object.entries(associationProperties || {}).forEach(([key, value]) => {
3436
3415
  if (isOtelAttributeValueType(value)) {
3437
3416
  span.setAttribute(key, value);
3438
3417
  } else {
@@ -3594,7 +3573,7 @@ function withTracingLevel(tracingLevel, fn, ...args) {
3594
3573
 
3595
3574
  // src/evaluations.ts
3596
3575
  import { trace as trace8 } from "@opentelemetry/api";
3597
- import cliProgress from "cli-progress";
3576
+ import * as cliProgress from "cli-progress";
3598
3577
  var DEFAULT_CONCURRENCY = 5;
3599
3578
  var MAX_EXPORT_BATCH_SIZE = 64;
3600
3579
  var logger9 = initializeLogger();