autotel 2.25.4 → 2.26.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.
Files changed (69) hide show
  1. package/README.md +47 -1
  2. package/dist/auto.cjs +2 -2
  3. package/dist/auto.js +1 -1
  4. package/dist/{chunk-OPTGXEVN.js → chunk-4PTCDOZY.js} +3 -3
  5. package/dist/{chunk-OPTGXEVN.js.map → chunk-4PTCDOZY.js.map} +1 -1
  6. package/dist/{chunk-MN6PZ4AN.cjs → chunk-CMADDTHY.cjs} +7 -7
  7. package/dist/{chunk-MN6PZ4AN.cjs.map → chunk-CMADDTHY.cjs.map} +1 -1
  8. package/dist/{chunk-CMUM4JQI.js → chunk-DGPUZ6TE.js} +3 -3
  9. package/dist/{chunk-CMUM4JQI.js.map → chunk-DGPUZ6TE.js.map} +1 -1
  10. package/dist/{chunk-MNBAXRVG.js → chunk-EXOXDI5A.js} +74 -4
  11. package/dist/chunk-EXOXDI5A.js.map +1 -0
  12. package/dist/{chunk-QDREXAD7.js → chunk-GTD3NXOS.js} +3 -3
  13. package/dist/{chunk-QDREXAD7.js.map → chunk-GTD3NXOS.js.map} +1 -1
  14. package/dist/{chunk-A5ZUL2RZ.cjs → chunk-II7GFVAF.cjs} +13 -13
  15. package/dist/{chunk-A5ZUL2RZ.cjs.map → chunk-II7GFVAF.cjs.map} +1 -1
  16. package/dist/{chunk-I6JPSD4R.cjs → chunk-N344PVE5.cjs} +5 -5
  17. package/dist/{chunk-I6JPSD4R.cjs.map → chunk-N344PVE5.cjs.map} +1 -1
  18. package/dist/{chunk-WYP6OOCT.js → chunk-RXFZKLRQ.js} +3 -3
  19. package/dist/{chunk-WYP6OOCT.js.map → chunk-RXFZKLRQ.js.map} +1 -1
  20. package/dist/{chunk-EEJGUBWV.cjs → chunk-TS7IHIRW.cjs} +5 -5
  21. package/dist/{chunk-EEJGUBWV.cjs.map → chunk-TS7IHIRW.cjs.map} +1 -1
  22. package/dist/{chunk-ITYASFHQ.cjs → chunk-UJJPTSEI.cjs} +74 -3
  23. package/dist/chunk-UJJPTSEI.cjs.map +1 -0
  24. package/dist/{chunk-XB2GITM5.js → chunk-WAB4CHBU.js} +3 -3
  25. package/dist/{chunk-XB2GITM5.js.map → chunk-WAB4CHBU.js.map} +1 -1
  26. package/dist/{chunk-QQLP4M6W.cjs → chunk-ZJ5GXCOT.cjs} +26 -26
  27. package/dist/{chunk-QQLP4M6W.cjs.map → chunk-ZJ5GXCOT.cjs.map} +1 -1
  28. package/dist/decorators.cjs +2 -2
  29. package/dist/decorators.js +2 -2
  30. package/dist/event.cjs +5 -5
  31. package/dist/event.js +2 -2
  32. package/dist/functional.cjs +9 -9
  33. package/dist/functional.js +2 -2
  34. package/dist/index.cjs +42 -41
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +1 -1
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.js +10 -9
  39. package/dist/index.js.map +1 -1
  40. package/dist/{init-C_PiC_Su.d.ts → init-FiR_glVc.d.ts} +23 -0
  41. package/dist/{init-CIzpC5kZ.d.cts → init-QSj7X6zU.d.cts} +23 -0
  42. package/dist/instrumentation.cjs +8 -8
  43. package/dist/instrumentation.js +1 -1
  44. package/dist/messaging.cjs +6 -6
  45. package/dist/messaging.js +3 -3
  46. package/dist/semantic-helpers.cjs +7 -7
  47. package/dist/semantic-helpers.js +3 -3
  48. package/dist/test-span-collector.cjs.map +1 -1
  49. package/dist/test-span-collector.d.cts +5 -2
  50. package/dist/test-span-collector.d.ts +5 -2
  51. package/dist/test-span-collector.js.map +1 -1
  52. package/dist/webhook.cjs +3 -3
  53. package/dist/webhook.js +2 -2
  54. package/dist/workflow-distributed.cjs +4 -4
  55. package/dist/workflow-distributed.js +2 -2
  56. package/dist/workflow.cjs +7 -7
  57. package/dist/workflow.js +3 -3
  58. package/dist/yaml-config.d.cts +1 -1
  59. package/dist/yaml-config.d.ts +1 -1
  60. package/package.json +41 -41
  61. package/src/devtools.ts +60 -0
  62. package/src/hook.mjs +2 -2
  63. package/src/init.customization.test.ts +81 -0
  64. package/src/init.ts +71 -1
  65. package/src/shutdown.test.ts +35 -1
  66. package/src/shutdown.ts +3 -1
  67. package/src/test-span-collector.ts +5 -2
  68. package/dist/chunk-ITYASFHQ.cjs.map +0 -1
  69. package/dist/chunk-MNBAXRVG.js.map +0 -1
