@atrim/instrument-node 0.4.1 → 0.5.0-14fdea7-20260108232035
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/README.md +97 -269
- package/package.json +27 -21
- package/target/dist/index.d.cts +28 -13
- package/target/dist/index.d.ts +28 -13
- package/target/dist/integrations/effect/auto/index.d.cts +484 -0
- package/target/dist/integrations/effect/auto/index.d.ts +484 -0
- package/target/dist/integrations/effect/index.d.cts +206 -36
- package/target/dist/integrations/effect/index.d.ts +206 -36
- package/target/dist/index.cjs +0 -1268
- package/target/dist/index.cjs.map +0 -1
- package/target/dist/index.js +0 -1206
- package/target/dist/index.js.map +0 -1
- package/target/dist/integrations/effect/index.cjs +0 -744
- package/target/dist/integrations/effect/index.cjs.map +0 -1
- package/target/dist/integrations/effect/index.js +0 -706
- package/target/dist/integrations/effect/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
# @atrim/instrument-node
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Configuration layer for OpenTelemetry Node.js**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@atrim/instrument-node)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Built on [@opentelemetry/auto-instrumentations-node](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node), this package adds centralized YAML configuration, pattern-based span filtering, and first-class Effect-TS integration.
|
|
9
9
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
**1. Install**
|
|
10
|
+
## What This Package Adds
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
| Feature | Description |
|
|
13
|
+
|---------|-------------|
|
|
14
|
+
| **Pattern-based span filtering** | Control which spans are created via YAML config (unique to this package) |
|
|
15
|
+
| **Centralized configuration** | Load instrumentation config from file, URL, or environment variable |
|
|
16
|
+
| **Effect-TS integration** | Typed layers, annotation helpers for Effect users |
|
|
17
|
+
| **Smart defaults** | Auto-detects service name, configures graceful shutdown |
|
|
17
18
|
|
|
18
|
-
**
|
|
19
|
+
**Note:** Auto-instrumentation for Express, HTTP, Fastify, etc. comes from the underlying OpenTelemetry packages. This library configures and extends that functionality.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
## Installation
|
|
21
22
|
|
|
22
|
-
```
|
|
23
|
-
|
|
23
|
+
```bash
|
|
24
|
+
# Required
|
|
25
|
+
npm install @atrim/instrument-node @opentelemetry/api
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
# Optional: Effect-TS integration
|
|
28
|
+
npm install effect @effect/opentelemetry @effect/platform @effect/platform-node
|
|
26
29
|
```
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
## Quick Start
|
|
29
32
|
|
|
30
33
|
```typescript
|
|
31
|
-
import {
|
|
32
|
-
import { initializeInstrumentationEffect } from '@atrim/instrument-node'
|
|
34
|
+
import { initializeInstrumentation } from '@atrim/instrument-node'
|
|
33
35
|
|
|
34
|
-
await
|
|
36
|
+
await initializeInstrumentation()
|
|
37
|
+
// Done! Traces go to http://localhost:4318
|
|
35
38
|
```
|
|
36
39
|
|
|
37
|
-
**
|
|
38
|
-
|
|
39
|
-
By default, traces go to `http://localhost:4318`. To send to a remote collector:
|
|
40
|
+
**Remote collector:**
|
|
40
41
|
|
|
41
42
|
```typescript
|
|
42
43
|
await initializeInstrumentation({
|
|
@@ -44,308 +45,135 @@ await initializeInstrumentation({
|
|
|
44
45
|
})
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Auto-detected and configured:
|
|
50
|
-
- ✅ Service name from `package.json`
|
|
51
|
-
- ✅ OTLP endpoint (local or remote)
|
|
52
|
-
- ✅ Auto-instrumentation for Express, HTTP, Fastify, etc.
|
|
53
|
-
- ✅ Graceful shutdown on SIGTERM/SIGINT
|
|
54
|
-
|
|
55
|
-
## Optional: Control What Gets Traced
|
|
56
|
-
|
|
57
|
-
Create `instrumentation.yaml` in your project root:
|
|
58
|
-
|
|
59
|
-
```yaml
|
|
60
|
-
version: "1.0"
|
|
61
|
-
instrumentation:
|
|
62
|
-
enabled: true
|
|
63
|
-
instrument_patterns:
|
|
64
|
-
- pattern: "^app\\." # ✅ Trace application operations
|
|
65
|
-
ignore_patterns:
|
|
66
|
-
- pattern: "^health\\." # ❌ Skip health checks
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
That's it!
|
|
70
|
-
|
|
71
|
-
## Features
|
|
72
|
-
|
|
73
|
-
- **Zero-config** - Works out of the box with sensible defaults
|
|
74
|
-
- **Universal** - Node.js 20+, Bun 1.0+, Deno 1.40+
|
|
75
|
-
- **Framework-agnostic** - Express, Fastify, Koa, Hono, vanilla HTTP
|
|
76
|
-
- **Effect-TS first** - Typed error handling with Effect (optional)
|
|
77
|
-
- **Pattern-based filtering** - Control which spans are created via YAML
|
|
78
|
-
- **HTTP filtering** - Prevent noisy health checks and metrics endpoints
|
|
79
|
-
- **Centralized config** - YAML file, URL, or environment variable
|
|
80
|
-
- **Production-ready** - Graceful shutdown, error handling, performance optimized
|
|
81
|
-
|
|
82
|
-
## Documentation
|
|
83
|
-
|
|
84
|
-
Full documentation is available in the [main repository](https://github.com/atrim-ai/instrumentation):
|
|
85
|
-
|
|
86
|
-
### Core Docs
|
|
87
|
-
|
|
88
|
-
- 📖 [Getting Started](../../docs/getting-started.md) - 5-minute setup guide
|
|
89
|
-
- ⚙️ [Configuration](../../docs/configuration.md) - YAML configuration reference
|
|
90
|
-
- 📋 [Examples](../../docs/EXAMPLES.md) - 8+ working examples
|
|
91
|
-
- 🔧 [Troubleshooting](../../docs/TROUBLESHOOTING.md) - Common issues and solutions
|
|
92
|
-
- 📚 [API Reference](../../docs/api-reference.md) - Complete API documentation
|
|
93
|
-
|
|
94
|
-
### Specialized Guides
|
|
95
|
-
|
|
96
|
-
- 🌐 [HTTP Filtering](../../docs/HTTP_FILTERING_INVESTIGATION.md) - Prevent noisy traces
|
|
97
|
-
- 🔄 [Effect Integration](../../examples/effect-ts/README.md) - Effect-TS patterns
|
|
98
|
-
- 🧪 [Testing Guide](../../docs/TESTING.md) - How to test instrumented apps
|
|
99
|
-
|
|
100
|
-
## Installation
|
|
101
|
-
|
|
102
|
-
### npm
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
npm install @atrim/instrument-node
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### yarn
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
yarn add @atrim/instrument-node
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### pnpm
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
pnpm add @atrim/instrument-node
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Bun
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
bun add @atrim/instrument-node
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Usage Examples
|
|
127
|
-
|
|
128
|
-
### Express Application
|
|
48
|
+
**What gets auto-configured:**
|
|
129
49
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// Initialize at startup
|
|
135
|
-
await initializeInstrumentation()
|
|
136
|
-
|
|
137
|
-
const app = express()
|
|
138
|
-
|
|
139
|
-
app.get('/users', async (req, res) => {
|
|
140
|
-
// Automatically traced!
|
|
141
|
-
const users = await fetchUsers()
|
|
142
|
-
res.json(users)
|
|
143
|
-
})
|
|
50
|
+
- Service name from `package.json`
|
|
51
|
+
- OTLP endpoint
|
|
52
|
+
- Auto-instrumentation (HTTP, Express, Fastify, etc.)
|
|
53
|
+
- Graceful shutdown
|
|
144
54
|
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Effect-TS Application
|
|
55
|
+
## Effect-TS Integration
|
|
149
56
|
|
|
150
57
|
```typescript
|
|
151
58
|
import { Effect, Layer } from 'effect'
|
|
152
59
|
import { EffectInstrumentationLive } from '@atrim/instrument-node/effect'
|
|
153
60
|
|
|
154
61
|
const program = Effect.gen(function* () {
|
|
155
|
-
// Automatically traced with Effect.withSpan()
|
|
156
62
|
yield* myOperation.pipe(Effect.withSpan('app.operation'))
|
|
157
|
-
}).pipe(
|
|
158
|
-
Effect.provide(EffectInstrumentationLive)
|
|
159
|
-
)
|
|
63
|
+
}).pipe(Effect.provide(EffectInstrumentationLive))
|
|
160
64
|
|
|
161
65
|
await Effect.runPromise(program)
|
|
162
66
|
```
|
|
163
67
|
|
|
164
|
-
|
|
68
|
+
**Span annotation helpers:**
|
|
165
69
|
|
|
166
70
|
```typescript
|
|
167
|
-
import {
|
|
71
|
+
import { annotateUser, annotateBatch, annotateCache } from '@atrim/instrument-node/effect'
|
|
168
72
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return new Response('Hello from Bun!')
|
|
176
|
-
}
|
|
177
|
-
})
|
|
73
|
+
const process = Effect.gen(function* () {
|
|
74
|
+
yield* annotateUser('user-123', 'user@example.com')
|
|
75
|
+
yield* annotateBatch(100, 10)
|
|
76
|
+
yield* annotateCache(true, 'user:123')
|
|
77
|
+
// ...
|
|
78
|
+
}).pipe(Effect.withSpan('batch.process'))
|
|
178
79
|
```
|
|
179
80
|
|
|
180
|
-
|
|
81
|
+
Available: `annotateUser`, `annotateBatch`, `annotateDataSize`, `annotateLLM`, `annotateQuery`, `annotateHttpRequest`, `annotateError`, `annotatePriority`, `annotateCache`
|
|
181
82
|
|
|
182
|
-
|
|
183
|
-
import { initializeInstrumentation } from '@atrim/instrument-node'
|
|
83
|
+
### Effect Fiber Metadata Extraction
|
|
184
84
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
85
|
+
To add Effect fiber metadata (fiber ID, status, parent span info) to your spans, you must **explicitly call** the enrichment functions:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { autoEnrichSpan, withAutoEnrichedSpan } from '@atrim/instrument-node/effect'
|
|
89
|
+
|
|
90
|
+
// Option 1: Call autoEnrichSpan() inside a span
|
|
91
|
+
const operation = Effect.gen(function* () {
|
|
92
|
+
yield* autoEnrichSpan() // Adds fiber metadata to current span
|
|
93
|
+
// ... your logic
|
|
94
|
+
}).pipe(Effect.withSpan('app.operation'))
|
|
95
|
+
|
|
96
|
+
// Option 2: Use the convenience wrapper
|
|
97
|
+
const operation = withAutoEnrichedSpan('app.operation')(
|
|
98
|
+
Effect.gen(function* () {
|
|
99
|
+
// ... your logic (fiber metadata added automatically)
|
|
100
|
+
})
|
|
101
|
+
)
|
|
189
102
|
```
|
|
190
103
|
|
|
191
|
-
|
|
104
|
+
**Extracted metadata:**
|
|
105
|
+
- `effect.fiber.id` - Unique fiber thread name
|
|
106
|
+
- `effect.fiber.status` - Current fiber status
|
|
107
|
+
- `effect.operation.root` / `effect.operation.nested` - Operation hierarchy
|
|
108
|
+
- `effect.parent.span.id`, `effect.parent.span.name`, `effect.parent.trace.id` - Parent span info
|
|
192
109
|
|
|
193
|
-
|
|
110
|
+
> **Note:** The `auto_extract_metadata` config option is currently not implemented. Metadata extraction requires explicit calls as shown above. See [#issue] for tracking automatic extraction support.
|
|
194
111
|
|
|
195
|
-
|
|
196
|
-
2. **Environment Variable** - `ATRIM_INSTRUMENTATION_CONFIG`
|
|
197
|
-
3. **Project Root File** - `./instrumentation.yaml`
|
|
198
|
-
4. **Default Config** - Built-in defaults
|
|
112
|
+
## Configuration (Optional)
|
|
199
113
|
|
|
200
|
-
|
|
114
|
+
Create `instrumentation.yaml` in your project root:
|
|
201
115
|
|
|
202
116
|
```yaml
|
|
203
117
|
version: "1.0"
|
|
204
|
-
|
|
205
118
|
instrumentation:
|
|
206
119
|
enabled: true
|
|
207
|
-
logging: "on"
|
|
208
|
-
|
|
209
|
-
# Pattern-based span filtering
|
|
210
120
|
instrument_patterns:
|
|
211
|
-
- pattern: "^app\\."
|
|
212
|
-
enabled: true
|
|
213
|
-
description: "Application operations"
|
|
214
|
-
- pattern: "^storage\\."
|
|
215
|
-
enabled: true
|
|
216
|
-
description: "Storage layer"
|
|
217
|
-
|
|
121
|
+
- pattern: "^app\\." # Trace app operations
|
|
218
122
|
ignore_patterns:
|
|
219
|
-
- pattern: "^health\\."
|
|
220
|
-
description: "Health checks"
|
|
221
|
-
- pattern: "^metrics\\."
|
|
222
|
-
description: "Metrics endpoints"
|
|
223
|
-
|
|
224
|
-
# Effect-TS specific (optional)
|
|
225
|
-
effect:
|
|
226
|
-
auto_extract_metadata: true
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
See [Configuration Guide](../../docs/configuration.md) for complete reference.
|
|
230
|
-
|
|
231
|
-
## HTTP Request Filtering
|
|
232
|
-
|
|
233
|
-
**IMPORTANT:** HTTP filtering requires explicit configuration to prevent noisy traces.
|
|
234
|
-
|
|
235
|
-
### Add HTTP Filtering Patterns
|
|
236
|
-
|
|
237
|
-
```yaml
|
|
238
|
-
# instrumentation.yaml
|
|
239
|
-
instrumentation:
|
|
123
|
+
- pattern: "^health\\." # Skip health checks
|
|
240
124
|
http_filtering:
|
|
241
125
|
enabled: true
|
|
242
126
|
ignore_routes:
|
|
243
127
|
- pattern: "^/health$"
|
|
244
128
|
- pattern: "^/metrics$"
|
|
245
|
-
- pattern: "^/api/internal/"
|
|
246
|
-
- pattern: "http://.*:4318/v1/traces" # Prevent OTLP trace loops!
|
|
247
129
|
```
|
|
248
130
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
## API Reference
|
|
252
|
-
|
|
253
|
-
### Standard API (Promise-based)
|
|
131
|
+
**Priority order:** Explicit config > `ATRIM_INSTRUMENTATION_CONFIG` env var > `./instrumentation.yaml` > defaults
|
|
254
132
|
|
|
255
|
-
|
|
256
|
-
// Main initialization
|
|
257
|
-
initializeInstrumentation(options?: SdkInitializationOptions): Promise<NodeSDK | null>
|
|
258
|
-
|
|
259
|
-
// Pattern matching only (skip SDK)
|
|
260
|
-
initializePatternMatchingOnly(options?: ConfigLoaderOptions): Promise<void>
|
|
133
|
+
## Runtimes & Frameworks
|
|
261
134
|
|
|
262
|
-
|
|
263
|
-
|
|
135
|
+
| Runtime | Version |
|
|
136
|
+
|---------|---------|
|
|
137
|
+
| Node.js | 20+ |
|
|
138
|
+
| Bun | 1.0+ |
|
|
139
|
+
| Deno | 1.40+ |
|
|
264
140
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
141
|
+
| Framework | Support |
|
|
142
|
+
|-----------|---------|
|
|
143
|
+
| Express | Auto-instrumented (via OTel) |
|
|
144
|
+
| Fastify | Auto-instrumented (via OTel) |
|
|
145
|
+
| Koa | Auto-instrumented (via OTel) |
|
|
146
|
+
| Hono | Manual spans |
|
|
147
|
+
| Effect-TS | First-class integration (unique) |
|
|
270
148
|
|
|
271
|
-
|
|
149
|
+
## Version Compatibility
|
|
272
150
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
// Effect-TS Layer
|
|
278
|
-
EffectInstrumentationLive: Layer.Layer<Tracer.Tracer, ConfigError, never>
|
|
279
|
-
|
|
280
|
-
// Service detection (Effect)
|
|
281
|
-
detectServiceInfoEffect: Effect.Effect<ServiceInfo, ServiceDetectionError>
|
|
282
|
-
getServiceNameEffect: Effect.Effect<string, ServiceDetectionError>
|
|
283
|
-
getServiceVersionEffect: Effect.Effect<string, never>
|
|
284
|
-
```
|
|
151
|
+
| @atrim/instrument-node | @opentelemetry/api | effect |
|
|
152
|
+
|------------------------|--------------------| -------|
|
|
153
|
+
| 0.6.x | ^1.0.0 (1.0 - 1.9+) | ^3.0.0 (optional) |
|
|
285
154
|
|
|
286
|
-
|
|
155
|
+
**Notes:**
|
|
287
156
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
-
|
|
291
|
-
- ✅ **Bun** 1.0.0+
|
|
292
|
-
- ✅ **Deno** 1.40.0+ (via npm compatibility)
|
|
293
|
-
|
|
294
|
-
## Frameworks Supported
|
|
295
|
-
|
|
296
|
-
- ✅ **Express** - Auto-instrumentation included
|
|
297
|
-
- ✅ **Fastify** - Auto-instrumentation included
|
|
298
|
-
- ✅ **Koa** - Auto-instrumentation included
|
|
299
|
-
- ✅ **Hono** - Works with manual spans
|
|
300
|
-
- ✅ **Vanilla HTTP** - Works with any Node.js HTTP server
|
|
301
|
-
- ✅ **Effect-TS** - First-class integration with Effect.withSpan()
|
|
302
|
-
|
|
303
|
-
## Examples
|
|
304
|
-
|
|
305
|
-
See the [examples directory](../../examples/) for complete working examples:
|
|
306
|
-
|
|
307
|
-
- [Express](../../examples/express/) - Basic Express app
|
|
308
|
-
- [Effect-TS](../../examples/effect-ts/) - Advanced Effect patterns
|
|
309
|
-
- [Effect Platform](../../examples/effect-platform/) - Pure Effect HTTP server
|
|
310
|
-
- [Vanilla TypeScript](../../examples/vanilla/) - Standard Node.js
|
|
311
|
-
- [Bun Runtime](../../examples/bun/) - Bun-specific example
|
|
312
|
-
- [Remote Config](../../examples/remote-config/) - Load config from URL
|
|
313
|
-
- [Multi-Service](../../examples/multi-service/) - Distributed tracing
|
|
157
|
+
- `@opentelemetry/api` is the only required peer dependency
|
|
158
|
+
- Effect packages are optional - core features work without them
|
|
159
|
+
- The library is tested with @opentelemetry/api 1.9.x in CI
|
|
314
160
|
|
|
315
161
|
## Troubleshooting
|
|
316
162
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
### Quick Fixes
|
|
163
|
+
**No traces?** Check collector: `docker run -p 4318:4318 otel/opentelemetry-collector`
|
|
320
164
|
|
|
321
|
-
**
|
|
322
|
-
- Check collector is running: `docker run -p 4318:4318 otel/opentelemetry-collector`
|
|
323
|
-
- Check endpoint: `OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318`
|
|
165
|
+
**Too many traces?** Add HTTP filtering patterns for health checks, metrics, OTLP exports.
|
|
324
166
|
|
|
325
|
-
**
|
|
326
|
-
- Add HTTP filtering patterns (health checks, metrics, OTLP exports)
|
|
327
|
-
- See [HTTP Filtering Guide](../../docs/HTTP_FILTERING_INVESTIGATION.md)
|
|
167
|
+
**Effect spans missing?** Ensure you're using `Effect.withSpan()` and providing `EffectInstrumentationLive`.
|
|
328
168
|
|
|
329
|
-
|
|
330
|
-
- Make sure you're using `Effect.withSpan()`
|
|
331
|
-
- Provide `EffectInstrumentationLive` layer
|
|
332
|
-
|
|
333
|
-
## Contributing
|
|
169
|
+
## Documentation
|
|
334
170
|
|
|
335
|
-
|
|
171
|
+
- [Getting Started](../../docs/getting-started.md)
|
|
172
|
+
- [Configuration Reference](../../docs/configuration.md)
|
|
173
|
+
- [API Reference](../../docs/api-reference.md)
|
|
174
|
+
- [Examples](../../examples/)
|
|
175
|
+
- [Troubleshooting](../../docs/TROUBLESHOOTING.md)
|
|
336
176
|
|
|
337
177
|
## License
|
|
338
178
|
|
|
339
|
-
MIT
|
|
340
|
-
|
|
341
|
-
## Related Packages
|
|
342
|
-
|
|
343
|
-
- [@atrim/instrument-core](../core) - Internal shared logic (private)
|
|
344
|
-
- @atrim/instrument-web - Browser/web support _(Phase 1)_
|
|
345
|
-
|
|
346
|
-
## Links
|
|
347
|
-
|
|
348
|
-
- 📦 [npm package](https://www.npmjs.com/package/@atrim/instrument-node)
|
|
349
|
-
- 🐙 [GitHub repository](https://github.com/atrim-ai/instrumentation)
|
|
350
|
-
- 🐛 [Issue tracker](https://github.com/atrim-ai/instrumentation/issues)
|
|
351
|
-
- 📖 [Documentation](https://github.com/atrim-ai/instrumentation#readme)
|
|
179
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atrim/instrument-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-14fdea7-20260108232035",
|
|
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",
|
|
@@ -54,50 +59,48 @@
|
|
|
54
59
|
"LICENSE"
|
|
55
60
|
],
|
|
56
61
|
"dependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@effect/platform": "^0.93.0",
|
|
59
|
-
"@effect/platform-node": "latest",
|
|
60
|
-
"@opentelemetry/auto-instrumentations-node": "^0.67.0",
|
|
62
|
+
"@opentelemetry/auto-instrumentations-node": "^0.67.3",
|
|
61
63
|
"@opentelemetry/exporter-trace-otlp-http": "^0.208.0",
|
|
62
64
|
"@opentelemetry/instrumentation": "^0.208.0",
|
|
65
|
+
"@opentelemetry/resources": "^2.2.0",
|
|
63
66
|
"@opentelemetry/sdk-node": "^0.208.0",
|
|
64
67
|
"@opentelemetry/sdk-trace-base": "^2.2.0",
|
|
65
|
-
"
|
|
68
|
+
"@opentelemetry/sdk-trace-node": "^2.2.0",
|
|
69
|
+
"@opentelemetry/semantic-conventions": "^1.38.0",
|
|
66
70
|
"yaml": "^2.3.0",
|
|
67
71
|
"zod": "^3.22.0"
|
|
68
72
|
},
|
|
69
73
|
"devDependencies": {
|
|
74
|
+
"@effect/opentelemetry": "^0.60.0",
|
|
75
|
+
"@effect/platform": "^0.94.1",
|
|
76
|
+
"@effect/platform-node": "^0.104.0",
|
|
70
77
|
"@opentelemetry/api": "^1.9.0",
|
|
71
|
-
"@opentelemetry/resources": "^2.2.0",
|
|
72
78
|
"@opentelemetry/sdk-logs": "^0.208.0",
|
|
73
79
|
"@opentelemetry/sdk-metrics": "^2.2.0",
|
|
74
80
|
"@opentelemetry/sdk-trace-node": "^2.2.0",
|
|
75
81
|
"@opentelemetry/sdk-trace-web": "^2.2.0",
|
|
76
82
|
"@opentelemetry/semantic-conventions": "^1.38.0",
|
|
77
|
-
"@types/node": "^
|
|
78
|
-
"@vitest/coverage-v8": "^4.0.
|
|
79
|
-
"effect": "^3.19.
|
|
80
|
-
"testcontainers": "^11.
|
|
83
|
+
"@types/node": "^25.0.3",
|
|
84
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
85
|
+
"effect": "^3.19.14",
|
|
86
|
+
"testcontainers": "^11.11.0",
|
|
81
87
|
"tsup": "^8.0.1",
|
|
82
88
|
"tsx": "^4.7.0",
|
|
83
89
|
"typescript": "^5.7.2",
|
|
84
|
-
"vitest": "^4.0.
|
|
85
|
-
"@atrim/instrument-core": "0.
|
|
90
|
+
"vitest": "^4.0.16",
|
|
91
|
+
"@atrim/instrument-core": "0.6.0"
|
|
86
92
|
},
|
|
87
93
|
"peerDependencies": {
|
|
94
|
+
"@opentelemetry/api": "^1.0.0",
|
|
95
|
+
"effect": "^3.0.0",
|
|
88
96
|
"@effect/opentelemetry": ">=0.40.0",
|
|
89
97
|
"@effect/platform": ">=0.70.0",
|
|
90
|
-
"@
|
|
91
|
-
"@opentelemetry/sdk-trace-base": "^1.0.0",
|
|
92
|
-
"effect": "^3.0.0"
|
|
98
|
+
"@effect/platform-node": ">=0.60.0"
|
|
93
99
|
},
|
|
94
100
|
"peerDependenciesMeta": {
|
|
95
101
|
"@opentelemetry/api": {
|
|
96
102
|
"optional": false
|
|
97
103
|
},
|
|
98
|
-
"@opentelemetry/sdk-trace-base": {
|
|
99
|
-
"optional": true
|
|
100
|
-
},
|
|
101
104
|
"effect": {
|
|
102
105
|
"optional": true
|
|
103
106
|
},
|
|
@@ -106,6 +109,9 @@
|
|
|
106
109
|
},
|
|
107
110
|
"@effect/platform": {
|
|
108
111
|
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"@effect/platform-node": {
|
|
114
|
+
"optional": true
|
|
109
115
|
}
|
|
110
116
|
},
|
|
111
117
|
"scripts": {
|
|
@@ -122,10 +128,10 @@
|
|
|
122
128
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
123
129
|
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
124
130
|
"clean": "rm -rf target",
|
|
125
|
-
"publish:dev:version": "
|
|
131
|
+
"publish:dev:version": "pnpm version $(node -p \"require('./package.json').version\")-$(git rev-parse --short HEAD)-$(date -u +%Y%m%d%H%M%S) --no-git-tag-version",
|
|
126
132
|
"publish:dev:save": "node -p \"require('./package.json').version\" > .version",
|
|
127
133
|
"publish:dev:publish": "pnpm build && pnpm publish --tag dev --access public --no-git-checks",
|
|
128
|
-
"publish:dev:reset": "
|
|
134
|
+
"publish:dev:reset": "pnpm version 0.5.0 --no-git-tag-version",
|
|
129
135
|
"publish:dev": "pnpm publish:dev:version && pnpm publish:dev:save && pnpm publish:dev:publish && pnpm publish:dev:reset"
|
|
130
136
|
}
|
|
131
137
|
}
|
package/target/dist/index.d.cts
CHANGED
|
@@ -46,35 +46,33 @@ declare function createOtlpExporter(options?: OtlpExporterOptions): OTLPTraceExp
|
|
|
46
46
|
declare function getOtlpEndpoint(options?: OtlpExporterOptions): string;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* Node.js configuration loader
|
|
49
|
+
* Node.js configuration loader
|
|
50
50
|
*
|
|
51
|
-
* Provides
|
|
51
|
+
* Provides configuration loading using native Node.js APIs (fs, fetch)
|
|
52
|
+
* This module doesn't require Effect Platform, making it work without Effect installed.
|
|
52
53
|
*/
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
58
|
-
declare function _resetConfigLoaderCache(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Load configuration from URI (Promise-based convenience API)
|
|
61
|
-
*
|
|
62
|
-
* Automatically provides Node.js platform layers (FileSystem + HttpClient)
|
|
56
|
+
* Load configuration from URI (file path or URL)
|
|
63
57
|
*
|
|
64
58
|
* @param uri - Configuration URI (file://, http://, https://, or relative path)
|
|
65
|
-
* @param options - Optional loading options (e.g., to disable caching)
|
|
66
59
|
* @returns Promise that resolves to validated configuration
|
|
67
60
|
*/
|
|
68
|
-
declare function loadConfig(uri: string,
|
|
61
|
+
declare function loadConfig(uri: string, _options?: {
|
|
69
62
|
cacheTimeout?: number;
|
|
70
63
|
}): Promise<InstrumentationConfig>;
|
|
71
64
|
/**
|
|
72
|
-
* Load configuration from inline content
|
|
65
|
+
* Load configuration from inline content
|
|
73
66
|
*
|
|
74
67
|
* @param content - YAML string, JSON string, or plain object
|
|
75
68
|
* @returns Promise that resolves to validated configuration
|
|
76
69
|
*/
|
|
77
70
|
declare function loadConfigFromInline(content: string | unknown): Promise<InstrumentationConfig>;
|
|
71
|
+
/**
|
|
72
|
+
* Reset the config loader cache (no-op for native implementation)
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
declare function _resetConfigLoaderCache(): void;
|
|
78
76
|
/**
|
|
79
77
|
* Legacy options interface for backward compatibility
|
|
80
78
|
*/
|
|
@@ -548,6 +546,10 @@ declare function getServiceVersionAsync(): Promise<string | undefined>;
|
|
|
548
546
|
* This processor filters spans based on configured patterns before they are exported.
|
|
549
547
|
* It wraps another processor (typically BatchSpanProcessor) and only forwards spans
|
|
550
548
|
* that match the instrumentation patterns.
|
|
549
|
+
*
|
|
550
|
+
* Filtering is applied at two levels:
|
|
551
|
+
* 1. Span name patterns (instrument_patterns / ignore_patterns)
|
|
552
|
+
* 2. HTTP path patterns (http.ignore_incoming_paths) - for HTTP spans
|
|
551
553
|
*/
|
|
552
554
|
|
|
553
555
|
/**
|
|
@@ -570,6 +572,7 @@ declare function getServiceVersionAsync(): Promise<string | undefined>;
|
|
|
570
572
|
declare class PatternSpanProcessor implements SpanProcessor {
|
|
571
573
|
private matcher;
|
|
572
574
|
private wrappedProcessor;
|
|
575
|
+
private httpIgnorePatterns;
|
|
573
576
|
constructor(config: InstrumentationConfig, wrappedProcessor: SpanProcessor);
|
|
574
577
|
/**
|
|
575
578
|
* Called when a span is started
|
|
@@ -582,8 +585,20 @@ declare class PatternSpanProcessor implements SpanProcessor {
|
|
|
582
585
|
* Called when a span is ended
|
|
583
586
|
*
|
|
584
587
|
* This is where we make the final decision on whether to export the span.
|
|
588
|
+
* We check both span name patterns and HTTP path patterns.
|
|
585
589
|
*/
|
|
586
590
|
onEnd(span: ReadableSpan): void;
|
|
591
|
+
/**
|
|
592
|
+
* Check if span should be ignored based on HTTP path attributes
|
|
593
|
+
*
|
|
594
|
+
* This checks the span's url.path, http.route, or http.target attributes
|
|
595
|
+
* against the configured http.ignore_incoming_paths patterns.
|
|
596
|
+
*
|
|
597
|
+
* This enables filtering of Effect HTTP spans (and any other HTTP spans)
|
|
598
|
+
* based on path patterns, which is essential for filtering out OTLP
|
|
599
|
+
* endpoint requests like /v1/traces, /v1/logs, /v1/metrics.
|
|
600
|
+
*/
|
|
601
|
+
private shouldIgnoreHttpSpan;
|
|
587
602
|
/**
|
|
588
603
|
* Shutdown the processor
|
|
589
604
|
*/
|