@atrim/instrument-node 0.7.0 → 0.7.1-dev.14fdea7.20260108224013
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 +93 -2
- package/target/dist/index.cjs.map +1 -1
- package/target/dist/index.js +93 -2
- package/target/dist/index.js.map +1 -1
- package/target/dist/integrations/effect/auto/index.cjs +1117 -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 +1074 -0
- package/target/dist/integrations/effect/auto/index.js.map +1 -0
- package/target/dist/integrations/effect/index.cjs +93 -2
- package/target/dist/integrations/effect/index.cjs.map +1 -1
- package/target/dist/integrations/effect/index.js +93 -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.20260108224013",
|
|
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,30 @@ 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
|
+
// Custom headers to send with OTLP requests (for type: otlp)
|
|
173
|
+
// Useful for authentication (x-api-key, Authorization, etc.)
|
|
174
|
+
headers: zod.z.record(zod.z.string()).optional(),
|
|
175
|
+
// Span processor type
|
|
176
|
+
// - 'batch': Batch spans for export (production, lower overhead)
|
|
177
|
+
// - 'simple': Export immediately (development, no batching delay)
|
|
178
|
+
processor: zod.z.enum(["batch", "simple"]).default("batch"),
|
|
179
|
+
// Batch processor settings (for processor: batch)
|
|
180
|
+
batch: zod.z.object({
|
|
181
|
+
// Max time to wait before exporting (milliseconds)
|
|
182
|
+
scheduled_delay_millis: zod.z.number().default(1e3),
|
|
183
|
+
// Max batch size
|
|
184
|
+
max_export_batch_size: zod.z.number().default(100)
|
|
185
|
+
}).optional()
|
|
186
|
+
});
|
|
100
187
|
var InstrumentationConfigSchema = zod.z.object({
|
|
101
188
|
version: zod.z.string(),
|
|
102
189
|
instrumentation: zod.z.object({
|
|
@@ -110,12 +197,16 @@ var InstrumentationConfigSchema = zod.z.object({
|
|
|
110
197
|
// Enable/disable Effect tracing entirely
|
|
111
198
|
// When false, EffectInstrumentationLive returns Layer.empty
|
|
112
199
|
enabled: zod.z.boolean().default(true),
|
|
113
|
-
// Exporter mode:
|
|
200
|
+
// Exporter mode (legacy - use exporter.type instead):
|
|
114
201
|
// - "unified": Use global TracerProvider from Node SDK (recommended, enables filtering)
|
|
115
202
|
// - "standalone": Use Effect's own OTLP exporter (bypasses Node SDK filtering)
|
|
116
203
|
exporter: zod.z.enum(["unified", "standalone"]).default("unified"),
|
|
204
|
+
// Exporter configuration (for auto-instrumentation)
|
|
205
|
+
exporter_config: ExporterConfigSchema.optional(),
|
|
117
206
|
auto_extract_metadata: zod.z.boolean(),
|
|
118
|
-
auto_isolation: AutoIsolationConfigSchema.optional()
|
|
207
|
+
auto_isolation: AutoIsolationConfigSchema.optional(),
|
|
208
|
+
// Auto-instrumentation: automatic tracing of all Effect fibers
|
|
209
|
+
auto_instrumentation: AutoInstrumentationConfigSchema.optional()
|
|
119
210
|
}).optional(),
|
|
120
211
|
http: HttpFilteringConfigSchema.optional()
|
|
121
212
|
});
|