package/README.md CHANGED
@@ -146,8 +146,10 @@ Replace `NODE_OPTIONS` and 30+ lines of SDK boilerplate with `init()`, wrap func
146
146
 
147
147
  ```bash
148
148
  npm install autotel
149
+ npm install -D autotel-devtools # optional but recommended for local DX
149
150
  # or
150
151
  pnpm add autotel
152
+ pnpm add -D autotel-devtools
151
153
  ```
152
154
 
153
155
  ### 2. Initialize once at startup
@@ -157,7 +159,7 @@ import { init } from 'autotel';
157
159
 
158
160
  init({
159
161
  service: 'checkout-api',
160
- environment: process.env.NODE_ENV,
162
+ devtools: true,
161
163
  });
162
164
  ```
163
165
 
@@ -169,6 +171,29 @@ Defaults:
169
171
  - Version: auto-detected from `package.json`
170
172
  - Events auto-flush when the root span finishes
171
173
 
174
+ Recommended local workflow:
175
+
176
+ ```typescript
177
+ init({
178
+ service: 'checkout-api',
179
+ devtools: true,
180
+ });
181
+ ```
182
+
183
+ - `devtools: true` points traces, metrics, and logs at local `autotel-devtools`
184
+ - `devtools: { embedded: true }` tries to start `autotel-devtools` for you
185
+ - when you switch to a hosted backend, replace `devtools` with `endpoint` and optional `headers`
186
+
187
+ Example remote backend config:
188
+
189
+ ```typescript
190
+ init({
191
+ service: 'checkout-api',
192
+ endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
193
+ headers: process.env.OTEL_EXPORTER_OTLP_HEADERS,
194
+ });
195
+ ```
196
+
172
197
  Sampling presets:
173
198
 
174
199
  - Simple path: `sampling: 'development' | 'errors-only' | 'production' | 'off'`
@@ -1978,6 +2003,14 @@ OTLP_ENDPOINT=https://otel.mycompany.com node server.js
1978
2003
  init({
1979
2004
  service: string; // required
1980
2005
  subscribers?: EventSubscriber[];
2006
+ devtools?: boolean | {
2007
+ enabled?: boolean;
2008
+ endpoint?: string;
2009
+ embedded?: boolean;
2010
+ host?: string;
2011
+ port?: number;
2012
+ verbose?: boolean;
2013
+ };
1981
2014
  endpoint?: string;
1982
2015
  protocol?: 'http' | 'grpc'; // OTLP protocol (default: 'http')
1983
2016
  metrics?: boolean | 'auto';
@@ -2006,6 +2039,19 @@ init({
2006
2039
  });
2007
2040
  ```
2008
2041
 
