@dxos/tracing 0.8.3-staging.0fa589b → 0.8.4-main.1da679c

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.
@@ -1,50 +1,63 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
 
3
- // packages/common/tracing/src/api.ts
3
+ // src/api.ts
4
4
  import { Context as Context2 } from "@dxos/context";
5
5
 
6
- // packages/common/tracing/src/symbols.ts
6
+ // src/symbols.ts
7
7
  var symbolTracingContext = Symbol("dxos.tracing.context");
8
8
  var getTracingContext = (target) => {
9
- return target[symbolTracingContext] ??= {
9
+ var _target, _symbolTracingContext;
10
+ return (_target = target)[_symbolTracingContext = symbolTracingContext] ?? (_target[_symbolTracingContext] = {
10
11
  infoProperties: {},
11
12
  metricsProperties: {}
12
- };
13
+ });
13
14
  };
14
15
  var TRACE_SPAN_ATTRIBUTE = "dxos.trace-span";
15
16
 
16
- // packages/common/tracing/src/trace-processor.ts
17
+ // src/trace-processor.ts
17
18
  import { unrefTimeout } from "@dxos/async";
18
19
  import { LogLevel, getContextFromEntry, log } from "@dxos/log";
19
20
  import { getPrototypeSpecificInstanceId } from "@dxos/util";
20
21
 
21
- // packages/common/tracing/src/diagnostic.ts
22
+ // src/diagnostic.ts
22
23
  import { asyncTimeout } from "@dxos/async";
23
24
  import { invariant } from "@dxos/invariant";
24
25
 
25
- // packages/common/tracing/src/util.ts
26
+ // src/util.ts
26
27
  var createId = () => Math.random().toString(36).slice(2);
27
28
 
28
- // packages/common/tracing/src/diagnostic.ts
29
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/common/tracing/src/diagnostic.ts";
29
+ // src/diagnostic.ts
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
43
+ var __dxlog_file = "/__w/dxos/dxos/packages/common/tracing/src/diagnostic.ts";
30
44
  var DIAGNOSTICS_TIMEOUT = 1e4;
31
45
  var TraceDiagnosticImpl = class {
46
+ unregister() {
47
+ this._onUnregister();
48
+ }
32
49
  constructor(id, fetch, name, _onUnregister) {
50
+ _define_property(this, "id", void 0);
51
+ _define_property(this, "fetch", void 0);
52
+ _define_property(this, "name", void 0);
53
+ _define_property(this, "_onUnregister", void 0);
33
54
  this.id = id;
34
55
  this.fetch = fetch;
35
56
  this.name = name;
36
57
  this._onUnregister = _onUnregister;
37
58
  }
38
- unregister() {
39
- this._onUnregister();
40
- }
41
59
  };
42
60
  var DiagnosticsManager = class {
43
- constructor() {
44
- this.instanceId = createId();
45
- this.registry = /* @__PURE__ */ new Map();
46
- this._instanceTag = null;
47
- }
48
61
  get instanceTag() {
49
62
  return this._instanceTag;
50
63
  }
@@ -107,32 +120,37 @@ var DiagnosticsManager = class {
107
120
  };
108
121
  }
109
122
  }
123
+ constructor() {
124
+ _define_property(this, "instanceId", createId());
125
+ _define_property(this, "registry", /* @__PURE__ */ new Map());
126
+ _define_property(this, "_instanceTag", null);
127
+ }
110
128
  };
111
129
 
112
- // packages/common/tracing/src/diagnostics-channel.ts
130
+ // src/diagnostics-channel.ts
113
131
  import { Trigger, sleep } from "@dxos/async";
114
132
  import { Context } from "@dxos/context";
115
133
  import { invariant as invariant2 } from "@dxos/invariant";
