autotel-devtools 20.1.0 → 21.0.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.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { a as ErrorGroup, c as MetricData, i as DevtoolsData, l as SpanData, n as DevtoolsServer, s as LogData, t as DevtoolsSpanExporter, u as TraceData } from "./exporter-BJwufQwg.js";
1
+ import { n as SpanAttributes, t as AttributeValue } from "./types-DHDvZnnn.js";
2
+ import { a as ErrorGroup, c as MetricData, i as DevtoolsData, l as SpanData, n as DevtoolsServer, s as LogData, t as DevtoolsSpanExporter, u as TraceData } from "./exporter-Due9Rd4s.js";
2
3
  import { DevtoolsLogExporter } from "./server/log-exporter.js";
3
4
  import { DevtoolsRemoteExporter } from "./server/remote-exporter.js";
4
- import { t as ErrorAggregator } from "./error-aggregator-DufjI2IG.js";
5
+ import { t as ErrorAggregator } from "./error-aggregator-D8VKciLY.js";
5
6
  import { Server } from "node:http";
6
7
  //#region src/index.d.ts
7
8
  interface CreateDevtoolsOptions {
@@ -30,4 +31,4 @@ interface DevtoolsInstance {
30
31
  }
31
32
  declare function createDevtools(options?: CreateDevtoolsOptions): DevtoolsInstance;
32
33
  //#endregion
33
- export { CreateDevtoolsOptions, type DevtoolsData, DevtoolsInstance, DevtoolsLogExporter, DevtoolsRemoteExporter, DevtoolsServer, DevtoolsSpanExporter, ErrorAggregator, type ErrorGroup, type LogData, type MetricData, type SpanData, type TraceData, createDevtools };
34
+ export { type AttributeValue, CreateDevtoolsOptions, type DevtoolsData, DevtoolsInstance, DevtoolsLogExporter, DevtoolsRemoteExporter, DevtoolsServer, DevtoolsSpanExporter, ErrorAggregator, type ErrorGroup, type LogData, type MetricData, type SpanAttributes, type SpanData, type TraceData, createDevtools };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { f as DevtoolsServer, m as hostHeaderIsLoopback, r as resolveSourceRoot, t as attachDevtoolsRoutes, x as ErrorAggregator } from "./http-Ddn7gT0R.js";
2
- import { t as listenLoopbackDualStack } from "./listen-NVMbBWHw.js";
1
+ import { f as DevtoolsServer, m as hostHeaderIsLoopback, r as resolveSourceRoot, t as attachDevtoolsRoutes, x as ErrorAggregator } from "./http-CNZMrnzv.js";
2
+ import { t as listenLoopbackDualStack } from "./listen-DBfsfcdd.js";
3
3
  import { DevtoolsSpanExporter } from "./server/exporter.js";
4
4
  import { DevtoolsLogExporter } from "./server/log-exporter.js";
5
5
  import { DevtoolsRemoteExporter } from "./server/remote-exporter.js";
@@ -0,0 +1,47 @@
1
+ //#region src/widget/attrs.ts
2
+ /** The string an attribute carries, or undefined when it carried something else. */
3
+ function stringAttr(attributes, ...keys) {
4
+ for (const key of keys) {
5
+ const value = attributes?.[key];
6
+ if (typeof value === "string" && value.length > 0) return value;
7
+ }
8
+ }
9
+ /** The string a wire value carries, or undefined when it carried something else. */
10
+ function asString(value) {
11
+ return typeof value === "string" ? value : void 0;
12
+ }
13
+ /**
14
+ * The number a wire value carries. A numeric string counts: instrumentations
15
+ * routinely send counts and durations as strings.
16
+ */
17
+ function asNumber(value) {
18
+ if (typeof value === "number") return value;
19
+ if (typeof value === "string" && value !== "") {
20
+ const parsed = Number(value);
21
+ return Number.isFinite(parsed) ? parsed : void 0;
22
+ }
23
+ }
24
+ /** The boolean a wire value carries, including the strings 'true' and 'false'. */
25
+ function asBoolean(value) {
26
+ if (typeof value === "boolean") return value;
27
+ if (value === "true") return true;
28
+ if (value === "false") return false;
29
+ }
30
+ /** The strings a wire value carries - a list of them, or a lone one. */
31
+ function asStringArray(value) {
32
+ if (Array.isArray(value)) {
33
+ const strings = value.filter((item) => typeof item === "string");
34
+ return strings.length === value.length ? strings : void 0;
35
+ }
36
+ return typeof value === "string" ? [value] : void 0;
37
+ }
38
+
39
+ //#endregion
40
+ //#region src/widget/utils/json-fields.ts
41
+ /** The value as an object, or `undefined` when it is anything else. */
42
+ function asObject(value) {
43
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
44
+ }
45
+
46
+ //#endregion
47
+ export { asStringArray as a, asString as i, asBoolean as n, stringAttr as o, asNumber as r, asObject as t };
@@ -0,0 +1,83 @@
1
+
2
+ //#region src/widget/attrs.ts
3
+ /** The string an attribute carries, or undefined when it carried something else. */
4
+ function stringAttr(attributes, ...keys) {
5
+ for (const key of keys) {
6
+ const value = attributes?.[key];
7
+ if (typeof value === "string" && value.length > 0) return value;
8
+ }
9
+ }
10
+ /** The string a wire value carries, or undefined when it carried something else. */
11
+ function asString(value) {
12
+ return typeof value === "string" ? value : void 0;
13
+ }
14
+ /**
15
+ * The number a wire value carries. A numeric string counts: instrumentations
16
+ * routinely send counts and durations as strings.
17
+ */
18
+ function asNumber(value) {
19
+ if (typeof value === "number") return value;
20
+ if (typeof value === "string" && value !== "") {
21
+ const parsed = Number(value);
22
+ return Number.isFinite(parsed) ? parsed : void 0;
23
+ }
24
+ }
25
+ /** The boolean a wire value carries, including the strings 'true' and 'false'. */
26
+ function asBoolean(value) {
27
+ if (typeof value === "boolean") return value;
28
+ if (value === "true") return true;
29
+ if (value === "false") return false;
30
+ }
31
+ /** The strings a wire value carries - a list of them, or a lone one. */
32
+ function asStringArray(value) {
33
+ if (Array.isArray(value)) {
34
+ const strings = value.filter((item) => typeof item === "string");
35
+ return strings.length === value.length ? strings : void 0;
36
+ }
37
+ return typeof value === "string" ? [value] : void 0;
38
+ }
39
+
40
+ //#endregion
41
+ //#region src/widget/utils/json-fields.ts
42
+ /** The value as an object, or `undefined` when it is anything else. */
43
+ function asObject(value) {
44
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
45
+ }
46
+
47
+ //#endregion
48
+ Object.defineProperty(exports, 'asBoolean', {
49
+ enumerable: true,
50
+ get: function () {
51
+ return asBoolean;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, 'asNumber', {
55
+ enumerable: true,
56
+ get: function () {
57
+ return asNumber;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, 'asObject', {
61
+ enumerable: true,
62
+ get: function () {
63
+ return asObject;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, 'asString', {
67
+ enumerable: true,
68
+ get: function () {
69
+ return asString;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, 'asStringArray', {
73
+ enumerable: true,
74
+ get: function () {
75
+ return asStringArray;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, 'stringAttr', {
79
+ enumerable: true,
80
+ get: function () {
81
+ return stringAttr;
82
+ }
83
+ });
@@ -101,7 +101,7 @@ function listenLoopbackDualStack(args) {
101
101
  } catch (e) {
102
102
  primary.removeListener("error", onError);
103
103
  primary.removeListener("listening", onListening);
104
- bindFailed(candidate, e.message);
104
+ bindFailed(candidate, e instanceof Error ? e.message : String(e));
105
105
  }
106
106
  };
107
107
  primary.on("error", onError);
@@ -101,7 +101,7 @@ function listenLoopbackDualStack(args) {
101
101
  } catch (e) {
102
102
  primary.removeListener("error", onError);
103
103
  primary.removeListener("listening", onListening);
104
- bindFailed(candidate, e.message);
104
+ bindFailed(candidate, e instanceof Error ? e.message : String(e));
105
105
  }
106
106
  };
107
107
  primary.on("error", onError);
@@ -1,2 +1,2 @@
1
- import { t as DevtoolsSpanExporter } from "../exporter-CEKKJTci.cjs";
1
+ import { t as DevtoolsSpanExporter } from "../exporter-Dt4kx128.cjs";
2
2
  export { DevtoolsSpanExporter };
@@ -1,2 +1,2 @@
1
- import { t as DevtoolsSpanExporter } from "../exporter-BJwufQwg.js";
1
+ import { t as DevtoolsSpanExporter } from "../exporter-Due9Rd4s.js";
2
2
  export { DevtoolsSpanExporter };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_http = require('../http-D44dITGS.cjs');
2
+ const require_http = require('../http-CXSzX4ee.cjs');
3
3
  const require_server_exporter = require('./exporter.cjs');
4
4
  const require_server_log_exporter = require('./log-exporter.cjs');
5
5
  const require_server_remote_exporter = require('./remote-exporter.cjs');
@@ -1,7 +1,7 @@
1
- import { a as ErrorGroup, c as MetricData, i as DevtoolsData, l as SpanData, n as DevtoolsServer, o as ErrorOccurrence, r as DevtoolsServerOptions, s as LogData, t as DevtoolsSpanExporter, u as TraceData } from "../exporter-CEKKJTci.cjs";
1
+ import { a as ErrorGroup, c as MetricData, i as DevtoolsData, l as SpanData, n as DevtoolsServer, o as ErrorOccurrence, r as DevtoolsServerOptions, s as LogData, t as DevtoolsSpanExporter, u as TraceData } from "../exporter-Dt4kx128.cjs";
2
2
  import { DevtoolsLogExporter } from "./log-exporter.cjs";
3
3
  import { DevtoolsRemoteExporter, DevtoolsRemoteExporterOptions } from "./remote-exporter.cjs";
4
- import { t as ErrorAggregator } from "../error-aggregator-CGgWr2OH.cjs";
4
+ import { t as ErrorAggregator } from "../error-aggregator-DCEKMOm3.cjs";
5
5
  import { Server } from "node:http";
6
6
  import { AgentRawEvent, OtelMetricRecord } from "autotel-agents";
7
7
  //#region src/server/http.d.ts
@@ -1,7 +1,7 @@
1
- import { a as ErrorGroup, c as MetricData, i as DevtoolsData, l as SpanData, n as DevtoolsServer, o as ErrorOccurrence, r as DevtoolsServerOptions, s as LogData, t as DevtoolsSpanExporter, u as TraceData } from "../exporter-BJwufQwg.js";
1
+ import { a as ErrorGroup, c as MetricData, i as DevtoolsData, l as SpanData, n as DevtoolsServer, o as ErrorOccurrence, r as DevtoolsServerOptions, s as LogData, t as DevtoolsSpanExporter, u as TraceData } from "../exporter-Due9Rd4s.js";
2
2
  import { DevtoolsLogExporter } from "./log-exporter.js";
3
3
  import { DevtoolsRemoteExporter, DevtoolsRemoteExporterOptions } from "./remote-exporter.js";
4
- import { t as ErrorAggregator } from "../error-aggregator-DufjI2IG.js";
4
+ import { t as ErrorAggregator } from "../error-aggregator-D8VKciLY.js";
5
5
  import { Server } from "node:http";
6
6
  import { AgentRawEvent, OtelMetricRecord } from "autotel-agents";
7
7
  //#region src/server/http.d.ts
@@ -1,4 +1,4 @@
1
- import { _ as appendManyWithLimit, a as probePortHolder, b as resolveTelemetryLimits, c as decodeOtlpTraceRequest, d as parseOtlpTraces, f as DevtoolsServer, g as originIsLoopback, h as isLoopbackHostname, i as DEVTOOLS_IDENTITY, l as isProtobufContentType, m as hostHeaderIsLoopback, n as createDevtoolsHttpServer, o as decodeOtlpLogsRequest, p as allowSensitiveRequest, s as decodeOtlpMetricsRequest, t as attachDevtoolsRoutes, u as parseOtlpLogs, v as appendWithLimit, x as ErrorAggregator, y as applyTelemetryLimits } from "../http-Ddn7gT0R.js";
1
+ import { _ as appendManyWithLimit, a as probePortHolder, b as resolveTelemetryLimits, c as decodeOtlpTraceRequest, d as parseOtlpTraces, f as DevtoolsServer, g as originIsLoopback, h as isLoopbackHostname, i as DEVTOOLS_IDENTITY, l as isProtobufContentType, m as hostHeaderIsLoopback, n as createDevtoolsHttpServer, o as decodeOtlpLogsRequest, p as allowSensitiveRequest, s as decodeOtlpMetricsRequest, t as attachDevtoolsRoutes, u as parseOtlpLogs, v as appendWithLimit, x as ErrorAggregator, y as applyTelemetryLimits } from "../http-CNZMrnzv.js";
2
2
  import { DevtoolsSpanExporter } from "./exporter.js";
3
3
  import { DevtoolsLogExporter } from "./log-exporter.js";
4
4
  import { DevtoolsRemoteExporter } from "./remote-exporter.js";
@@ -0,0 +1,47 @@
1
+ import { AgentSession } from "autotel-agents";
2
+ //#region src/widget/types.d.ts
3
+ /**
4
+ * What a span attribute holds once it has crossed OTLP. The widget is
5
+ * browser-safe and does not depend on the OTel API package, so the value type
6
+ * is named here rather than imported.
7
+ */
8
+ type AttributeValue = string | number | boolean | null | undefined | Uint8Array | Array<AttributeValue> | {
9
+ [key: string]: AttributeValue;
10
+ };
11
+ /**
12
+ * A span's attribute bag as the devtools receives it. Wider than OpenTelemetry's
13
+ * own `Attributes` on purpose: OTLP's kvlist and array values decode to nested
14
+ * maps and lists, and the devtools displays whatever actually arrived.
15
+ */
16
+ type SpanAttributes = Record<string, AttributeValue>;
17
+ interface SpanData {
18
+ traceId: string;
19
+ spanId: string;
20
+ parentSpanId?: string;
21
+ name: string;
22
+ kind: 'INTERNAL' | 'SERVER' | 'CLIENT' | 'PRODUCER' | 'CONSUMER';
23
+ startTime: number;
24
+ endTime: number;
25
+ duration: number;
26
+ attributes: SpanAttributes;
27
+ status: {
28
+ code: 'OK' | 'ERROR' | 'UNSET';
29
+ message?: string;
30
+ };
31
+ events?: Array<{
32
+ name: string;
33
+ timestamp: number;
34
+ attributes?: SpanAttributes;
35
+ }>;
36
+ links?: Array<{
37
+ traceId: string;
38
+ spanId: string;
39
+ attributes?: SpanAttributes;
40
+ }>;
41
+ scope?: {
42
+ name?: string;
43
+ version?: string;
44
+ };
45
+ }
46
+ //#endregion
47
+ export { SpanAttributes as n, SpanData as r, AttributeValue as t };
@@ -0,0 +1,47 @@
1
+ import { AgentSession } from "autotel-agents";
2
+ //#region src/widget/types.d.ts
3
+ /**
4
+ * What a span attribute holds once it has crossed OTLP. The widget is
5
+ * browser-safe and does not depend on the OTel API package, so the value type
6
+ * is named here rather than imported.
7
+ */
8
+ type AttributeValue = string | number | boolean | null | undefined | Uint8Array | Array<AttributeValue> | {
9
+ [key: string]: AttributeValue;
10
+ };
11
+ /**
12
+ * A span's attribute bag as the devtools receives it. Wider than OpenTelemetry's
13
+ * own `Attributes` on purpose: OTLP's kvlist and array values decode to nested
14
+ * maps and lists, and the devtools displays whatever actually arrived.
15
+ */
16
+ type SpanAttributes = Record<string, AttributeValue>;
17
+ interface SpanData {
18
+ traceId: string;
19
+ spanId: string;
20
+ parentSpanId?: string;
21
+ name: string;
22
+ kind: 'INTERNAL' | 'SERVER' | 'CLIENT' | 'PRODUCER' | 'CONSUMER';
23
+ startTime: number;
24
+ endTime: number;
25
+ duration: number;
26
+ attributes: SpanAttributes;
27
+ status: {
28
+ code: 'OK' | 'ERROR' | 'UNSET';
29
+ message?: string;
30
+ };
31
+ events?: Array<{
32
+ name: string;
33
+ timestamp: number;
34
+ attributes?: SpanAttributes;
35
+ }>;
36
+ links?: Array<{
37
+ traceId: string;
38
+ spanId: string;
39
+ attributes?: SpanAttributes;
40
+ }>;
41
+ scope?: {
42
+ name?: string;
43
+ version?: string;
44
+ };
45
+ }
46
+ //#endregion
47
+ export { SpanAttributes as n, SpanData as r, AttributeValue as t };