@atrim/instrument-node 0.6.0 → 0.7.0-b9eaf74-20260108193056

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.
@@ -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(),
@@ -91,7 +154,9 @@ var InstrumentationConfigSchema = z.object({
91
154
  // - "standalone": Use Effect's own OTLP exporter (bypasses Node SDK filtering)
92
155
  exporter: z.enum(["unified", "standalone"]).default("unified"),
93
156
  auto_extract_metadata: z.boolean(),
94
- auto_isolation: AutoIsolationConfigSchema.optional()
157
+ auto_isolation: AutoIsolationConfigSchema.optional(),
158
+ // Auto-instrumentation: automatic tracing of all Effect fibers
159
+ auto_instrumentation: AutoInstrumentationConfigSchema.optional()
95
160
  }).optional(),
96
161
  http: HttpFilteringConfigSchema.optional()
97
162
  });