116
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/common/tracing/src/diagnostics-channel.ts";
134
+ function _define_property2(obj, key, value) {
135
+ if (key in obj) {
136
+ Object.defineProperty(obj, key, {
137
+ value,
138
+ enumerable: true,
139
+ configurable: true,
140
+ writable: true
141
+ });
142
+ } else {
143
+ obj[key] = value;
144
+ }
145
+ return obj;
146
+ }
147
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/common/tracing/src/diagnostics-channel.ts";
117
148
  var DEFAULT_CHANNEL_NAME = "dxos-diagnostics";
118
149
  var DISCOVER_TIME = 500;
119
150
  var DiagnosticsChannel = class _DiagnosticsChannel {
120
151
  static get supported() {
121
152
  return globalThis.BroadcastChannel != null;
122
153
  }
123
- constructor(_channelName = DEFAULT_CHANNEL_NAME) {
124
- this._channelName = _channelName;
125
- this._ctx = new Context(void 0, {
126
- F: __dxlog_file2,
127
- L: 46
128
- });
129
- this._serveChannel = void 0;
130
- this._clientChannel = void 0;
131
- if (_DiagnosticsChannel.supported) {
132
- this._serveChannel = new BroadcastChannel(_channelName);
133
- this._clientChannel = new BroadcastChannel(_channelName);
134
- }
135
- }
136
154
  destroy() {
137
155
  void this._ctx.dispose();
138
156
  this._serveChannel?.close();
@@ -258,13 +276,40 @@ var DiagnosticsChannel = class _DiagnosticsChannel {
258
276
  this._clientChannel.removeEventListener("message", listener);
259
277
  }
260
278
  }
279
+ constructor(_channelName = DEFAULT_CHANNEL_NAME) {
280
+ _define_property2(this, "_channelName", void 0);
281
+ _define_property2(this, "_ctx", void 0);
282
+ _define_property2(this, "_serveChannel", void 0);
283
+ _define_property2(this, "_clientChannel", void 0);
284
+ this._channelName = _channelName;
285
+ this._ctx = new Context(void 0, {
286
+ F: __dxlog_file2,
287
+ L: 46
288
+ });
289
+ this._serveChannel = void 0;
290
+ this._clientChannel = void 0;
291
+ if (_DiagnosticsChannel.supported) {
292
+ this._serveChannel = new BroadcastChannel(_channelName);
293
+ this._clientChannel = new BroadcastChannel(_channelName);
294
+ }
295
+ }
261
296
  };
262
297
 
