@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/target/dist/index.js
CHANGED
|
@@ -52,6 +52,69 @@ var AutoIsolationConfigSchema = z.object({
|
|
|
52
52
|
add_metadata: z.boolean().default(true)
|
|
53
53
|
}).default({})
|
|
54
54
|
});
|
|
55
|
+
var SpanNamingRuleSchema = z.object({
|
|
56
|
+
// Match criteria (all specified criteria must match)
|
|
57
|
+
match: z.object({
|
|
58
|
+
// Regex pattern to match file path
|
|
59
|
+
file: z.string().optional(),
|
|
60
|
+
// Regex pattern to match function name
|
|
61
|
+
function: z.string().optional(),
|
|
62
|
+
// Regex pattern to match module name
|
|
63
|
+
module: z.string().optional()
|
|
64
|
+
}),
|
|
65
|
+
// Span name template with variables:
|
|
66
|
+
// {fiber_id} - Fiber ID
|
|
67
|
+
// {function} - Function name
|
|
68
|
+
// {module} - Module name
|
|
69
|
+
// {file} - File path
|
|
70
|
+
// {line} - Line number
|
|
71
|
+
// {operator} - Effect operator (gen, all, forEach, etc.)
|
|
72
|
+
// {match:field:N} - Captured regex group from match
|
|
73
|
+
name: z.string()
|
|
74
|
+
});
|
|
75
|
+
var AutoInstrumentationConfigSchema = z.object({
|
|
76
|
+
// Enable/disable auto-instrumentation
|
|
77
|
+
enabled: z.boolean().default(false),
|
|
78
|
+
// Tracing granularity
|
|
79
|
+
// - 'fiber': Trace at fiber creation (recommended, lower overhead)
|
|
80
|
+
// - 'operator': Trace each Effect operator (higher granularity, more overhead)
|
|
81
|
+
granularity: z.enum(["fiber", "operator"]).default("fiber"),
|
|
82
|
+
// Smart span naming configuration
|
|
83
|
+
span_naming: z.object({
|
|
84
|
+
// Default span name template when no rules match
|
|
85
|
+
default: z.string().default("effect.fiber.{fiber_id}"),
|
|
86
|
+
// Infer span names from source code (requires stack trace parsing)
|
|
87
|
+
// Adds ~50-100μs overhead per fiber
|
|
88
|
+
infer_from_source: z.boolean().default(true),
|
|
89
|
+
// Naming rules (first match wins)
|
|
90
|
+
rules: z.array(SpanNamingRuleSchema).default([])
|
|
91
|
+
}).default({}),
|
|
92
|
+
// Pattern-based filtering
|
|
93
|
+
filter: z.object({
|
|
94
|
+
// Only trace spans matching these patterns (empty = trace all)
|
|
95
|
+
include: z.array(z.string()).default([]),
|
|
96
|
+
// Never trace spans matching these patterns
|
|
97
|
+
exclude: z.array(z.string()).default([])
|
|
98
|
+
}).default({}),
|
|
99
|
+
// Performance controls
|
|
100
|
+
performance: z.object({
|
|
101
|
+
// Sample rate (0.0 - 1.0)
|
|
102
|
+
sampling_rate: z.number().min(0).max(1).default(1),
|
|
103
|
+
// Skip fibers shorter than this duration (e.g., "10ms", "100 millis")
|
|
104
|
+
min_duration: z.string().default("0ms"),
|
|
105
|
+
// Maximum concurrent traced fibers (0 = unlimited)
|
|
106
|
+
max_concurrent: z.number().default(0)
|
|
107
|
+
}).default({}),
|
|
108
|
+
// Automatic metadata extraction
|
|
109
|
+
metadata: z.object({
|
|
110
|
+
// Extract Effect fiber information
|
|
111
|
+
fiber_info: z.boolean().default(true),
|
|
112
|
+
// Extract source location (file:line)
|
|
113
|
+
source_location: z.boolean().default(true),
|
|
114
|
+
// Extract parent fiber information
|
|
115
|
+
parent_fiber: z.boolean().default(true)
|
|
116
|
+
}).default({})
|
|
117
|
+
});
|
|
55
118
|
var HttpFilteringConfigSchema = z.object({
|
|
56
119
|
// Patterns to ignore for outgoing HTTP requests (string patterns only in YAML)
|
|
57
120
|
ignore_outgoing_urls: z.array(z.string()).optional(),
|
|
@@ -73,6 +136,27 @@ var HttpFilteringConfigSchema = z.object({
|
|
|
73
136
|
include_urls: z.array(z.string()).optional()
|
|
74
137
|
}).optional()
|
|
75
138
|
});
|
|
139
|
+
var ExporterConfigSchema = z.object({
|
|
140
|
+
// Exporter type: 'otlp' | 'console' | 'none'
|
|
141
|
+
// - 'otlp': Export to OTLP endpoint (production)
|
|
142
|
+
// - 'console': Log spans to console (development)
|
|
143
|
+
// - 'none': No export (disable tracing)
|
|
144
|
+
type: z.enum(["otlp", "console", "none"]).default("otlp"),
|
|
145
|
+
// OTLP endpoint URL (for type: otlp)
|
|
146
|
+
// Defaults to OTEL_EXPORTER_OTLP_ENDPOINT env var or http://localhost:4318
|
|
147
|
+
endpoint: z.string().optional(),
|
|
148
|
+
// Span processor type
|
|
149
|
+
// - 'batch': Batch spans for export (production, lower overhead)
|
|
150
|
+
// - 'simple': Export immediately (development, no batching delay)
|
|
151
|
+
processor: z.enum(["batch", "simple"]).default("batch"),
|
|
152
|
+
// Batch processor settings (for processor: batch)
|
|
153
|
+
batch: z.object({
|
|
154
|
+
// Max time to wait before exporting (milliseconds)
|
|
155
|
+
scheduled_delay_millis: z.number().default(1e3),
|
|
156
|
+
// Max batch size
|
|
157
|
+
max_export_batch_size: z.number().default(100)
|
|
158
|
+
}).optional()
|
|
159
|
+
});
|
|
76
160
|
var InstrumentationConfigSchema = z.object({
|
|
77
161
|
version: z.string(),
|
|
78
162
|
instrumentation: z.object({
|
|
@@ -86,12 +170,16 @@ var InstrumentationConfigSchema = z.object({
|
|
|
86
170
|
// Enable/disable Effect tracing entirely
|
|
87
171
|
// When false, EffectInstrumentationLive returns Layer.empty
|
|
88
172
|
enabled: z.boolean().default(true),
|
|
89
|
-
// Exporter mode:
|
|
173
|
+
// Exporter mode (legacy - use exporter.type instead):
|
|
90
174
|
// - "unified": Use global TracerProvider from Node SDK (recommended, enables filtering)
|
|
91
175
|
// - "standalone": Use Effect's own OTLP exporter (bypasses Node SDK filtering)
|
|
92
176
|
exporter: z.enum(["unified", "standalone"]).default("unified"),
|
|
177
|
+
// Exporter configuration (for auto-instrumentation)
|
|
178
|
+
exporter_config: ExporterConfigSchema.optional(),
|
|
93
179
|
auto_extract_metadata: z.boolean(),
|
|
94
|
-
auto_isolation: AutoIsolationConfigSchema.optional()
|
|
180
|
+
auto_isolation: AutoIsolationConfigSchema.optional(),
|
|
181
|
+
// Auto-instrumentation: automatic tracing of all Effect fibers
|
|
182
|
+
auto_instrumentation: AutoInstrumentationConfigSchema.optional()
|
|
95
183
|
}).optional(),
|
|
96
184
|
http: HttpFilteringConfigSchema.optional()
|
|
97
185
|
});
|