@atrim/instrument-node 0.5.2-dev.ac2fbfe.20251221202531 → 0.6.0
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 +92 -330
- package/package.json +17 -16
- package/target/dist/index.cjs +135 -59
- package/target/dist/index.cjs.map +1 -1
- package/target/dist/index.d.cts +28 -13
- package/target/dist/index.d.ts +28 -13
- package/target/dist/index.js +134 -59
- package/target/dist/index.js.map +1 -1
- package/target/dist/integrations/effect/index.cjs +139 -128
- package/target/dist/integrations/effect/index.cjs.map +1 -1
- package/target/dist/integrations/effect/index.d.cts +19 -24
- package/target/dist/integrations/effect/index.d.ts +19 -24
- package/target/dist/integrations/effect/index.js +140 -131
- package/target/dist/integrations/effect/index.js.map +1 -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,374 +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
|
|
129
|
-
|
|
130
|
-
```typescript
|
|
131
|
-
import express from 'express'
|
|
132
|
-
import { initializeInstrumentation } from '@atrim/instrument-node'
|
|
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
|
-
})
|
|
48
|
+
**What gets auto-configured:**
|
|
144
49
|
|
|
145
|
-
|
|
146
|
-
|
|
50
|
+
- Service name from `package.json`
|
|
51
|
+
- OTLP endpoint
|
|
52
|
+
- Auto-instrumentation (HTTP, Express, Fastify, etc.)
|
|
53
|
+
- Graceful shutdown
|
|
147
54
|
|
|
148
|
-
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
The library provides 9 production-tested annotation helpers for enriching spans with semantic attributes:
|
|
68
|
+
**Span annotation helpers:**
|
|
167
69
|
|
|
168
70
|
```typescript
|
|
169
|
-
import {
|
|
170
|
-
import {
|
|
171
|
-
annotateUser,
|
|
172
|
-
annotateBatch,
|
|
173
|
-
annotateDataSize,
|
|
174
|
-
annotateLLM,
|
|
175
|
-
annotateQuery,
|
|
176
|
-
annotateHttpRequest,
|
|
177
|
-
annotateError,
|
|
178
|
-
annotatePriority,
|
|
179
|
-
annotateCache,
|
|
180
|
-
autoEnrichSpan,
|
|
181
|
-
withAutoEnrichedSpan
|
|
182
|
-
} from '@atrim/instrument-node/effect'
|
|
183
|
-
|
|
184
|
-
// Example: Batch processing with automatic enrichment
|
|
185
|
-
const processBatch = Effect.gen(function* () {
|
|
186
|
-
// Auto-enrich with Effect metadata (fiber ID, status, parent span info)
|
|
187
|
-
yield* autoEnrichSpan()
|
|
188
|
-
|
|
189
|
-
// Add user context
|
|
190
|
-
yield* annotateUser('user-123', 'user@example.com')
|
|
191
|
-
|
|
192
|
-
// Add batch metadata
|
|
193
|
-
yield* annotateBatch(100, 10) // 100 items in batches of 10
|
|
194
|
-
|
|
195
|
-
// Process items
|
|
196
|
-
const results = yield* processItems(items)
|
|
197
|
-
|
|
198
|
-
// Update with results
|
|
199
|
-
yield* annotateBatch(100, 10, results.success, results.failures)
|
|
71
|
+
import { annotateUser, annotateBatch, annotateCache } from '@atrim/instrument-node/effect'
|
|
200
72
|
|
|
201
|
-
|
|
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
|
+
// ...
|
|
202
78
|
}).pipe(Effect.withSpan('batch.process'))
|
|
203
|
-
|
|
204
|
-
// Or use the convenience wrapper
|
|
205
|
-
const processWithAutoEnrich = withAutoEnrichedSpan('batch.process')(
|
|
206
|
-
Effect.gen(function* () {
|
|
207
|
-
yield* annotateBatch(100, 10)
|
|
208
|
-
return yield* processItems(items)
|
|
209
|
-
})
|
|
210
|
-
)
|
|
211
79
|
```
|
|
212
80
|
|
|
213
|
-
|
|
214
|
-
- `annotateUser(userId, email?, username?)` - User context
|
|
215
|
-
- `annotateDataSize(bytes, items, compressionRatio?)` - Data size metrics
|
|
216
|
-
- `annotateBatch(totalItems, batchSize, successCount?, failureCount?)` - Batch operations
|
|
217
|
-
- `annotateLLM(model, provider, tokens?)` - LLM operations (GPT, Claude, etc.)
|
|
218
|
-
- `annotateQuery(query, duration?, rowCount?, database?)` - Database queries
|
|
219
|
-
- `annotateHttpRequest(method, url, statusCode?, contentLength?)` - HTTP requests
|
|
220
|
-
- `annotateError(error, recoverable, errorType?)` - Error context
|
|
221
|
-
- `annotatePriority(priority, reason?)` - Operation priority
|
|
222
|
-
- `annotateCache(hit, key, ttl?)` - Cache operations
|
|
223
|
-
|
|
224
|
-
**Auto-enrichment utilities:**
|
|
225
|
-
- `autoEnrichSpan()` - Automatically add Effect metadata (fiber ID, status, parent span info)
|
|
226
|
-
- `withAutoEnrichedSpan(name, options?)` - Wrapper combining `Effect.withSpan()` + auto-enrichment
|
|
81
|
+
Available: `annotateUser`, `annotateBatch`, `annotateDataSize`, `annotateLLM`, `annotateQuery`, `annotateHttpRequest`, `annotateError`, `annotatePriority`, `annotateCache`
|
|
227
82
|
|
|
228
|
-
|
|
83
|
+
### Effect Fiber Metadata Extraction
|
|
229
84
|
|
|
230
|
-
|
|
85
|
+
To add Effect fiber metadata (fiber ID, status, parent span info) to your spans, you must **explicitly call** the enrichment functions:
|
|
231
86
|
|
|
232
87
|
```typescript
|
|
233
|
-
import {
|
|
88
|
+
import { autoEnrichSpan, withAutoEnrichedSpan } from '@atrim/instrument-node/effect'
|
|
234
89
|
|
|
235
|
-
//
|
|
236
|
-
|
|
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'))
|
|
237
95
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### Remote Configuration
|
|
247
|
-
|
|
248
|
-
```typescript
|
|
249
|
-
import { initializeInstrumentation } from '@atrim/instrument-node'
|
|
250
|
-
|
|
251
|
-
await initializeInstrumentation({
|
|
252
|
-
configUrl: 'https://config.company.com/instrumentation.yaml',
|
|
253
|
-
cacheTimeout: 300_000 // 5 minutes
|
|
254
|
-
})
|
|
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
|
+
)
|
|
255
102
|
```
|
|
256
103
|
|
|
257
|
-
|
|
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
|
|
258
109
|
|
|
259
|
-
|
|
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.
|
|
260
111
|
|
|
261
|
-
|
|
262
|
-
2. **Environment Variable** - `ATRIM_INSTRUMENTATION_CONFIG`
|
|
263
|
-
3. **Project Root File** - `./instrumentation.yaml`
|
|
264
|
-
4. **Default Config** - Built-in defaults
|
|
112
|
+
## Configuration (Optional)
|
|
265
113
|
|
|
266
|
-
|
|
114
|
+
Create `instrumentation.yaml` in your project root:
|
|
267
115
|
|
|
268
116
|
```yaml
|
|
269
117
|
version: "1.0"
|
|
270
|
-
|
|
271
118
|
instrumentation:
|
|
272
119
|
enabled: true
|
|
273
|
-
logging: "on"
|
|
274
|
-
|
|
275
|
-
# Pattern-based span filtering
|
|
276
120
|
instrument_patterns:
|
|
277
|
-
- pattern: "^app\\."
|
|
278
|
-
enabled: true
|
|
279
|
-
description: "Application operations"
|
|
280
|
-
- pattern: "^storage\\."
|
|
281
|
-
enabled: true
|
|
282
|
-
description: "Storage layer"
|
|
283
|
-
|
|
121
|
+
- pattern: "^app\\." # Trace app operations
|
|
284
122
|
ignore_patterns:
|
|
285
|
-
- pattern: "^health\\."
|
|
286
|
-
description: "Health checks"
|
|
287
|
-
- pattern: "^metrics\\."
|
|
288
|
-
description: "Metrics endpoints"
|
|
289
|
-
|
|
290
|
-
# Effect-TS specific (optional)
|
|
291
|
-
effect:
|
|
292
|
-
auto_extract_metadata: true
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
See [Configuration Guide](../../docs/configuration.md) for complete reference.
|
|
296
|
-
|
|
297
|
-
## HTTP Request Filtering
|
|
298
|
-
|
|
299
|
-
**IMPORTANT:** HTTP filtering requires explicit configuration to prevent noisy traces.
|
|
300
|
-
|
|
301
|
-
### Add HTTP Filtering Patterns
|
|
302
|
-
|
|
303
|
-
```yaml
|
|
304
|
-
# instrumentation.yaml
|
|
305
|
-
instrumentation:
|
|
123
|
+
- pattern: "^health\\." # Skip health checks
|
|
306
124
|
http_filtering:
|
|
307
125
|
enabled: true
|
|
308
126
|
ignore_routes:
|
|
309
127
|
- pattern: "^/health$"
|
|
310
128
|
- pattern: "^/metrics$"
|
|
311
|
-
- pattern: "^/api/internal/"
|
|
312
|
-
- pattern: "http://.*:4318/v1/traces" # Prevent OTLP trace loops!
|
|
313
129
|
```
|
|
314
130
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
## API Reference
|
|
318
|
-
|
|
319
|
-
### Standard API (Promise-based)
|
|
320
|
-
|
|
321
|
-
```typescript
|
|
322
|
-
// Main initialization
|
|
323
|
-
initializeInstrumentation(options?: SdkInitializationOptions): Promise<NodeSDK | null>
|
|
131
|
+
**Priority order:** Explicit config > `ATRIM_INSTRUMENTATION_CONFIG` env var > `./instrumentation.yaml` > defaults
|
|
324
132
|
|
|
325
|
-
|
|
326
|
-
initializePatternMatchingOnly(options?: ConfigLoaderOptions): Promise<void>
|
|
133
|
+
## Runtimes & Frameworks
|
|
327
134
|
|
|
328
|
-
|
|
329
|
-
|
|
135
|
+
| Runtime | Version |
|
|
136
|
+
|---------|---------|
|
|
137
|
+
| Node.js | 20+ |
|
|
138
|
+
| Bun | 1.0+ |
|
|
139
|
+
| Deno | 1.40+ |
|
|
330
140
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
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) |
|
|
336
148
|
|
|
337
|
-
|
|
149
|
+
## Version Compatibility
|
|
338
150
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
151
|
+
| @atrim/instrument-node | @opentelemetry/api | effect |
|
|
152
|
+
|------------------------|--------------------| -------|
|
|
153
|
+
| 0.6.x | ^1.0.0 (1.0 - 1.9+) | ^3.0.0 (optional) |
|
|
342
154
|
|
|
343
|
-
|
|
344
|
-
EffectInstrumentationLive: Layer.Layer<Tracer.Tracer, ConfigError, never>
|
|
155
|
+
**Notes:**
|
|
345
156
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
getServiceVersionEffect: Effect.Effect<string, never>
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
See [API Reference](../../docs/api-reference.md) for complete documentation.
|
|
353
|
-
|
|
354
|
-
## Runtimes Supported
|
|
355
|
-
|
|
356
|
-
- ✅ **Node.js** 20.0.0+
|
|
357
|
-
- ✅ **Bun** 1.0.0+
|
|
358
|
-
- ✅ **Deno** 1.40.0+ (via npm compatibility)
|
|
359
|
-
|
|
360
|
-
## Frameworks Supported
|
|
361
|
-
|
|
362
|
-
- ✅ **Express** - Auto-instrumentation included
|
|
363
|
-
- ✅ **Fastify** - Auto-instrumentation included
|
|
364
|
-
- ✅ **Koa** - Auto-instrumentation included
|
|
365
|
-
- ✅ **Hono** - Works with manual spans
|
|
366
|
-
- ✅ **Vanilla HTTP** - Works with any Node.js HTTP server
|
|
367
|
-
- ✅ **Effect-TS** - First-class integration with Effect.withSpan()
|
|
368
|
-
|
|
369
|
-
## Examples
|
|
370
|
-
|
|
371
|
-
See the [examples directory](../../examples/) for complete working examples:
|
|
372
|
-
|
|
373
|
-
- [Express](../../examples/express/) - Basic Express app
|
|
374
|
-
- [Effect-TS](../../examples/effect-ts/) - Advanced Effect patterns
|
|
375
|
-
- [Effect Platform](../../examples/effect-platform/) - Pure Effect HTTP server
|
|
376
|
-
- [Vanilla TypeScript](../../examples/vanilla/) - Standard Node.js
|
|
377
|
-
- [Bun Runtime](../../examples/bun/) - Bun-specific example
|
|
378
|
-
- [Remote Config](../../examples/remote-config/) - Load config from URL
|
|
379
|
-
- [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
|
|
380
160
|
|
|
381
161
|
## Troubleshooting
|
|
382
162
|
|
|
383
|
-
|
|
163
|
+
**No traces?** Check collector: `docker run -p 4318:4318 otel/opentelemetry-collector`
|
|
384
164
|
|
|
385
|
-
|
|
165
|
+
**Too many traces?** Add HTTP filtering patterns for health checks, metrics, OTLP exports.
|
|
386
166
|
|
|
387
|
-
**
|
|
388
|
-
- Check collector is running: `docker run -p 4318:4318 otel/opentelemetry-collector`
|
|
389
|
-
- Check endpoint: `OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318`
|
|
167
|
+
**Effect spans missing?** Ensure you're using `Effect.withSpan()` and providing `EffectInstrumentationLive`.
|
|
390
168
|
|
|
391
|
-
|
|
392
|
-
- Add HTTP filtering patterns (health checks, metrics, OTLP exports)
|
|
393
|
-
- See [HTTP Filtering Guide](../../docs/HTTP_FILTERING_INVESTIGATION.md)
|
|
394
|
-
|
|
395
|
-
**Effect-TS spans not appearing?**
|
|
396
|
-
- Make sure you're using `Effect.withSpan()`
|
|
397
|
-
- Provide `EffectInstrumentationLive` layer
|
|
398
|
-
|
|
399
|
-
## Contributing
|
|
169
|
+
## Documentation
|
|
400
170
|
|
|
401
|
-
|
|
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)
|
|
402
176
|
|
|
403
177
|
## License
|
|
404
178
|
|
|
405
|
-
MIT
|
|
406
|
-
|
|
407
|
-
## Related Packages
|
|
408
|
-
|
|
409
|
-
- [@atrim/instrument-core](../core) - Internal shared logic (private)
|
|
410
|
-
- @atrim/instrument-web - Browser/web support _(Phase 1)_
|
|
411
|
-
|
|
412
|
-
## Links
|
|
413
|
-
|
|
414
|
-
- 📦 [npm package](https://www.npmjs.com/package/@atrim/instrument-node)
|
|
415
|
-
- 🐙 [GitHub repository](https://github.com/atrim-ai/instrumentation)
|
|
416
|
-
- 🐛 [Issue tracker](https://github.com/atrim-ai/instrumentation/issues)
|
|
417
|
-
- 📖 [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.6.0",
|
|
4
4
|
"description": "OpenTelemetry instrumentation for Node.js with centralized YAML configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,50 +54,48 @@
|
|
|
54
54
|
"LICENSE"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@effect/opentelemetry": "^0.59.1",
|
|
58
|
-
"@effect/platform": "^0.93.6",
|
|
59
|
-
"@effect/platform-node": "^0.103.0",
|
|
60
57
|
"@opentelemetry/auto-instrumentations-node": "^0.67.0",
|
|
61
58
|
"@opentelemetry/exporter-trace-otlp-http": "^0.208.0",
|
|
62
59
|
"@opentelemetry/instrumentation": "^0.208.0",
|
|
60
|
+
"@opentelemetry/resources": "^2.2.0",
|
|
63
61
|
"@opentelemetry/sdk-node": "^0.208.0",
|
|
64
62
|
"@opentelemetry/sdk-trace-base": "^2.2.0",
|
|
65
|
-
"
|
|
63
|
+
"@opentelemetry/sdk-trace-node": "^2.2.0",
|
|
64
|
+
"@opentelemetry/semantic-conventions": "^1.38.0",
|
|
66
65
|
"yaml": "^2.3.0",
|
|
67
66
|
"zod": "^3.22.0"
|
|
68
67
|
},
|
|
69
68
|
"devDependencies": {
|
|
69
|
+
"@effect/opentelemetry": "^0.59.1",
|
|
70
|
+
"@effect/platform": "^0.93.6",
|
|
71
|
+
"@effect/platform-node": "^0.103.0",
|
|
70
72
|
"@opentelemetry/api": "^1.9.0",
|
|
71
|
-
"@opentelemetry/resources": "^2.2.0",
|
|
72
73
|
"@opentelemetry/sdk-logs": "^0.208.0",
|
|
73
74
|
"@opentelemetry/sdk-metrics": "^2.2.0",
|
|
74
75
|
"@opentelemetry/sdk-trace-node": "^2.2.0",
|
|
75
76
|
"@opentelemetry/sdk-trace-web": "^2.2.0",
|
|
76
77
|
"@opentelemetry/semantic-conventions": "^1.38.0",
|
|
77
|
-
"@types/node": "^25.0.
|
|
78
|
-
"@vitest/coverage-v8": "^4.0.
|
|
78
|
+
"@types/node": "^25.0.3",
|
|
79
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
79
80
|
"effect": "^3.19.8",
|
|
80
|
-
"testcontainers": "^11.
|
|
81
|
+
"testcontainers": "^11.11.0",
|
|
81
82
|
"tsup": "^8.0.1",
|
|
82
83
|
"tsx": "^4.7.0",
|
|
83
84
|
"typescript": "^5.7.2",
|
|
84
|
-
"vitest": "^4.0.
|
|
85
|
+
"vitest": "^4.0.16",
|
|
85
86
|
"@atrim/instrument-core": "0.5.0"
|
|
86
87
|
},
|
|
87
88
|
"peerDependencies": {
|
|
89
|
+
"@opentelemetry/api": "^1.0.0",
|
|
90
|
+
"effect": "^3.0.0",
|
|
88
91
|
"@effect/opentelemetry": ">=0.40.0",
|
|
89
92
|
"@effect/platform": ">=0.70.0",
|
|
90
|
-
"@
|
|
91
|
-
"@opentelemetry/sdk-trace-base": "^1.0.0",
|
|
92
|
-
"effect": "^3.0.0"
|
|
93
|
+
"@effect/platform-node": ">=0.60.0"
|
|
93
94
|
},
|
|
94
95
|
"peerDependenciesMeta": {
|
|
95
96
|
"@opentelemetry/api": {
|
|
96
97
|
"optional": false
|
|
97
98
|
},
|
|
98
|
-
"@opentelemetry/sdk-trace-base": {
|
|
99
|
-
"optional": true
|
|
100
|
-
},
|
|
101
99
|
"effect": {
|
|
102
100
|
"optional": true
|
|
103
101
|
},
|
|
@@ -106,6 +104,9 @@
|
|
|
106
104
|
},
|
|
107
105
|
"@effect/platform": {
|
|
108
106
|
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"@effect/platform-node": {
|
|
109
|
+
"optional": true
|
|
109
110
|
}
|
|
110
111
|
},
|
|
111
112
|
"scripts": {
|