263
- // packages/common/tracing/src/remote/metrics.ts
264
- var RemoteMetrics = class {
265
- constructor() {
266
- this._metrics = /* @__PURE__ */ new Set();
298
+ // src/remote/metrics.ts
299
+ function _define_property3(obj, key, value) {
300
+ if (key in obj) {
301
+ Object.defineProperty(obj, key, {
302
+ value,
303
+ enumerable: true,
304
+ configurable: true,
305
+ writable: true
306
+ });
307
+ } else {
308
+ obj[key] = value;
267
309
  }
310
+ return obj;
311
+ }
312
+ var RemoteMetrics = class {
268
313
  registerProcessor(processor) {
269
314
  this._metrics.add(processor);
270
315
  }
@@ -280,13 +325,26 @@ var RemoteMetrics = class {
280
325
  gauge(name, value, data) {
281
326
  return Array.from(this._metrics.values()).map((processor) => processor.gauge(name, value, data));
282
327
  }
328
+ constructor() {
329
+ _define_property3(this, "_metrics", /* @__PURE__ */ new Set());
330
+ }
283
331
  };
284
332
 
285
- // packages/common/tracing/src/remote/tracing.ts
286
- var RemoteTracing = class {
287
- constructor() {
288
- this._spanMap = /* @__PURE__ */ new Map();
333
+ // src/remote/tracing.ts
334
+ function _define_property4(obj, key, value) {
335
+ if (key in obj) {
336
+ Object.defineProperty(obj, key, {
337
+ value,
338
+ enumerable: true,
339
+ configurable: true,
340
+ writable: true
341
+ });
342
+ } else {
343
+ obj[key] = value;
289
344
  }
345
+ return obj;
346
+ }
347
+ var RemoteTracing = class {
290
348
  registerProcessor(processor) {
291
349
  this._tracing = processor;
292
350
  }
@@ -309,14 +367,28 @@ var RemoteTracing = class {
309
367
  }
310
368
  }
311
369
  }
370
+ constructor() {
371
+ _define_property4(this, "_tracing", void 0);
372
+ _define_property4(this, "_spanMap", /* @__PURE__ */ new Map());
373
+ }
312
374
  };
313
375
 
314
- // packages/common/tracing/src/trace-sender.ts
376
+ // src/trace-sender.ts
315
377
  import { Stream } from "@dxos/codec-protobuf/stream";
316
- var TraceSender = class {
317
- constructor(_traceProcessor) {
318
- this._traceProcessor = _traceProcessor;
378
+ function _define_property5(obj, key, value) {
379
+ if (key in obj) {
380
+ Object.defineProperty(obj, key, {
381
+ value,
382
+ enumerable: true,
383
+ configurable: true,
384
+ writable: true
385
+ });
386
+ } else {
387
+ obj[key] = value;
319
388
  }
389
+ return obj;
390
+ }
391
+ var TraceSender = class {
320
392
  streamTrace(request) {
321
393
  return new Stream(({ ctx, next }) => {
322
394
  const flushEvents = (resources, spans2, logs) => {
@@ -398,31 +470,53 @@ var TraceSender = class {
398
470
  flushEvents(null, null, null);
399
471
  });
400
472
  }
473
+ constructor(_traceProcessor) {
474
+ _define_property5(this, "_traceProcessor", void 0);
475
+ this._traceProcessor = _traceProcessor;
476
+ }
401
477
  };
402
478
 
403
- // packages/common/tracing/src/weak-ref.ts
479
+ // src/weak-ref.ts
404
480
  var WeakRefMock = class {
405
- // eslint-disable-next-line @typescript-eslint/no-useless-constructor
406
- constructor(target) {
407
- }
408
481
  deref() {
409
482
  return void 0;
410
483
  }
484
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
485
+ constructor(target) {
486
+ }
411
487
  };
412
488
  var WeakRef = globalThis.WeakRef ?? WeakRefMock;
413
489
 
414
- // packages/common/tracing/src/trace-processor.ts
415
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/common/tracing/src/trace-processor.ts";
490
+ // src/trace-processor.ts
491
+ function _define_property6(obj, key, value) {
492
+ if (key in obj) {
493
+ Object.defineProperty(obj, key, {
494
+ value,
495
+ enumerable: true,
496
+ configurable: true,
497
+ writable: true
498
+ });
499
+ } else {
500
+ obj[key] = value;
501
+ }
502
+ return obj;
503
+ }
504
+ var _globalThis;
505
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/common/tracing/src/trace-processor.ts";
416
506
  var ResourceEntry = class {
507
+ getMetric(name) {
508
+ return this.data.metrics?.find((metric) => metric.name === name);
509
+ }
417
510
  constructor(data, instance, annotation) {
511
+ _define_property6(this, "data", void 0);
512
+ _define_property6(this, "instance", void 0);
513
+ _define_property6(this, "annotation", void 0);
514
+ _define_property6(this, "sanitizedClassName", void 0);
418
515
  this.data = data;
419
516
  this.instance = instance;
420
517
  this.annotation = annotation;
421
518
  this.sanitizedClassName = sanitizeClassName(data.className);
422
519
  }
423
- getMetric(name) {
424
- return this.data.metrics?.find((metric) => metric.name === name);
425
- }
426
520
  };
427
521
  var MAX_RESOURCE_RECORDS = 2e3;
428
522
  var MAX_SPAN_RECORDS = 1e3;
@@ -431,65 +525,6 @@ var REFRESH_INTERVAL = 1e3;
431
525
  var MAX_INFO_OBJECT_DEPTH = 8;
432
526
  var IS_CLOUDFLARE_WORKERS = !!globalThis?.navigator?.userAgent?.includes("Cloudflare-Workers");
433
527
  var TraceProcessor = class {
434
- constructor() {
435
- this.diagnostics = new DiagnosticsManager();
436
- this.diagnosticsChannel = new DiagnosticsChannel();
437
- this.remoteMetrics = new RemoteMetrics();
438
- this.remoteTracing = new RemoteTracing();
439
- this.subscriptions = /* @__PURE__ */ new Set();
440
- this.resources = /* @__PURE__ */ new Map();
441
- this.resourceInstanceIndex = /* @__PURE__ */ new WeakMap();
442
- this.resourceIdList = [];
443
- this.spans = /* @__PURE__ */ new Map();
444
- this.spanIdList = [];
445
- this.logs = [];
446
- this._instanceTag = null;
447
- this._logProcessor = (config, entry) => {
448
- switch (entry.level) {
449
- case LogLevel.ERROR:
450
- case LogLevel.WARN:
451
- case LogLevel.TRACE: {
452
- const scope = entry.meta?.S;
453
- const resource2 = this.resourceInstanceIndex.get(scope);
454
- if (!resource2) {
455
- return;
456
- }
457
- const context = getContextFromEntry(entry) ?? {};
458
- for (const key of Object.keys(context)) {
459
- context[key] = sanitizeValue(context[key], 0, this);
460
- }
461
- const entryToPush = {
462
- level: entry.level,
463
- message: entry.message,
464
- context,
465
- timestamp: /* @__PURE__ */ new Date(),
466
- meta: {
467
- file: entry.meta?.F ?? "",
468
- line: entry.meta?.L ?? 0,
469
- resourceId: resource2.data.id
470
- }
471
- };
472
- this._pushLog(entryToPush);
473
- break;
474
- }
475
- default:
476
- }
477
- };
478
- log.addProcessor(this._logProcessor.bind(this), void 0, {
479
- F: __dxlog_file3,
480
- L: 103,
481
- S: this,
482
- C: (f, a) => f(...a)
483
- });
484
- if (!IS_CLOUDFLARE_WORKERS) {
485
- const refreshInterval = setInterval(this.refresh.bind(this), REFRESH_INTERVAL);
486
- unrefTimeout(refreshInterval);
487
- }
488
- if (DiagnosticsChannel.supported) {
489
- this.diagnosticsChannel.serve(this.diagnostics);
490
- }
491
- this.diagnosticsChannel.unref();
492
- }
493
528
  setInstanceTag(tag) {
494
529
  this._instanceTag = tag;
495
530
  this.diagnostics.setInstanceTag(tag);
@@ -601,10 +636,10 @@ var TraceProcessor = class {
601
636
  let _changed = false;
602
637
  const oldInfo = resource2.data.info;
603
638
  resource2.data.info = this.getResourceInfo(instance);
604
- _changed ||= !areEqualShallow(oldInfo, resource2.data.info);
639
+ _changed || (_changed = !areEqualShallow(oldInfo, resource2.data.info));
605
640
  const oldMetrics = resource2.data.metrics;
606
641
  resource2.data.metrics = this.getResourceMetrics(instance);
607
- _changed ||= !areEqualShallow(oldMetrics, resource2.data.metrics);
642
+ _changed || (_changed = !areEqualShallow(oldMetrics, resource2.data.metrics));
608
643
  this._markResourceDirty(resource2.data.id);
609
644
  }
610
645
  for (const subscription of this.subscriptions) {
@@ -658,37 +693,67 @@ var TraceProcessor = class {
658
693
  subscription.newLogs.push(log2);
659
694
  }
660
695
  }
661
- };
662
- var TracingSpan = class _TracingSpan {
663
- static {
664
- this.nextId = 0;
665
- }
666
- constructor(_traceProcessor, params) {
667
- this._traceProcessor = _traceProcessor;
668
- this.parentId = null;
669
- this.resourceId = null;
670
- this.endTs = null;
671
- this.error = null;
672
- this._ctx = null;
673
- this.id = _TracingSpan.nextId++;
674
- this.methodName = params.methodName;
675
- this.resourceId = _traceProcessor.getResourceId(params.instance);
676
- this.startTs = performance.now();
677
- this._showInBrowserTimeline = params.showInBrowserTimeline;
678
- this.op = params.op;
679
- this.attributes = params.attributes ?? {};
680
- if (params.parentCtx) {
681
- this._ctx = params.parentCtx.derive({
682
- attributes: {
683
- [TRACE_SPAN_ATTRIBUTE]: this.id
696
+ constructor() {
697
+ _define_property6(this, "diagnostics", new DiagnosticsManager());
698
+ _define_property6(this, "diagnosticsChannel", new DiagnosticsChannel());
699
+ _define_property6(this, "remoteMetrics", new RemoteMetrics());
700
+ _define_property6(this, "remoteTracing", new RemoteTracing());
701
+ _define_property6(this, "subscriptions", /* @__PURE__ */ new Set());
702
+ _define_property6(this, "resources", /* @__PURE__ */ new Map());
703
+ _define_property6(this, "resourceInstanceIndex", /* @__PURE__ */ new WeakMap());
704
+ _define_property6(this, "resourceIdList", []);
705
+ _define_property6(this, "spans", /* @__PURE__ */ new Map());
706
+ _define_property6(this, "spanIdList", []);
707
+ _define_property6(this, "logs", []);
708
+ _define_property6(this, "_instanceTag", null);
709
+ _define_property6(this, "_logProcessor", (config, entry) => {
710
+ switch (entry.level) {
711
+ case LogLevel.ERROR:
712
+ case LogLevel.WARN:
713
+ case LogLevel.TRACE: {
714
+ const scope = entry.meta?.S;
715
+ const resource2 = this.resourceInstanceIndex.get(scope);
716
+ if (!resource2) {
717
+ return;
718
+ }
719
+ const context = getContextFromEntry(entry) ?? {};
720
+ for (const key of Object.keys(context)) {
721
+ context[key] = sanitizeValue(context[key], 0, this);
722
+ }
723
+ const entryToPush = {
724
+ level: entry.level,
725
+ message: entry.message ?? (entry.error ? entry.error.message ?? String(entry.error) : ""),
726
+ context,
727
+ timestamp: /* @__PURE__ */ new Date(),
728
+ meta: {
729
+ file: entry.meta?.F ?? "",
730
+ line: entry.meta?.L ?? 0,
731
+ resourceId: resource2.data.id
732
+ }
733
+ };
734
+ this._pushLog(entryToPush);
735
+ break;
684
736
  }
685
- });
686
- const parentId = params.parentCtx.getAttribute(TRACE_SPAN_ATTRIBUTE);
687
- if (typeof parentId === "number") {
688
- this.parentId = parentId;
737
+ default:
689
738
  }
739
+ });
740
+ log.addProcessor(this._logProcessor.bind(this), void 0, {
741
+ F: __dxlog_file3,
742
+ L: 103,
743
+ S: this,
744
+ C: (f, a) => f(...a)
745
+ });
746
+ if (!IS_CLOUDFLARE_WORKERS) {
747
+ const refreshInterval = setInterval(this.refresh.bind(this), REFRESH_INTERVAL);
748
+ unrefTimeout(refreshInterval);
690
749
  }
750
+ if (DiagnosticsChannel.supported) {
751
+ this.diagnosticsChannel.serve(this.diagnostics);
752
+ }
753
+ this.diagnosticsChannel.unref();
691
754
  }
755
+ };
756
+ var TracingSpan = class _TracingSpan {
692
757
  get name() {
693
758
  const resource2 = this._traceProcessor.resources.get(this.resourceId);
694
759
  return resource2 ? `${resource2.sanitizedClassName}#${resource2.data.instanceId}.${this.methodName}` : this.methodName;
@@ -730,7 +795,46 @@ var TracingSpan = class _TracingSpan {
730
795
  });
731
796
  }
732
797
  }
798
+ constructor(_traceProcessor, params) {
799
+ _define_property6(this, "_traceProcessor", void 0);
800
+ _define_property6(this, "id", void 0);
801
+ _define_property6(this, "parentId", void 0);
802
+ _define_property6(this, "methodName", void 0);
803
+ _define_property6(this, "resourceId", void 0);
804
+ _define_property6(this, "op", void 0);
805
+ _define_property6(this, "attributes", void 0);
806
+ _define_property6(this, "startTs", void 0);
807
+ _define_property6(this, "endTs", void 0);
808
+ _define_property6(this, "error", void 0);
809
+ _define_property6(this, "_showInBrowserTimeline", void 0);
810
+ _define_property6(this, "_ctx", void 0);
811
+ this._traceProcessor = _traceProcessor;
812
+ this.parentId = null;
813
+ this.resourceId = null;
814
+ this.endTs = null;
815
+ this.error = null;
816
+ this._ctx = null;
817
+ this.id = _TracingSpan.nextId++;
818
+ this.methodName = params.methodName;
819
+ this.resourceId = _traceProcessor.getResourceId(params.instance);
820
+ this.startTs = performance.now();
821
+ this._showInBrowserTimeline = params.showInBrowserTimeline;
822
+ this.op = params.op;
823
+ this.attributes = params.attributes ?? {};
824
+ if (params.parentCtx) {
825
+ this._ctx = params.parentCtx.derive({
826
+ attributes: {
827
+ [TRACE_SPAN_ATTRIBUTE]: this.id
828
+ }
829
+ });
830
+ const parentId = params.parentCtx.getAttribute(TRACE_SPAN_ATTRIBUTE);
831
+ if (typeof parentId === "number") {
832
+ this.parentId = parentId;
833
+ }
834
+ }
835
+ }
733
836
  };
837
+ _define_property6(TracingSpan, "nextId", 0);
734
838
  var serializeError = (err) => {
735
839
  if (err instanceof Error) {
736
840
  return {
@@ -742,7 +846,7 @@ var serializeError = (err) => {
742
846
  message: String(err)
743
847
  };
744
848
  };
745
- var TRACE_PROCESSOR = globalThis.TRACE_PROCESSOR ??= new TraceProcessor();
849
+ var TRACE_PROCESSOR = (_globalThis = globalThis).TRACE_PROCESSOR ?? (_globalThis.TRACE_PROCESSOR = new TraceProcessor());
746
850
  var sanitizeValue = (value, depth, traceProcessor) => {
747
851
  switch (typeof value) {
748
852
  case "string":
@@ -813,17 +917,20 @@ var sanitizeClassName = (className) => {
813
917
  var isSetLike = (value) => value instanceof Set || typeof value === "object" && value !== null && Object.getPrototypeOf(value).constructor.name === "ComplexSet";
814
918
  var isMapLike = (value) => value instanceof Map || typeof value === "object" && value !== null && Object.getPrototypeOf(value).constructor.name === "ComplexMap";
815
919
 
816
- // packages/common/tracing/src/api.ts
920
+ // src/api.ts
817
921
  var resource = (options) => (constructor) => {
818
- const klass = /* @__PURE__ */ (() => class extends constructor {
819
- constructor(...rest) {
820
- super(...rest);
821
- TRACE_PROCESSOR.createTraceResource({
822
- constructor,
823
- annotation: options?.annotation,
824
- instance: this
825
- });
922
+ const klass = /* @__PURE__ */ (() => {
923
+ class _class extends constructor {
924
+ constructor(...rest) {
925
+ super(...rest);
926
+ TRACE_PROCESSOR.createTraceResource({
927
+ constructor,
928
+ annotation: options?.annotation,
929
+ instance: this
930
+ });
931
+ }
826
932
  }
933
+ return _class;
827
934
  })();
828
935
  Object.defineProperty(klass, "name", {
829
936
  value: constructor.name
@@ -901,7 +1008,20 @@ var trace = {
901
1008
  metrics: TRACE_PROCESSOR.remoteMetrics
902
1009
  };
903
1010
 
904
- // packages/common/tracing/src/metrics/base.ts
1011
+ // src/metrics/base.ts
1012
+ function _define_property7(obj, key, value) {
1013
+ if (key in obj) {
1014
+ Object.defineProperty(obj, key, {
1015
+ value,
1016
+ enumerable: true,
1017
+ configurable: true,
1018
+ writable: true
1019
+ });
1020
+ } else {
1021
+ obj[key] = value;
1022
+ }
1023
+ return obj;
1024
+ }
905
1025
  var BaseCounter = class {
906
1026
  /**
907
1027
  * @internal
@@ -912,15 +1032,27 @@ var BaseCounter = class {
912
1032
  }
913
1033
  _tick(time) {
914
1034
  }
1035
+ constructor() {
1036
+ _define_property7(this, "_instance", void 0);
1037
+ _define_property7(this, "name", void 0);
1038
+ }
915
1039
  };
916
1040
 
917
- // packages/common/tracing/src/metrics/unary-counter.ts
918
- var UnaryCounter = class extends BaseCounter {
919
- constructor({ units } = {}) {
920
- super();
921
- this.value = 0;
922
- this.units = units;
1041
+ // src/metrics/unary-counter.ts
1042
+ function _define_property8(obj, key, value) {
1043
+ if (key in obj) {
1044
+ Object.defineProperty(obj, key, {
1045
+ value,
1046
+ enumerable: true,
1047
+ configurable: true,
1048
+ writable: true
1049
+ });
1050
+ } else {
1051
+ obj[key] = value;
923
1052
  }
1053
+ return obj;
1054
+ }
1055
+ var UnaryCounter = class extends BaseCounter {
924
1056
  inc(by = 1) {
925
1057
  this.value += by;
926
1058
  }
@@ -933,18 +1065,28 @@ var UnaryCounter = class extends BaseCounter {
933
1065
  }
934
1066
  };
935
1067
  }
1068
+ constructor({ units } = {}) {
1069
+ super(), _define_property8(this, "value", 0), _define_property8(this, "units", void 0);
1070
+ this.units = units;
1071
+ }
936
1072
  };
937
1073
 
938
- // packages/common/tracing/src/metrics/time-series-counter.ts
1074
+ // src/metrics/time-series-counter.ts
1075
+ function _define_property9(obj, key, value) {
1076
+ if (key in obj) {
1077
+ Object.defineProperty(obj, key, {
1078
+ value,
1079
+ enumerable: true,
1080
+ configurable: true,
1081
+ writable: true
1082
+ });
1083
+ } else {
1084
+ obj[key] = value;
1085
+ }
1086
+ return obj;
1087
+ }
939
1088
  var MAX_BUCKETS = 60;
940
1089
  var TimeSeriesCounter = class extends BaseCounter {
941
- constructor({ units } = {}) {
942
- super();
943
- this._currentValue = 0;
944
- this._totalValue = 0;
945
- this._buckets = [];
946
- this.units = units;
947
- }
948
1090
  inc(by = 1) {
949
1091
  this._currentValue += by;
950
1092
  this._totalValue += by;
@@ -973,18 +1115,28 @@ var TimeSeriesCounter = class extends BaseCounter {
973
1115
  }
974
1116
  };
975
1117
  }
1118
+ constructor({ units } = {}) {
1119
+ super(), _define_property9(this, "_currentValue", 0), _define_property9(this, "_totalValue", 0), _define_property9(this, "_buckets", []), _define_property9(this, "units", void 0);
1120
+ this.units = units;
1121
+ }
976
1122
  };
977
1123
 
978
- // packages/common/tracing/src/metrics/time-usage-counter.ts
1124
+ // src/metrics/time-usage-counter.ts
1125
+ function _define_property10(obj, key, value) {
1126
+ if (key in obj) {
1127
+ Object.defineProperty(obj, key, {
1128
+ value,
1129
+ enumerable: true,
1130
+ configurable: true,
1131
+ writable: true
1132
+ });
1133
+ } else {
1134
+ obj[key] = value;
1135
+ }
1136
+ return obj;
1137
+ }
979
1138
  var MAX_BUCKETS2 = 60;
980
1139
  var TimeUsageCounter = class extends BaseCounter {
981
- constructor() {
982
- super(...arguments);
983
- this._currentValue = 0;
984
- this._totalValue = 0;
985
- this._buckets = [];
986
- this._lastTickTime = performance.now();
987
- }
988
1140
  record(time) {
989
1141
  this._currentValue += time;
990
1142
  this._totalValue += time;
@@ -1025,15 +1177,26 @@ var TimeUsageCounter = class extends BaseCounter {
1025
1177
  }
1026
1178
  };
1027
1179
  }
1180
+ constructor(...args) {
1181
+ super(...args), _define_property10(this, "_currentValue", 0), _define_property10(this, "_totalValue", 0), _define_property10(this, "_buckets", []), _define_property10(this, "_lastTickTime", performance.now());
1182
+ }
1028
1183
  };
1029
1184
 
1030
- // packages/common/tracing/src/metrics/map-counter.ts
1031
- var MapCounter = class extends BaseCounter {
1032
- constructor({ units } = {}) {
1033
- super();
1034
- this.values = /* @__PURE__ */ new Map();
1035
- this.units = units;
1185
+ // src/metrics/map-counter.ts
1186
+ function _define_property11(obj, key, value) {
1187
+ if (key in obj) {
1188
+ Object.defineProperty(obj, key, {
1189
+ value,
1190
+ enumerable: true,
1191
+ configurable: true,
1192
+ writable: true
1193
+ });
1194
+ } else {
1195
+ obj[key] = value;
1036
1196
  }
1197
+ return obj;
1198
+ }
1199
+ var MapCounter = class extends BaseCounter {
1037
1200
  inc(key, by = 1) {
1038
1201
  const prev = this.values.get(key) ?? 0;
1039
1202
  this.values.set(key, prev + by);
@@ -1050,13 +1213,27 @@ var MapCounter = class extends BaseCounter {
1050
1213
  }
1051
1214
  };
1052
1215
  }
1216
+ constructor({ units } = {}) {
1217
+ super(), _define_property11(this, "values", /* @__PURE__ */ new Map()), _define_property11(this, "units", void 0);
1218
+ this.units = units;
1219
+ }
1053
1220
  };
1054
1221
 
1055
- // packages/common/tracing/src/metrics/custom-counter.ts
1056
- var CustomCounter = class extends BaseCounter {
1057
- constructor(_getData) {
1058
- super(), this._getData = _getData;
1222
+ // src/metrics/custom-counter.ts
1223
+ function _define_property12(obj, key, value) {
1224
+ if (key in obj) {
1225
+ Object.defineProperty(obj, key, {
1226
+ value,
1227
+ enumerable: true,
1228
+ configurable: true,
1229
+ writable: true
1230
+ });
1231
+ } else {
1232
+ obj[key] = value;
1059
1233
  }
1234
+ return obj;
1235
+ }
1236
+ var CustomCounter = class extends BaseCounter {
1060
1237
  getData() {
1061
1238
  return {
1062
1239
  name: this.name,
@@ -1065,9 +1242,12 @@ var CustomCounter = class extends BaseCounter {
1065
1242
  }
1066
1243
  };
1067
1244
  }
1245
+ constructor(_getData) {
1246
+ super(), _define_property12(this, "_getData", void 0), this._getData = _getData;
1247
+ }
1068
1248
  };
1069
1249
 
1070
- // packages/common/tracing/src/index.ts
1250
+ // src/index.ts
1071
1251
  trace.diagnostic({
1072
1252
  id: "process-info",
1073
1253
  name: "Process Info",