@atrim/instrument-node 0.5.1-1451fcf-20260105212505 → 0.5.1-21bb978-20260105202350
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 +0 -29
- package/package.json +1 -1
- package/target/dist/index.cjs +7 -1
- package/target/dist/index.cjs.map +1 -1
- package/target/dist/index.js +7 -1
- package/target/dist/index.js.map +1 -1
- package/target/dist/integrations/effect/index.cjs +65 -20
- package/target/dist/integrations/effect/index.cjs.map +1 -1
- package/target/dist/integrations/effect/index.d.cts +133 -3
- package/target/dist/integrations/effect/index.d.ts +133 -3
- package/target/dist/integrations/effect/index.js +63 -23
- package/target/dist/integrations/effect/index.js.map +1 -1
package/README.md
CHANGED
|
@@ -80,35 +80,6 @@ const process = Effect.gen(function* () {
|
|
|
80
80
|
|
|
81
81
|
Available: `annotateUser`, `annotateBatch`, `annotateDataSize`, `annotateLLM`, `annotateQuery`, `annotateHttpRequest`, `annotateError`, `annotatePriority`, `annotateCache`
|
|
82
82
|
|
|
83
|
-
### Effect Fiber Metadata Extraction
|
|
84
|
-
|
|
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
|
-
)
|
|
102
|
-
```
|
|
103
|
-
|
|
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
|
|
109
|
-
|
|
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.
|
|
111
|
-
|
|
112
83
|
## Configuration (Optional)
|
|
113
84
|
|
|
114
85
|
Create `instrumentation.yaml` in your project root:
|
package/package.json
CHANGED
package/target/dist/index.cjs
CHANGED
|
@@ -115,6 +115,11 @@ var InstrumentationConfigSchema = zod.z.object({
|
|
|
115
115
|
// - "standalone": Use Effect's own OTLP exporter (bypasses Node SDK filtering)
|
|
116
116
|
exporter: zod.z.enum(["unified", "standalone"]).default("unified"),
|
|
117
117
|
auto_extract_metadata: zod.z.boolean(),
|
|
118
|
+
// Auto-bridge OpenTelemetry context to Effect spans
|
|
119
|
+
// When true, Effect spans automatically become children of the active OTel span
|
|
120
|
+
// (e.g., HTTP request span from auto-instrumentation)
|
|
121
|
+
// This is essential for proper trace hierarchy when using Effect with HTTP frameworks
|
|
122
|
+
auto_bridge_context: zod.z.boolean().default(true),
|
|
118
123
|
auto_isolation: AutoIsolationConfigSchema.optional()
|
|
119
124
|
}).optional(),
|
|
120
125
|
http: HttpFilteringConfigSchema.optional()
|
|
@@ -139,7 +144,8 @@ var defaultConfig = {
|
|
|
139
144
|
effect: {
|
|
140
145
|
enabled: true,
|
|
141
146
|
exporter: "unified",
|
|
142
|
-
auto_extract_metadata: true
|
|
147
|
+
auto_extract_metadata: true,
|
|
148
|
+
auto_bridge_context: true
|
|
143
149
|
}
|
|
144
150
|
};
|
|
145
151
|
function parseAndValidateConfig(content) {
|