@atrim/instrument-node 0.7.0 → 0.7.1-dev.14fdea7.20260108220010
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 +6 -1
- package/target/dist/index.cjs +90 -2
- package/target/dist/index.cjs.map +1 -1
- package/target/dist/index.js +90 -2
- package/target/dist/index.js.map +1 -1
- package/target/dist/integrations/effect/auto/index.cjs +1109 -0
- package/target/dist/integrations/effect/auto/index.cjs.map +1 -0
- package/target/dist/integrations/effect/auto/index.d.cts +359 -0
- package/target/dist/integrations/effect/auto/index.d.ts +359 -0
- package/target/dist/integrations/effect/auto/index.js +1066 -0
- package/target/dist/integrations/effect/auto/index.js.map +1 -0
- package/target/dist/integrations/effect/index.cjs +90 -2
- package/target/dist/integrations/effect/index.cjs.map +1 -1
- package/target/dist/integrations/effect/index.js +90 -2
- package/target/dist/integrations/effect/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atrim/instrument-node",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1-dev.14fdea7.20260108220010",
|
|
4
4
|
"description": "OpenTelemetry instrumentation for Node.js with centralized YAML configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
"types": "./target/dist/integrations/effect/index.d.ts",
|
|
44
44
|
"import": "./target/dist/integrations/effect/index.js",
|
|
45
45
|
"require": "./target/dist/integrations/effect/index.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./effect/auto": {
|
|
48
|
+
"types": "./target/dist/integrations/effect/auto/index.d.ts",
|
|
49
|
+
"import": "./target/dist/integrations/effect/auto/index.js",
|
|
50
|
+
"require": "./target/dist/integrations/effect/auto/index.cjs"
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
53
|
"main": "./target/dist/index.js",
|
package/target/dist/index.cjs
CHANGED
|
@@ -76,6 +76,69 @@ var AutoIsolationConfigSchema = zod.z.object({
|
|
|
76
76
|
add_metadata: zod.z.boolean().default(true)
|
|
77
77
|
}).default({})
|
|
78
78
|
});
|
|
79
|
+
var SpanNamingRuleSchema = zod.z.object({
|
|
80
|
+
// Match criteria (all specified criteria must match)
|
|
81
|
+
match: zod.z.object({
|
|
82
|
+
// Regex pattern to match file path
|
|
83
|
+
file: zod.z.string().optional(),
|
|
84
|
+
// Regex pattern to match function name
|
|
85
|
+
function: zod.z.string().optional(),
|
|
86
|
+
// Regex pattern to match module name
|
|
87
|
+
module: zod.z.string().optional()
|
|
88
|
+
}),
|
|
89
|
+
// Span name template with variables:
|
|
90
|
+
// {fiber_id} - Fiber ID
|
|
91
|
+
// {function} - Function name
|
|
92
|
+
// {module} - Module name
|
|
93
|
+
// {file} - File path
|
|
94
|
+
// {line} - Line number
|
|
95
|
+
// {operator} - Effect operator (gen, all, forEach, etc.)
|
|
96
|
+
// {match:field:N} - Captured regex group from match
|
|
97
|
+
name: zod.z.string()
|
|
98
|
+
});
|
|
99
|
+
var AutoInstrumentationConfigSchema = zod.z.object({
|
|
100
|
+
// Enable/disable auto-instrumentation
|
|
101
|
+
enabled: zod.z.boolean().default(false),
|
|
102
|
+
// Tracing granularity
|
|
103
|
+
// - 'fiber': Trace at fiber creation (recommended, lower overhead)
|
|
104
|
+
// - 'operator': Trace each Effect operator (higher granularity, more overhead)
|
|
105
|
+
granularity: zod.z.enum(["fiber", "operator"]).default("fiber"),
|
|
106
|
+
// Smart span naming configuration
|
|
107
|
+
span_naming: zod.z.object({
|
|
108
|
+
// Default span name template when no rules match
|
|
109
|
+
default: zod.z.string().default("effect.fiber.{fiber_id}"),
|
|
110
|
+
// Infer span names from source code (requires stack trace parsing)
|
|
111
|
+
// Adds ~50-100μs overhead per fiber
|
|
112
|
+
infer_from_source: zod.z.boolean().default(true),
|
|
113
|
+
// Naming rules (first match wins)
|
|
114
|
+
rules: zod.z.array(SpanNamingRuleSchema).default([])
|
|
115
|
+
}).default({}),
|
|
116
|
+
// Pattern-based filtering
|
|
117
|
+
filter: zod.z.object({
|
|
118
|
+
// Only trace spans matching these patterns (empty = trace all)
|
|
119
|
+
include: zod.z.array(zod.z.string()).default([]),
|
|
120
|
+
// Never trace spans matching these patterns
|
|
121
|
+
exclude: zod.z.array(zod.z.string()).default([])
|
|
122
|
+
}).default({}),
|
|
123
|
+
// Performance controls
|
|
124
|
+
performance: zod.z.object({
|
|
125
|
+
// Sample rate (0.0 - 1.0)
|
|
126
|
+
sampling_rate: zod.z.number().min(0).max(1).default(1),
|
|
127
|
+
// Skip fibers shorter than this duration (e.g., "10ms", "100 millis")
|
|
128
|
+
min_duration: zod.z.string().default("0ms"),
|
|
129
|
+
// Maximum concurrent traced fibers (0 = unlimited)
|
|
130
|
+
max_concurrent: zod.z.number().default(0)
|
|
131
|
+
}).default({}),
|
|
132
|
+
// Automatic metadata extraction
|
|
133
|
+
metadata: zod.z.object({
|
|
134
|
+
// Extract Effect fiber information
|
|
135
|
+
fiber_info: zod.z.boolean().default(true),
|
|
136
|
+
// Extract source location (file:line)
|
|
137
|
+
source_location: zod.z.boolean().default(true),
|
|
138
|
+
// Extract parent fiber information
|
|
139
|
+
parent_fiber: zod.z.boolean().default(true)
|
|
140
|
+
}).default({})
|
|
141
|
+
});
|
|
79
142
|
var HttpFilteringConfigSchema = zod.z.object({
|
|
80
143
|
// Patterns to ignore for outgoing HTTP requests (string patterns only in YAML)
|
|
81
144
|
ignore_outgoing_urls: zod.z.array(zod.z.string()).optional(),
|
|
@@ -97,6 +160,27 @@ var HttpFilteringConfigSchema = zod.z.object({
|
|
|
97
160
|
include_urls: zod.z.array(zod.z.string()).optional()
|
|
98
161
|
}).optional()
|
|
99
162
|
});
|
|
163
|
+
var ExporterConfigSchema = zod.z.object({
|
|
164
|
+
// Exporter type: 'otlp' | 'console' | 'none'
|
|
165
|
+
// - 'otlp': Export to OTLP endpoint (production)
|
|
166
|
+
// - 'console': Log spans to console (development)
|
|
167
|
+
// - 'none': No export (disable tracing)
|
|
168
|
+
type: zod.z.enum(["otlp", "console", "none"]).default("otlp"),
|
|
169
|
+
// OTLP endpoint URL (for type: otlp)
|
|
170
|
+
// Defaults to OTEL_EXPORTER_OTLP_ENDPOINT env var or http://localhost:4318
|
|
171
|
+
endpoint: zod.z.string().optional(),
|
|
172
|
+
// Span processor type
|
|
173
|
+
// - 'batch': Batch spans for export (production, lower overhead)
|
|
174
|
+
// - 'simple': Export immediately (development, no batching delay)
|
|
175
|
+
processor: zod.z.enum(["batch", "simple"]).default("batch"),
|
|
176
|
+
// Batch processor settings (for processor: batch)
|
|
177
|
+
batch: zod.z.object({
|
|
178
|
+
// Max time to wait before exporting (milliseconds)
|
|
179
|
+
scheduled_delay_millis: zod.z.number().default(1e3),
|
|
180
|
+
// Max batch size
|
|
181
|
+
max_export_batch_size: zod.z.number().default(100)
|
|
182
|
+
}).optional()
|
|
183
|
+
});
|
|
100
184
|
var InstrumentationConfigSchema = zod.z.object({
|
|
101
185
|
version: zod.z.string(),
|
|
102
186
|
instrumentation: zod.z.object({
|
|
@@ -110,12 +194,16 @@ var InstrumentationConfigSchema = zod.z.object({
|
|
|
110
194
|
// Enable/disable Effect tracing entirely
|
|
111
195
|
// When false, EffectInstrumentationLive returns Layer.empty
|
|
112
196
|
enabled: zod.z.boolean().default(true),
|
|
113
|
-
// Exporter mode:
|
|
197
|
+
// Exporter mode (legacy - use exporter.type instead):
|
|
114
198
|
// - "unified": Use global TracerProvider from Node SDK (recommended, enables filtering)
|
|
115
199
|
// - "standalone": Use Effect's own OTLP exporter (bypasses Node SDK filtering)
|
|
116
200
|
exporter: zod.z.enum(["unified", "standalone"]).default("unified"),
|
|
201
|
+
// Exporter configuration (for auto-instrumentation)
|
|
202
|
+
exporter_config: ExporterConfigSchema.optional(),
|
|
117
203
|
auto_extract_metadata: zod.z.boolean(),
|
|
118
|
-
auto_isolation: AutoIsolationConfigSchema.optional()
|
|
204
|
+
auto_isolation: AutoIsolationConfigSchema.optional(),
|
|
205
|
+
// Auto-instrumentation: automatic tracing of all Effect fibers
|
|
206
|
+
auto_instrumentation: AutoInstrumentationConfigSchema.optional()
|
|
119
207
|
}).optional(),
|
|
120
208
|
http: HttpFilteringConfigSchema.optional()
|
|
121
209
|
});
|