@atrim/instrument-node 0.9.0 → 0.9.1-dev.2a45310.20260120032104
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atrim/instrument-node",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-dev.2a45310.20260120032104",
|
|
4
4
|
"description": "OpenTelemetry instrumentation for Node.js with centralized YAML configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,7 +83,8 @@
|
|
|
83
83
|
"@opentelemetry/semantic-conventions": "^1.38.0",
|
|
84
84
|
"@types/node": "^25.0.3",
|
|
85
85
|
"@vitest/coverage-v8": "^4.0.16",
|
|
86
|
-
"effect": "
|
|
86
|
+
"effect": "npm:@clayroach/effect@3.19.14-source-trace.3",
|
|
87
|
+
"@clayroach/unplugin": "0.1.0-source-trace.3",
|
|
87
88
|
"testcontainers": "^11.11.0",
|
|
88
89
|
"tsup": "^8.0.1",
|
|
89
90
|
"tsx": "^4.7.0",
|
|
@@ -8,7 +8,6 @@ var yaml = require('yaml');
|
|
|
8
8
|
var zod = require('zod');
|
|
9
9
|
var fs = require('fs');
|
|
10
10
|
var path2 = require('path');
|
|
11
|
-
var TracerModule = require('effect/Tracer');
|
|
12
11
|
var opentelemetry = require('@effect/opentelemetry');
|
|
13
12
|
var OtelApi = require('@opentelemetry/api');
|
|
14
13
|
var sdkTraceBase = require('@opentelemetry/sdk-trace-base');
|
|
@@ -39,7 +38,6 @@ var HttpClientRequest__namespace = /*#__PURE__*/_interopNamespace(HttpClientRequ
|
|
|
39
38
|
var yaml__namespace = /*#__PURE__*/_interopNamespace(yaml);
|
|
40
39
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
41
40
|
var path2__namespace = /*#__PURE__*/_interopNamespace(path2);
|
|
42
|
-
var TracerModule__namespace = /*#__PURE__*/_interopNamespace(TracerModule);
|
|
43
41
|
var OtelApi__namespace = /*#__PURE__*/_interopNamespace(OtelApi);
|
|
44
42
|
|
|
45
43
|
var __defProp = Object.defineProperty;
|
|
@@ -756,9 +754,9 @@ function parseSourceLocation(stack) {
|
|
|
756
754
|
const match = line.match(/at\s+(?:.*?\s+\()?(.+):(\d+):(\d+)\)?/);
|
|
757
755
|
if (match && match[1] && match[2]) {
|
|
758
756
|
return {
|
|
759
|
-
|
|
757
|
+
path: match[1],
|
|
760
758
|
line: parseInt(match[2], 10),
|
|
761
|
-
|
|
759
|
+
column: match[3] ? parseInt(match[3], 10) : 0
|
|
762
760
|
};
|
|
763
761
|
}
|
|
764
762
|
}
|
|
@@ -766,12 +764,12 @@ function parseSourceLocation(stack) {
|
|
|
766
764
|
}
|
|
767
765
|
function makeSourceKey(source) {
|
|
768
766
|
if (!source) return "unknown";
|
|
769
|
-
return `${source.
|
|
767
|
+
return `${source.path}:${source.line}`;
|
|
770
768
|
}
|
|
771
769
|
function formatLocation(source) {
|
|
772
770
|
if (!source) return "unknown";
|
|
773
|
-
const filename = source.
|
|
774
|
-
return `${filename}:${source.line}`;
|
|
771
|
+
const filename = source.path.split("/").pop() ?? source.path;
|
|
772
|
+
return source.label ? `${filename}:${source.line} (${source.label})` : `${filename}:${source.line}`;
|
|
775
773
|
}
|
|
776
774
|
function getGlobalProviderSetup() {
|
|
777
775
|
if (_globalProviderSetup === void 0) {
|
|
@@ -779,15 +777,15 @@ function getGlobalProviderSetup() {
|
|
|
779
777
|
}
|
|
780
778
|
return _globalProviderSetup;
|
|
781
779
|
}
|
|
782
|
-
var
|
|
780
|
+
var currentSourceTrace; exports.UnifiedTracingSupervisor = void 0; var setupGlobalTracerProvider, _globalProviderSetup; exports.createUnifiedTracingLayer = void 0; exports.UnifiedTracingLive = void 0; exports.enableOpSupervision = void 0; exports.withUnifiedTracing = void 0; exports.withAutoTracing = void 0; exports.flushAndShutdown = void 0; exports.forceFlush = void 0;
|
|
783
781
|
var init_unified_tracing_supervisor = __esm({
|
|
784
782
|
"src/integrations/effect/auto/unified-tracing-supervisor.ts"() {
|
|
785
783
|
init_dist();
|
|
786
784
|
init_config();
|
|
787
785
|
init_span_control();
|
|
788
786
|
init_span_control();
|
|
789
|
-
|
|
790
|
-
/* @__PURE__ */ Symbol.for("effect/FiberRef/
|
|
787
|
+
currentSourceTrace = effect.GlobalValue.globalValue(
|
|
788
|
+
/* @__PURE__ */ Symbol.for("effect/FiberRef/currentSourceTrace"),
|
|
791
789
|
() => effect.FiberRef.unsafeMake(void 0)
|
|
792
790
|
);
|
|
793
791
|
exports.UnifiedTracingSupervisor = class extends effect.Supervisor.AbstractSupervisor {
|
|
@@ -853,11 +851,9 @@ var init_unified_tracing_supervisor = __esm({
|
|
|
853
851
|
span.setAttribute("effect.item_count", meta.count);
|
|
854
852
|
}
|
|
855
853
|
if (opConfig.includeStack && location) {
|
|
856
|
-
span.setAttribute("code.filepath", location.
|
|
854
|
+
span.setAttribute("code.filepath", location.path);
|
|
857
855
|
span.setAttribute("code.lineno", location.line);
|
|
858
|
-
|
|
859
|
-
span.setAttribute("code.column", location.column);
|
|
860
|
-
}
|
|
856
|
+
span.setAttribute("code.column", location.column);
|
|
861
857
|
}
|
|
862
858
|
logger.log(
|
|
863
859
|
`@atrim/unified-tracing: Created operation span "${spanName}" spanId=${span.spanContext().spanId}`
|
|
@@ -892,7 +888,7 @@ var init_unified_tracing_supervisor = __esm({
|
|
|
892
888
|
return;
|
|
893
889
|
}
|
|
894
890
|
const nameOverride = effect.FiberRefs.getOrDefault(fiberRefs, exports.AutoTracingSpanName);
|
|
895
|
-
const sourceLocation = effect.FiberRefs.getOrDefault(fiberRefs,
|
|
891
|
+
const sourceLocation = effect.FiberRefs.getOrDefault(fiberRefs, currentSourceTrace);
|
|
896
892
|
const sourceKey = makeSourceKey(sourceLocation);
|
|
897
893
|
logger.log(`@atrim/unified-tracing: onStart fiber ${fiberId} at ${sourceKey}`);
|
|
898
894
|
let parentContext;
|
|
@@ -927,10 +923,11 @@ var init_unified_tracing_supervisor = __esm({
|
|
|
927
923
|
span.setAttribute("effect.auto_traced", true);
|
|
928
924
|
span.setAttribute("effect.fiber.id", fiberId);
|
|
929
925
|
if (sourceLocation) {
|
|
930
|
-
span.setAttribute("code.filepath", sourceLocation.
|
|
926
|
+
span.setAttribute("code.filepath", sourceLocation.path);
|
|
931
927
|
span.setAttribute("code.lineno", sourceLocation.line);
|
|
932
|
-
|
|
933
|
-
|
|
928
|
+
span.setAttribute("code.column", sourceLocation.column);
|
|
929
|
+
if (sourceLocation.label) {
|
|
930
|
+
span.setAttribute("code.function", sourceLocation.label);
|
|
934
931
|
}
|
|
935
932
|
}
|
|
936
933
|
if (effect.Option.isSome(parent)) {
|
|
@@ -999,16 +996,6 @@ var init_unified_tracing_supervisor = __esm({
|
|
|
999
996
|
return OtelApi__namespace.ROOT_CONTEXT;
|
|
1000
997
|
}
|
|
1001
998
|
resolveParentContextFromFiberRefs(fiberRefs, context2, parent) {
|
|
1002
|
-
const inheritedCtx = effect.FiberRefs.getOrDefault(fiberRefs, TracerModule__namespace.currentOtelSpanContext);
|
|
1003
|
-
if (inheritedCtx) {
|
|
1004
|
-
const span = OtelApi__namespace.trace.getSpan(inheritedCtx);
|
|
1005
|
-
if (span) {
|
|
1006
|
-
logger.log(
|
|
1007
|
-
`@atrim/unified-tracing: Using inherited OTel context from FiberRef - spanId=${span.spanContext().spanId}`
|
|
1008
|
-
);
|
|
1009
|
-
}
|
|
1010
|
-
return inheritedCtx;
|
|
1011
|
-
}
|
|
1012
999
|
const maybeParentSpan = effect.Context.getOption(context2, effect.Tracer.ParentSpan);
|
|
1013
1000
|
if (effect.Option.isSome(maybeParentSpan)) {
|
|
1014
1001
|
const effectSpan = maybeParentSpan.value;
|
|
@@ -1140,12 +1127,7 @@ var init_unified_tracing_supervisor = __esm({
|
|
|
1140
1127
|
const opSupervisionLayer = effect.Layer.effectDiscard(
|
|
1141
1128
|
effect.Effect.patchRuntimeFlags(effect.RuntimeFlagsPatch.enable(effect.RuntimeFlags.OpSupervision))
|
|
1142
1129
|
);
|
|
1143
|
-
return effect.Layer.mergeAll(
|
|
1144
|
-
effect.Layer.discard(tracerWithResource),
|
|
1145
|
-
effect.Layer.enableSourceCapture,
|
|
1146
|
-
supervisorLayer,
|
|
1147
|
-
opSupervisionLayer
|
|
1148
|
-
);
|
|
1130
|
+
return effect.Layer.mergeAll(effect.Layer.discard(tracerWithResource), supervisorLayer, opSupervisionLayer);
|
|
1149
1131
|
};
|
|
1150
1132
|
exports.UnifiedTracingLive = effect.Layer.suspend(
|
|
1151
1133
|
() => exports.createUnifiedTracingLayer()
|
|
@@ -1167,11 +1149,7 @@ var init_unified_tracing_supervisor = __esm({
|
|
|
1167
1149
|
const opSupervisionLayer = effect.Layer.effectDiscard(
|
|
1168
1150
|
effect.Effect.patchRuntimeFlags(effect.RuntimeFlagsPatch.enable(effect.RuntimeFlags.OpSupervision))
|
|
1169
1151
|
);
|
|
1170
|
-
const combinedLayer = effect.Layer.mergeAll(
|
|
1171
|
-
supervisorLayer,
|
|
1172
|
-
effect.Layer.enableSourceCapture,
|
|
1173
|
-
opSupervisionLayer
|
|
1174
|
-
);
|
|
1152
|
+
const combinedLayer = effect.Layer.mergeAll(supervisorLayer, opSupervisionLayer);
|
|
1175
1153
|
const wrappedEffect = rootSpanName ? effect$1.pipe(effect.Effect.withSpan(rootSpanName)) : effect$1;
|
|
1176
1154
|
return wrappedEffect.pipe(effect.Effect.provide(combinedLayer));
|
|
1177
1155
|
};
|