2042
+ Local-first recommendation:
2043
+
2044
+ ```typescript
2045
+ init({
2046
+ service: 'my-app',
2047
+ devtools: true,
2048
+ });
2049
+ ```
2050
+
2051
+ - `devtools: true` routes traces, metrics, and logs to local `autotel-devtools`
2052
+ - `devtools: { embedded: true }` attempts to start `autotel-devtools` automatically
2053
+ - use `endpoint` and `headers` when you are ready to ship telemetry to a hosted backend
2054
+
2009
2055
  **Sampling Configuration:**
2010
2056
 
2011
2057
  ```typescript
package/dist/auto.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkITYASFHQ_cjs = require('./chunk-ITYASFHQ.cjs');
3
+ var chunkUJJPTSEI_cjs = require('./chunk-UJJPTSEI.cjs');
4
4
  var chunkOFPZULMQ_cjs = require('./chunk-OFPZULMQ.cjs');
5
5
  require('./chunk-KZEC4CHV.cjs');
6
6
  require('./chunk-ZNMBW67B.cjs');
@@ -23,7 +23,7 @@ module$1.register("import-in-the-middle/hook.mjs", (typeof document === 'undefin
23
23
  var yamlConfig = chunkOFPZULMQ_cjs.loadYamlConfig();
24
24
  var autoInstrumentationsEnv = process.env.AUTOTEL_INTEGRATIONS;
25
25
  var autoInstrumentations = autoInstrumentationsEnv === "true" ? true : autoInstrumentationsEnv ? autoInstrumentationsEnv.split(",").map((s) => s.trim()) : yamlConfig?.autoInstrumentations ?? ["http", "express"];
26
- chunkITYASFHQ_cjs.init({
26
+ chunkUJJPTSEI_cjs.init({
27
27
  service: yamlConfig?.service ?? process.env.OTEL_SERVICE_NAME ?? "unknown-service",
28
28
  debug: yamlConfig?.debug ?? process.env.AUTOTEL_DEBUG === "true",
29
29
  autoInstrumentations
package/dist/auto.js CHANGED
@@ -1,4 +1,4 @@
1
- import { init } from './chunk-MNBAXRVG.js';
1
+ import { init } from './chunk-EXOXDI5A.js';
2
2
  import { loadYamlConfig } from './chunk-RUD7KS4R.js';
3
3
  import './chunk-XDKK53OL.js';
4
4
  import './chunk-WGWSHJ2N.js';
@@ -2,7 +2,7 @@ import { setSpanName } from './chunk-B3ZHLLMP.js';
2
2
  import { validateEvent, runInOperationContext } from './chunk-WD4RP6IV.js';
3
3
  import { getOrCreateCorrelationId } from './chunk-S4OFEXLA.js';
4
4
  import { createTraceContext, getActiveContextWithBaggage, getContextStorage, enterOrRun } from './chunk-BBBWDIYQ.js';
5
- import { getValidationConfig, isInitialized, warnIfNotInitialized, getConfig as getConfig$1, getEventsConfig, getLogger, getSdk } from './chunk-MNBAXRVG.js';
5
+ import { getValidationConfig, isInitialized, warnIfNotInitialized, getConfig as getConfig$1, getEventsConfig, getLogger, getSdk } from './chunk-EXOXDI5A.js';
6
6
  import { AlwaysSampler, AUTOTEL_SAMPLING_TAIL_KEEP, AUTOTEL_SAMPLING_TAIL_EVALUATED } from './chunk-VYA6QDNA.js';
7
7
  import { getConfig } from './chunk-J5QENANM.js';
8
8
  import { trace, SpanStatusCode, context, propagation } from '@opentelemetry/api';
@@ -1807,5 +1807,5 @@ function withBaggage(options) {
1807
1807
  }
1808
1808
 
1809
1809
  export { ctx, getEventQueue, instrument, resetEventQueue, span, trace2 as trace, track, withBaggage, withNewContext, withTracing };
1810
- //# sourceMappingURL=chunk-OPTGXEVN.js.map
1811
- //# sourceMappingURL=chunk-OPTGXEVN.js.map
1810
+ //# sourceMappingURL=chunk-4PTCDOZY.js.map
1811
+ //# sourceMappingURL=chunk-4PTCDOZY.js.map