@atrim/instrument-node 0.7.0-14fdea7-20260108225522 → 0.7.0-14fdea7-20260108235538
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 +1 -1
- package/target/dist/integrations/effect/auto/index.cjs +153 -62
- package/target/dist/integrations/effect/auto/index.cjs.map +1 -1
- package/target/dist/integrations/effect/auto/index.d.cts +48 -1
- package/target/dist/integrations/effect/auto/index.d.ts +48 -1
- package/target/dist/integrations/effect/auto/index.js +154 -65
- package/target/dist/integrations/effect/auto/index.js.map +1 -1
|
@@ -80,6 +80,53 @@ declare const createEffectTracingLayer: () => Layer.Layer<never>;
|
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
82
|
declare const EffectTracingLive: Layer.Layer<never>;
|
|
83
|
+
/**
|
|
84
|
+
* Create a combined layer that provides both:
|
|
85
|
+
* 1. Effect-native HTTP tracing (via NodeSdk.layer)
|
|
86
|
+
* 2. Fiber-level auto-tracing (via Supervisor)
|
|
87
|
+
*
|
|
88
|
+
* This gives you automatic spans for:
|
|
89
|
+
* - Every HTTP request (from Effect's platform middleware)
|
|
90
|
+
* - Every forked fiber (from our Supervisor)
|
|
91
|
+
*
|
|
92
|
+
* No manual Effect.withSpan() calls needed.
|
|
93
|
+
*/
|
|
94
|
+
declare const createCombinedTracingLayer: () => Layer.Layer<never>;
|
|
95
|
+
/**
|
|
96
|
+
* Combined tracing layer providing both HTTP and fiber-level auto-tracing
|
|
97
|
+
*
|
|
98
|
+
* This is the **most comprehensive** tracing option. You get automatic spans for:
|
|
99
|
+
* - Every HTTP request (from Effect's @effect/platform middleware)
|
|
100
|
+
* - Every forked fiber (from our Supervisor)
|
|
101
|
+
*
|
|
102
|
+
* No manual Effect.withSpan() calls needed - everything is traced automatically.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```yaml
|
|
106
|
+
* # instrumentation.yaml
|
|
107
|
+
* effect:
|
|
108
|
+
* auto_instrumentation:
|
|
109
|
+
* enabled: true
|
|
110
|
+
* granularity: fiber
|
|
111
|
+
* exporter_config:
|
|
112
|
+
* type: otlp
|
|
113
|
+
* endpoint: http://localhost:4318
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* import { CombinedTracingLive } from '@atrim/instrument-node/effect/auto'
|
|
119
|
+
*
|
|
120
|
+
* const HttpLive = router.pipe(
|
|
121
|
+
* HttpServer.serve(),
|
|
122
|
+
* Layer.provide(ServerLive),
|
|
123
|
+
* Layer.provide(CombinedTracingLive),
|
|
124
|
+
* )
|
|
125
|
+
*
|
|
126
|
+
* // Both HTTP requests AND forked fibers are auto-traced!
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare const CombinedTracingLive: Layer.Layer<never>;
|
|
83
130
|
|
|
84
131
|
/**
|
|
85
132
|
* Auto-Tracing Supervisor for Effect-TS
|
|
@@ -434,4 +481,4 @@ declare function inferSpanName(fiberId: number, sourceInfo: SourceInfo | undefin
|
|
|
434
481
|
*/
|
|
435
482
|
declare function sanitizeSpanName(name: string): string;
|
|
436
483
|
|
|
437
|
-
export { AutoTracingConfig, AutoTracingConfigLayer, AutoTracingConfigLive, AutoTracingEnabled, AutoTracingLive, AutoTracingSpanName, AutoTracingSupervisor, EffectTracingLive, FullAutoTracingLive, type SourceInfo, type TemplateVariables, createAutoTracingLayer, createAutoTracingSupervisor, createEffectTracingLayer, createFullAutoTracingLayer, defaultAutoTracingConfig, inferSpanName, loadAutoTracingConfig, loadAutoTracingConfigSync, sanitizeSpanName, setSpanName, withAutoTracing, withoutAutoTracing };
|
|
484
|
+
export { AutoTracingConfig, AutoTracingConfigLayer, AutoTracingConfigLive, AutoTracingEnabled, AutoTracingLive, AutoTracingSpanName, AutoTracingSupervisor, CombinedTracingLive, EffectTracingLive, FullAutoTracingLive, type SourceInfo, type TemplateVariables, createAutoTracingLayer, createAutoTracingSupervisor, createCombinedTracingLayer, createEffectTracingLayer, createFullAutoTracingLayer, defaultAutoTracingConfig, inferSpanName, loadAutoTracingConfig, loadAutoTracingConfigSync, sanitizeSpanName, setSpanName, withAutoTracing, withoutAutoTracing };
|
|
@@ -80,6 +80,53 @@ declare const createEffectTracingLayer: () => Layer.Layer<never>;
|
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
82
|
declare const EffectTracingLive: Layer.Layer<never>;
|
|
83
|
+
/**
|
|
84
|
+
* Create a combined layer that provides both:
|
|
85
|
+
* 1. Effect-native HTTP tracing (via NodeSdk.layer)
|
|
86
|
+
* 2. Fiber-level auto-tracing (via Supervisor)
|
|
87
|
+
*
|
|
88
|
+
* This gives you automatic spans for:
|
|
89
|
+
* - Every HTTP request (from Effect's platform middleware)
|
|
90
|
+
* - Every forked fiber (from our Supervisor)
|
|
91
|
+
*
|
|
92
|
+
* No manual Effect.withSpan() calls needed.
|
|
93
|
+
*/
|
|
94
|
+
declare const createCombinedTracingLayer: () => Layer.Layer<never>;
|
|
95
|
+
/**
|
|
96
|
+
* Combined tracing layer providing both HTTP and fiber-level auto-tracing
|
|
97
|
+
*
|
|
98
|
+
* This is the **most comprehensive** tracing option. You get automatic spans for:
|
|
99
|
+
* - Every HTTP request (from Effect's @effect/platform middleware)
|
|
100
|
+
* - Every forked fiber (from our Supervisor)
|
|
101
|
+
*
|
|
102
|
+
* No manual Effect.withSpan() calls needed - everything is traced automatically.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```yaml
|
|
106
|
+
* # instrumentation.yaml
|
|
107
|
+
* effect:
|
|
108
|
+
* auto_instrumentation:
|
|
109
|
+
* enabled: true
|
|
110
|
+
* granularity: fiber
|
|
111
|
+
* exporter_config:
|
|
112
|
+
* type: otlp
|
|
113
|
+
* endpoint: http://localhost:4318
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* import { CombinedTracingLive } from '@atrim/instrument-node/effect/auto'
|
|
119
|
+
*
|
|
120
|
+
* const HttpLive = router.pipe(
|
|
121
|
+
* HttpServer.serve(),
|
|
122
|
+
* Layer.provide(ServerLive),
|
|
123
|
+
* Layer.provide(CombinedTracingLive),
|
|
124
|
+
* )
|
|
125
|
+
*
|
|
126
|
+
* // Both HTTP requests AND forked fibers are auto-traced!
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare const CombinedTracingLive: Layer.Layer<never>;
|
|
83
130
|
|
|
84
131
|
/**
|
|
85
132
|
* Auto-Tracing Supervisor for Effect-TS
|
|
@@ -434,4 +481,4 @@ declare function inferSpanName(fiberId: number, sourceInfo: SourceInfo | undefin
|
|
|
434
481
|
*/
|
|
435
482
|
declare function sanitizeSpanName(name: string): string;
|
|
436
483
|
|
|
437
|
-
export { AutoTracingConfig, AutoTracingConfigLayer, AutoTracingConfigLive, AutoTracingEnabled, AutoTracingLive, AutoTracingSpanName, AutoTracingSupervisor, EffectTracingLive, FullAutoTracingLive, type SourceInfo, type TemplateVariables, createAutoTracingLayer, createAutoTracingSupervisor, createEffectTracingLayer, createFullAutoTracingLayer, defaultAutoTracingConfig, inferSpanName, loadAutoTracingConfig, loadAutoTracingConfigSync, sanitizeSpanName, setSpanName, withAutoTracing, withoutAutoTracing };
|
|
484
|
+
export { AutoTracingConfig, AutoTracingConfigLayer, AutoTracingConfigLive, AutoTracingEnabled, AutoTracingLive, AutoTracingSpanName, AutoTracingSupervisor, CombinedTracingLive, EffectTracingLive, FullAutoTracingLive, type SourceInfo, type TemplateVariables, createAutoTracingLayer, createAutoTracingSupervisor, createCombinedTracingLayer, createEffectTracingLayer, createFullAutoTracingLayer, defaultAutoTracingConfig, inferSpanName, loadAutoTracingConfig, loadAutoTracingConfigSync, sanitizeSpanName, setSpanName, withAutoTracing, withoutAutoTracing };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Data, Context, Effect, Layer, FiberRef, Option, Supervisor, FiberRefs, Exit } from 'effect';
|
|
1
|
+
import { Data, Context, Effect, Layer, FiberRef, Option, Supervisor, FiberRefs, Tracer, Exit } from 'effect';
|
|
2
2
|
import { NodeSdk } from '@effect/opentelemetry';
|
|
3
|
-
import { SimpleSpanProcessor, ConsoleSpanExporter, BatchSpanProcessor
|
|
3
|
+
import { BasicTracerProvider, SimpleSpanProcessor, ConsoleSpanExporter, BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
4
4
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
5
5
|
import { FileSystem } from '@effect/platform/FileSystem';
|
|
6
6
|
import * as HttpClient from '@effect/platform/HttpClient';
|
|
@@ -586,67 +586,6 @@ var loadFullConfig = (options) => Effect.gen(function* () {
|
|
|
586
586
|
}
|
|
587
587
|
return config;
|
|
588
588
|
});
|
|
589
|
-
|
|
590
|
-
// src/integrations/effect/auto/effect-tracing.ts
|
|
591
|
-
var createEffectTracingLayer = () => {
|
|
592
|
-
return Layer.unwrapEffect(
|
|
593
|
-
Effect.gen(function* () {
|
|
594
|
-
const config = yield* loadFullConfig();
|
|
595
|
-
const serviceName = process.env.OTEL_SERVICE_NAME || "effect-service";
|
|
596
|
-
const serviceVersion = process.env.npm_package_version || "1.0.0";
|
|
597
|
-
const exporterConfig = config.effect?.exporter_config ?? {
|
|
598
|
-
type: "otlp",
|
|
599
|
-
processor: "batch"
|
|
600
|
-
};
|
|
601
|
-
logger.log("@atrim/auto-trace: Effect-native tracing enabled");
|
|
602
|
-
logger.log(` Service: ${serviceName}`);
|
|
603
|
-
logger.log(` Exporter: ${exporterConfig.type}`);
|
|
604
|
-
if (exporterConfig.type === "none") {
|
|
605
|
-
logger.log('@atrim/auto-trace: Exporter type is "none", using empty layer');
|
|
606
|
-
return Layer.empty;
|
|
607
|
-
}
|
|
608
|
-
const createSpanProcessor = () => {
|
|
609
|
-
if (exporterConfig.type === "console") {
|
|
610
|
-
logger.log("@atrim/auto-trace: Using ConsoleSpanExporter with SimpleSpanProcessor");
|
|
611
|
-
return new SimpleSpanProcessor(new ConsoleSpanExporter());
|
|
612
|
-
}
|
|
613
|
-
const endpoint = exporterConfig.endpoint || process.env.OTEL_EXPORTER_OTLP_ENDPOINT || "http://localhost:4318";
|
|
614
|
-
logger.log(`@atrim/auto-trace: Using OTLPTraceExporter (${endpoint})`);
|
|
615
|
-
const otlpConfig = {
|
|
616
|
-
url: `${endpoint}/v1/traces`
|
|
617
|
-
};
|
|
618
|
-
if (exporterConfig.headers) {
|
|
619
|
-
otlpConfig.headers = exporterConfig.headers;
|
|
620
|
-
logger.log(`@atrim/auto-trace: Using custom headers: ${Object.keys(exporterConfig.headers).join(", ")}`);
|
|
621
|
-
}
|
|
622
|
-
const exporter = new OTLPTraceExporter(otlpConfig);
|
|
623
|
-
if (exporterConfig.processor === "simple") {
|
|
624
|
-
logger.log("@atrim/auto-trace: Using SimpleSpanProcessor");
|
|
625
|
-
return new SimpleSpanProcessor(exporter);
|
|
626
|
-
}
|
|
627
|
-
const batchConfig = exporterConfig.batch ?? {
|
|
628
|
-
scheduled_delay_millis: 1e3,
|
|
629
|
-
max_export_batch_size: 100
|
|
630
|
-
};
|
|
631
|
-
logger.log("@atrim/auto-trace: Using BatchSpanProcessor");
|
|
632
|
-
return new BatchSpanProcessor(exporter, {
|
|
633
|
-
scheduledDelayMillis: batchConfig.scheduled_delay_millis,
|
|
634
|
-
maxExportBatchSize: batchConfig.max_export_batch_size
|
|
635
|
-
});
|
|
636
|
-
};
|
|
637
|
-
const sdkLayer = NodeSdk.layer(() => ({
|
|
638
|
-
resource: {
|
|
639
|
-
serviceName,
|
|
640
|
-
serviceVersion
|
|
641
|
-
},
|
|
642
|
-
spanProcessor: createSpanProcessor()
|
|
643
|
-
}));
|
|
644
|
-
logger.log("@atrim/auto-trace: NodeSdk layer created - HTTP requests will be auto-traced");
|
|
645
|
-
return Layer.discard(sdkLayer);
|
|
646
|
-
})
|
|
647
|
-
);
|
|
648
|
-
};
|
|
649
|
-
var EffectTracingLive = createEffectTracingLayer();
|
|
650
589
|
var compiledRulesCache = /* @__PURE__ */ new WeakMap();
|
|
651
590
|
function compileNamingRules(rules) {
|
|
652
591
|
const cached = compiledRulesCache.get(rules);
|
|
@@ -841,7 +780,18 @@ var AutoTracingSupervisor = class extends Supervisor.AbstractSupervisor {
|
|
|
841
780
|
}
|
|
842
781
|
let parentContext = OtelApi.ROOT_CONTEXT;
|
|
843
782
|
let parentFiberId;
|
|
844
|
-
|
|
783
|
+
const maybeEffectParentSpan = Context.getOption(_context, Tracer.ParentSpan);
|
|
784
|
+
if (Option.isSome(maybeEffectParentSpan)) {
|
|
785
|
+
const effectSpan = maybeEffectParentSpan.value;
|
|
786
|
+
const otelSpanContext = {
|
|
787
|
+
traceId: effectSpan.traceId,
|
|
788
|
+
spanId: effectSpan.spanId,
|
|
789
|
+
traceFlags: effectSpan.sampled ? OtelApi.TraceFlags.SAMPLED : OtelApi.TraceFlags.NONE,
|
|
790
|
+
isRemote: false
|
|
791
|
+
};
|
|
792
|
+
const wrappedSpan = OtelApi.trace.wrapSpanContext(otelSpanContext);
|
|
793
|
+
parentContext = OtelApi.trace.setSpan(OtelApi.ROOT_CONTEXT, wrappedSpan);
|
|
794
|
+
} else if (Option.isSome(parent)) {
|
|
845
795
|
parentFiberId = parent.value.id().id;
|
|
846
796
|
const parentSpan = this.fiberSpans.get(parent.value);
|
|
847
797
|
if (parentSpan) {
|
|
@@ -852,6 +802,9 @@ var AutoTracingSupervisor = class extends Supervisor.AbstractSupervisor {
|
|
|
852
802
|
} else if (this._rootSpan) {
|
|
853
803
|
parentContext = OtelApi.trace.setSpan(OtelApi.ROOT_CONTEXT, this._rootSpan);
|
|
854
804
|
}
|
|
805
|
+
if (Option.isSome(parent)) {
|
|
806
|
+
parentFiberId = parent.value.id().id;
|
|
807
|
+
}
|
|
855
808
|
const span = this.tracer.startSpan(
|
|
856
809
|
spanName,
|
|
857
810
|
{
|
|
@@ -1131,6 +1084,142 @@ var createFullAutoTracingLayer = () => {
|
|
|
1131
1084
|
};
|
|
1132
1085
|
var FullAutoTracingLive = createFullAutoTracingLayer();
|
|
1133
1086
|
|
|
1134
|
-
|
|
1087
|
+
// src/integrations/effect/auto/effect-tracing.ts
|
|
1088
|
+
var createEffectTracingLayer = () => {
|
|
1089
|
+
return Layer.unwrapEffect(
|
|
1090
|
+
Effect.gen(function* () {
|
|
1091
|
+
const config = yield* loadFullConfig();
|
|
1092
|
+
const serviceName = process.env.OTEL_SERVICE_NAME || "effect-service";
|
|
1093
|
+
const serviceVersion = process.env.npm_package_version || "1.0.0";
|
|
1094
|
+
const exporterConfig = config.effect?.exporter_config ?? {
|
|
1095
|
+
type: "otlp",
|
|
1096
|
+
processor: "batch"
|
|
1097
|
+
};
|
|
1098
|
+
logger.log("@atrim/auto-trace: Effect-native tracing enabled");
|
|
1099
|
+
logger.log(` Service: ${serviceName}`);
|
|
1100
|
+
logger.log(` Exporter: ${exporterConfig.type}`);
|
|
1101
|
+
if (exporterConfig.type === "none") {
|
|
1102
|
+
logger.log('@atrim/auto-trace: Exporter type is "none", using empty layer');
|
|
1103
|
+
return Layer.empty;
|
|
1104
|
+
}
|
|
1105
|
+
const createSpanProcessor = () => {
|
|
1106
|
+
if (exporterConfig.type === "console") {
|
|
1107
|
+
logger.log("@atrim/auto-trace: Using ConsoleSpanExporter with SimpleSpanProcessor");
|
|
1108
|
+
return new SimpleSpanProcessor(new ConsoleSpanExporter());
|
|
1109
|
+
}
|
|
1110
|
+
const endpoint = exporterConfig.endpoint || process.env.OTEL_EXPORTER_OTLP_ENDPOINT || "http://localhost:4318";
|
|
1111
|
+
logger.log(`@atrim/auto-trace: Using OTLPTraceExporter (${endpoint})`);
|
|
1112
|
+
const otlpConfig = {
|
|
1113
|
+
url: `${endpoint}/v1/traces`
|
|
1114
|
+
};
|
|
1115
|
+
if (exporterConfig.headers) {
|
|
1116
|
+
otlpConfig.headers = exporterConfig.headers;
|
|
1117
|
+
logger.log(`@atrim/auto-trace: Using custom headers: ${Object.keys(exporterConfig.headers).join(", ")}`);
|
|
1118
|
+
}
|
|
1119
|
+
const exporter = new OTLPTraceExporter(otlpConfig);
|
|
1120
|
+
if (exporterConfig.processor === "simple") {
|
|
1121
|
+
logger.log("@atrim/auto-trace: Using SimpleSpanProcessor");
|
|
1122
|
+
return new SimpleSpanProcessor(exporter);
|
|
1123
|
+
}
|
|
1124
|
+
const batchConfig = exporterConfig.batch ?? {
|
|
1125
|
+
scheduled_delay_millis: 1e3,
|
|
1126
|
+
max_export_batch_size: 100
|
|
1127
|
+
};
|
|
1128
|
+
logger.log("@atrim/auto-trace: Using BatchSpanProcessor");
|
|
1129
|
+
return new BatchSpanProcessor(exporter, {
|
|
1130
|
+
scheduledDelayMillis: batchConfig.scheduled_delay_millis,
|
|
1131
|
+
maxExportBatchSize: batchConfig.max_export_batch_size
|
|
1132
|
+
});
|
|
1133
|
+
};
|
|
1134
|
+
const sdkLayer = NodeSdk.layer(() => ({
|
|
1135
|
+
resource: {
|
|
1136
|
+
serviceName,
|
|
1137
|
+
serviceVersion
|
|
1138
|
+
},
|
|
1139
|
+
spanProcessor: createSpanProcessor()
|
|
1140
|
+
}));
|
|
1141
|
+
logger.log("@atrim/auto-trace: NodeSdk layer created - HTTP requests will be auto-traced");
|
|
1142
|
+
return Layer.discard(sdkLayer);
|
|
1143
|
+
})
|
|
1144
|
+
);
|
|
1145
|
+
};
|
|
1146
|
+
var EffectTracingLive = createEffectTracingLayer();
|
|
1147
|
+
var createCombinedTracingLayer = () => {
|
|
1148
|
+
return Layer.unwrapEffect(
|
|
1149
|
+
Effect.gen(function* () {
|
|
1150
|
+
const config = yield* loadFullConfig();
|
|
1151
|
+
const serviceName = process.env.OTEL_SERVICE_NAME || "effect-service";
|
|
1152
|
+
const serviceVersion = process.env.npm_package_version || "1.0.0";
|
|
1153
|
+
const exporterConfig = config.effect?.exporter_config ?? {
|
|
1154
|
+
type: "otlp",
|
|
1155
|
+
processor: "batch"
|
|
1156
|
+
};
|
|
1157
|
+
const autoConfig = config.effect?.auto_instrumentation ?? {
|
|
1158
|
+
enabled: true,
|
|
1159
|
+
granularity: "fiber",
|
|
1160
|
+
span_naming: {
|
|
1161
|
+
default: "effect.{function}",
|
|
1162
|
+
infer_from_source: true,
|
|
1163
|
+
rules: []
|
|
1164
|
+
},
|
|
1165
|
+
filter: { include: [], exclude: [] },
|
|
1166
|
+
performance: { sampling_rate: 1, min_duration: "0ms", max_concurrent: 0 },
|
|
1167
|
+
metadata: { fiber_info: true, source_location: true, parent_fiber: true }
|
|
1168
|
+
};
|
|
1169
|
+
logger.log("@atrim/auto-trace: Combined tracing enabled (HTTP + Fiber)");
|
|
1170
|
+
logger.log(` Service: ${serviceName}`);
|
|
1171
|
+
logger.log(` Exporter: ${exporterConfig.type}`);
|
|
1172
|
+
if (exporterConfig.type === "none") {
|
|
1173
|
+
logger.log('@atrim/auto-trace: Exporter type is "none", using empty layer');
|
|
1174
|
+
return Layer.empty;
|
|
1175
|
+
}
|
|
1176
|
+
const createSpanProcessor = () => {
|
|
1177
|
+
if (exporterConfig.type === "console") {
|
|
1178
|
+
logger.log("@atrim/auto-trace: Using ConsoleSpanExporter with SimpleSpanProcessor");
|
|
1179
|
+
return new SimpleSpanProcessor(new ConsoleSpanExporter());
|
|
1180
|
+
}
|
|
1181
|
+
const endpoint = exporterConfig.endpoint || process.env.OTEL_EXPORTER_OTLP_ENDPOINT || "http://localhost:4318";
|
|
1182
|
+
logger.log(`@atrim/auto-trace: Using OTLPTraceExporter (${endpoint})`);
|
|
1183
|
+
const otlpConfig = {
|
|
1184
|
+
url: `${endpoint}/v1/traces`
|
|
1185
|
+
};
|
|
1186
|
+
if (exporterConfig.headers) {
|
|
1187
|
+
otlpConfig.headers = exporterConfig.headers;
|
|
1188
|
+
logger.log(`@atrim/auto-trace: Using custom headers: ${Object.keys(exporterConfig.headers).join(", ")}`);
|
|
1189
|
+
}
|
|
1190
|
+
const exporter = new OTLPTraceExporter(otlpConfig);
|
|
1191
|
+
if (exporterConfig.processor === "simple") {
|
|
1192
|
+
logger.log("@atrim/auto-trace: Using SimpleSpanProcessor");
|
|
1193
|
+
return new SimpleSpanProcessor(exporter);
|
|
1194
|
+
}
|
|
1195
|
+
const batchConfig = exporterConfig.batch ?? {
|
|
1196
|
+
scheduled_delay_millis: 1e3,
|
|
1197
|
+
max_export_batch_size: 100
|
|
1198
|
+
};
|
|
1199
|
+
logger.log("@atrim/auto-trace: Using BatchSpanProcessor");
|
|
1200
|
+
return new BatchSpanProcessor(exporter, {
|
|
1201
|
+
scheduledDelayMillis: batchConfig.scheduled_delay_millis,
|
|
1202
|
+
maxExportBatchSize: batchConfig.max_export_batch_size
|
|
1203
|
+
});
|
|
1204
|
+
};
|
|
1205
|
+
const sdkLayer = NodeSdk.layer(() => ({
|
|
1206
|
+
resource: {
|
|
1207
|
+
serviceName,
|
|
1208
|
+
serviceVersion
|
|
1209
|
+
},
|
|
1210
|
+
spanProcessor: createSpanProcessor()
|
|
1211
|
+
}));
|
|
1212
|
+
const supervisor = createAutoTracingSupervisor(autoConfig);
|
|
1213
|
+
const supervisorLayer = Supervisor.addSupervisor(supervisor);
|
|
1214
|
+
logger.log("@atrim/auto-trace: Combined layer created");
|
|
1215
|
+
logger.log(" - HTTP requests: auto-traced via Effect platform");
|
|
1216
|
+
logger.log(" - Forked fibers: auto-traced via Supervisor");
|
|
1217
|
+
return supervisorLayer.pipe(Layer.provideMerge(Layer.discard(sdkLayer)));
|
|
1218
|
+
})
|
|
1219
|
+
);
|
|
1220
|
+
};
|
|
1221
|
+
var CombinedTracingLive = createCombinedTracingLayer();
|
|
1222
|
+
|
|
1223
|
+
export { AutoTracingConfig, AutoTracingConfigLayer, AutoTracingConfigLive, AutoTracingEnabled, AutoTracingLive, AutoTracingSpanName, AutoTracingSupervisor, CombinedTracingLive, EffectTracingLive, FullAutoTracingLive, createAutoTracingLayer, createAutoTracingSupervisor, createCombinedTracingLayer, createEffectTracingLayer, createFullAutoTracingLayer, defaultAutoTracingConfig, inferSpanName, loadAutoTracingConfig, loadAutoTracingConfigSync, sanitizeSpanName, setSpanName, withAutoTracing, withoutAutoTracing };
|
|
1135
1224
|
//# sourceMappingURL=index.js.map
|
|
1136
1225
|
//# sourceMappingURL=index.js.map
|