@atrim/instrument-node 0.4.1 → 0.5.0-3a3dd2c-20251124202015

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.
@@ -53,13 +53,69 @@ var AutoIsolationConfigSchema = z.object({
53
53
  add_metadata: z.boolean().default(true)
54
54
  }).default({})
55
55
  });
56
+ var SpanNamingRuleSchema = z.object({
57
+ // Match conditions (all specified conditions must match)
58
+ match: z.object({
59
+ // Match by file path pattern (regex)
60
+ file: z.string().optional(),
61
+ // Match by function name pattern (regex)
62
+ function: z.string().optional(),
63
+ // Match by operator type (gen, all, forEach, etc.)
64
+ operator: z.string().optional(),
65
+ // Match by call stack pattern (regex)
66
+ stack: z.string().optional(),
67
+ // Match by fiber annotation key
68
+ annotation: z.string().optional()
69
+ }),
70
+ // Name template with substitution variables
71
+ // Available: {operator}, {function}, {module}, {file}, {line}, {class}, {match:N}
72
+ name: z.string()
73
+ });
74
+ var AutoTracingConfigSchema = z.object({
75
+ // Global enable/disable for auto-tracing
76
+ enabled: z.boolean().default(true),
77
+ // Span naming configuration
78
+ span_naming: z.object({
79
+ // Default name template when no rules match
80
+ default: z.string().default("effect.{operator}"),
81
+ // Custom naming rules (applied in order, first match wins)
82
+ rules: z.array(SpanNamingRuleSchema).default([])
83
+ }).default({}),
84
+ // Pattern filtering
85
+ filter_patterns: z.object({
86
+ // Only trace spans matching these patterns
87
+ include: z.array(z.string()).default([]),
88
+ // Exclude spans matching these patterns (takes precedence)
89
+ exclude: z.array(z.string()).default([])
90
+ }).default({}),
91
+ // Sampling configuration
92
+ sampling: z.object({
93
+ // Sampling rate (0.0 to 1.0)
94
+ rate: z.number().min(0).max(1).default(1),
95
+ // Only trace effects with duration > this value
96
+ min_duration: z.string().default("0 millis")
97
+ }).default({})
98
+ });
56
99
  var HttpFilteringConfigSchema = z.object({
57
100
  // Patterns to ignore for outgoing HTTP requests (string patterns only in YAML)
58
101
  ignore_outgoing_urls: z.array(z.string()).optional(),
59
102
  // Patterns to ignore for incoming HTTP requests (string patterns only in YAML)
60
103
  ignore_incoming_paths: z.array(z.string()).optional(),
61
104
  // Require parent span for outgoing requests (prevents root spans for HTTP calls)
62
- require_parent_for_outgoing_spans: z.boolean().optional()
105
+ require_parent_for_outgoing_spans: z.boolean().optional(),
106
+ // Trace context propagation configuration
107
+ // Controls which cross-origin requests receive W3C Trace Context headers (traceparent, tracestate)
108
+ propagate_trace_context: z.object({
109
+ // Strategy for trace propagation
110
+ // - "all": Propagate to all cross-origin requests (may cause CORS errors)
111
+ // - "none": Never propagate trace headers
112
+ // - "same-origin": Only propagate to same-origin requests (default, safe)
113
+ // - "patterns": Propagate based on include_urls patterns
114
+ strategy: z.enum(["all", "none", "same-origin", "patterns"]).default("same-origin"),
115
+ // URL patterns to include when strategy is "patterns"
116
+ // Supports regex patterns (e.g., "^https://api\\.myapp\\.com")
117
+ include_urls: z.array(z.string()).optional()
118
+ }).optional()
63
119
  });
64
120
  var InstrumentationConfigSchema = z.object({
65
121
  version: z.string(),
@@ -72,7 +128,8 @@ var InstrumentationConfigSchema = z.object({
72
128
  }),
73
129
  effect: z.object({
74
130
  auto_extract_metadata: z.boolean(),
75
- auto_isolation: AutoIsolationConfigSchema.optional()
131
+ auto_isolation: AutoIsolationConfigSchema.optional(),
132
+ auto_tracing: AutoTracingConfigSchema.optional()
76
133
  }).optional(),
77
134
  http: HttpFilteringConfigSchema.optional()
78
135
  });