autotel 6.2.1 → 6.3.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.
@@ -222,7 +222,7 @@ interface ProcessHandlersConfig {
222
222
  shutdownTimeoutMs?: number;
223
223
  }
224
224
  //#endregion
225
- //#region src/init.d.ts
225
+ //#region src/otlp-exporters.d.ts
226
226
  type OtlpSignal = 'traces' | 'metrics' | 'logs';
227
227
  interface OtlpDestinationConfig {
228
228
  /**
@@ -254,6 +254,8 @@ interface OtlpDestinationConfig {
254
254
  * exactly like emitting no telemetry at all.
255
255
  */
256
256
  type AutotelProtocol = 'http' | 'http/protobuf' | 'grpc';
257
+ //#endregion
258
+ //#region src/autotel-config.d.ts
257
259
  interface AutotelConfig {
258
260
  /** Service name (required) */
259
261
  service: string;
@@ -266,6 +268,24 @@ interface AutotelConfig {
266
268
  * process lifecycle management to the application.
267
269
  */
268
270
  processHandlers?: boolean | ProcessHandlersConfig;
271
+ /**
272
+ * Flush telemetry when the process finishes on its own. Default: `true`.
273
+ *
274
+ * `processHandlers` covers a process that is stopped or that crashes. Neither
275
+ * of those fires when a script runs to completion: Node drains the event loop
276
+ * and exits, and anything the batch span processor is still holding goes with
277
+ * it. Autotel listens for `beforeExit` and flushes there, so a CLI, a cron
278
+ * job or a CI step keeps its telemetry without calling `shutdown()`.
279
+ *
280
+ * A flush, not a shutdown: `beforeExit` fires on any event-loop drain, so a
281
+ * process that resumes work keeps working telemetry. Bounded by
282
+ * `processHandlers.shutdownTimeoutMs`, after which the process exits rather
283
+ * than waiting on an exporter that never answers.
284
+ *
285
+ * Set to `false` if your process manages its own exit and you would rather
286
+ * autotel added no listener.
287
+ */
288
+ flushOnExit?: boolean;
269
289
  /**
270
290
  * Local developer UX for autotel-devtools.
271
291
  *
@@ -1166,6 +1186,8 @@ interface AutotelConfig {
1166
1186
  */
1167
1187
  minLevel?: 'debug' | 'info' | 'warn' | 'error';
1168
1188
  }
1189
+ //#endregion
1190
+ //#region src/init.d.ts
1169
1191
  /**
1170
1192
  * Lock the logger to prevent further `init()` calls.
1171
1193
  * Use this when framework plugins set up instrumentation and you want
@@ -1243,4 +1265,4 @@ declare function init(cfg: AutotelConfig): void;
1243
1265
  */
1244
1266
  declare function isInitialized(): boolean;
1245
1267
  //#endregion
1246
- export { isLoggerLocked as a, StringRedactor as c, isInitialized as i, createStringRedactor as l, OtlpSignal as n, lockLogger as o, init as r, ProcessHandlersConfig as s, AutotelConfig as t };
1268
+ export { AutotelConfig as a, StringRedactor as c, lockLogger as i, createStringRedactor as l, isInitialized as n, OtlpSignal as o, isLoggerLocked as r, ProcessHandlersConfig as s, init as t };
@@ -222,7 +222,7 @@ interface ProcessHandlersConfig {
222
222
  shutdownTimeoutMs?: number;
223
223
  }
224
224
  //#endregion
225
- //#region src/init.d.ts
225
+ //#region src/otlp-exporters.d.ts
226
226
  type OtlpSignal = 'traces' | 'metrics' | 'logs';
227
227
  interface OtlpDestinationConfig {
228
228
  /**
@@ -254,6 +254,8 @@ interface OtlpDestinationConfig {
254
254
  * exactly like emitting no telemetry at all.
255
255
  */
256
256
  type AutotelProtocol = 'http' | 'http/protobuf' | 'grpc';
257
+ //#endregion
258
+ //#region src/autotel-config.d.ts
257
259
  interface AutotelConfig {
258
260
  /** Service name (required) */
259
261
  service: string;
@@ -266,6 +268,24 @@ interface AutotelConfig {
266
268
  * process lifecycle management to the application.
267
269
  */
268
270
  processHandlers?: boolean | ProcessHandlersConfig;
271
+ /**
272
+ * Flush telemetry when the process finishes on its own. Default: `true`.
273
+ *
274
+ * `processHandlers` covers a process that is stopped or that crashes. Neither
275
+ * of those fires when a script runs to completion: Node drains the event loop
276
+ * and exits, and anything the batch span processor is still holding goes with
277
+ * it. Autotel listens for `beforeExit` and flushes there, so a CLI, a cron
278
+ * job or a CI step keeps its telemetry without calling `shutdown()`.
279
+ *
280
+ * A flush, not a shutdown: `beforeExit` fires on any event-loop drain, so a
281
+ * process that resumes work keeps working telemetry. Bounded by
282
+ * `processHandlers.shutdownTimeoutMs`, after which the process exits rather
283
+ * than waiting on an exporter that never answers.
284
+ *
285
+ * Set to `false` if your process manages its own exit and you would rather
286
+ * autotel added no listener.
287
+ */
288
+ flushOnExit?: boolean;
269
289
  /**
270
290
  * Local developer UX for autotel-devtools.
271
291
  *
@@ -1166,6 +1186,8 @@ interface AutotelConfig {
1166
1186
  */
1167
1187
  minLevel?: 'debug' | 'info' | 'warn' | 'error';
1168
1188
  }
1189
+ //#endregion
1190
+ //#region src/init.d.ts
1169
1191
  /**
1170
1192
  * Lock the logger to prevent further `init()` calls.
1171
1193
  * Use this when framework plugins set up instrumentation and you want
@@ -1243,4 +1265,4 @@ declare function init(cfg: AutotelConfig): void;
1243
1265
  */
1244
1266
  declare function isInitialized(): boolean;
1245
1267
  //#endregion
1246
- export { isLoggerLocked as a, StringRedactor as c, isInitialized as i, createStringRedactor as l, OtlpSignal as n, lockLogger as o, init as r, ProcessHandlersConfig as s, AutotelConfig as t };
1268
+ export { AutotelConfig as a, StringRedactor as c, lockLogger as i, createStringRedactor as l, isInitialized as n, OtlpSignal as o, isLoggerLocked as r, ProcessHandlersConfig as s, init as t };