apitally 1.0.0-beta.1 → 1.0.0-beta.2
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 +1 -1
- package/dist/activation.cjs +260 -342
- package/dist/activation.cjs.map +1 -1
- package/dist/activation.d.cts +30 -39
- package/dist/activation.d.ts +30 -39
- package/dist/activation.js +242 -323
- package/dist/activation.js.map +1 -1
- package/dist/adonisjs/configure.cjs +72 -127
- package/dist/adonisjs/configure.cjs.map +1 -1
- package/dist/adonisjs/configure.d.cts +5 -5
- package/dist/adonisjs/configure.d.ts +5 -5
- package/dist/adonisjs/configure.js +70 -99
- package/dist/adonisjs/configure.js.map +1 -1
- package/dist/adonisjs/index.cjs +31 -62
- package/dist/adonisjs/index.cjs.map +1 -1
- package/dist/adonisjs/index.d.cts +8 -9
- package/dist/adonisjs/index.d.ts +8 -9
- package/dist/adonisjs/index.js +28 -39
- package/dist/adonisjs/index.js.map +1 -1
- package/dist/adonisjs/middleware.cjs +48 -67
- package/dist/adonisjs/middleware.cjs.map +1 -1
- package/dist/adonisjs/middleware.d.cts +7 -7
- package/dist/adonisjs/middleware.d.ts +7 -7
- package/dist/adonisjs/middleware.js +41 -44
- package/dist/adonisjs/middleware.js.map +1 -1
- package/dist/adonisjs/provider.cjs +35 -51
- package/dist/adonisjs/provider.cjs.map +1 -1
- package/dist/adonisjs/provider.d.cts +10 -10
- package/dist/adonisjs/provider.d.ts +10 -10
- package/dist/adonisjs/provider.js +31 -31
- package/dist/adonisjs/provider.js.map +1 -1
- package/dist/bodyCapture.cjs +91 -117
- package/dist/bodyCapture.cjs.map +1 -1
- package/dist/bodyCapture.d.cts +32 -27
- package/dist/bodyCapture.d.ts +32 -27
- package/dist/bodyCapture.js +86 -90
- package/dist/bodyCapture.js.map +1 -1
- package/dist/config.cjs +147 -192
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +41 -42
- package/dist/config.d.ts +41 -42
- package/dist/config.js +135 -156
- package/dist/config.js.map +1 -1
- package/dist/consumer.cjs +47 -84
- package/dist/consumer.cjs.map +1 -1
- package/dist/consumer.d.cts +11 -14
- package/dist/consumer.d.ts +11 -14
- package/dist/consumer.js +43 -62
- package/dist/consumer.js.map +1 -1
- package/dist/context.cjs +29 -60
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +29 -30
- package/dist/context.d.ts +29 -30
- package/dist/context.js +15 -26
- package/dist/context.js.map +1 -1
- package/dist/elysia/index.cjs +10 -33
- package/dist/elysia/index.cjs.map +1 -1
- package/dist/elysia/index.d.cts +8 -9
- package/dist/elysia/index.d.ts +8 -9
- package/dist/elysia/index.js +7 -7
- package/dist/elysia/index.js.map +1 -1
- package/dist/elysia/middleware.cjs +174 -246
- package/dist/elysia/middleware.cjs.map +1 -1
- package/dist/elysia/middleware.d.cts +10 -12
- package/dist/elysia/middleware.d.ts +10 -12
- package/dist/elysia/middleware.js +168 -231
- package/dist/elysia/middleware.js.map +1 -1
- package/dist/elysia/routes.cjs +11 -34
- package/dist/elysia/routes.cjs.map +1 -1
- package/dist/elysia/routes.d.cts +6 -7
- package/dist/elysia/routes.d.ts +6 -7
- package/dist/elysia/routes.js +10 -10
- package/dist/elysia/routes.js.map +1 -1
- package/dist/exceptions.cjs +33 -74
- package/dist/exceptions.cjs.map +1 -1
- package/dist/exceptions.d.cts +7 -7
- package/dist/exceptions.d.ts +7 -7
- package/dist/exceptions.js +29 -47
- package/dist/exceptions.js.map +1 -1
- package/dist/exportSerialization.cjs +26 -50
- package/dist/exportSerialization.cjs.map +1 -1
- package/dist/exportSerialization.d.cts +6 -7
- package/dist/exportSerialization.d.ts +6 -7
- package/dist/exportSerialization.js +24 -25
- package/dist/exportSerialization.js.map +1 -1
- package/dist/exportWorker.cjs +219 -292
- package/dist/exportWorker.cjs.map +1 -1
- package/dist/exportWorker.d.cts +43 -44
- package/dist/exportWorker.d.ts +43 -44
- package/dist/exportWorker.js +215 -263
- package/dist/exportWorker.js.map +1 -1
- package/dist/express/index.cjs +11 -33
- package/dist/express/index.cjs.map +1 -1
- package/dist/express/index.d.cts +7 -8
- package/dist/express/index.d.ts +7 -8
- package/dist/express/index.js +8 -7
- package/dist/express/index.js.map +1 -1
- package/dist/express/install.cjs +20 -42
- package/dist/express/install.cjs.map +1 -1
- package/dist/express/install.d.cts +7 -10
- package/dist/express/install.d.ts +7 -10
- package/dist/express/install.js +17 -16
- package/dist/express/install.js.map +1 -1
- package/dist/express/middleware.cjs +75 -116
- package/dist/express/middleware.cjs.map +1 -1
- package/dist/express/middleware.d.cts +5 -5
- package/dist/express/middleware.d.ts +5 -5
- package/dist/express/middleware.js +70 -96
- package/dist/express/middleware.js.map +1 -1
- package/dist/express/register.cjs +15 -14
- package/dist/express/register.cjs.map +1 -1
- package/dist/express/register.d.cts +1 -2
- package/dist/express/register.d.ts +1 -2
- package/dist/express/register.js +12 -10
- package/dist/express/register.js.map +1 -1
- package/dist/express/routes.cjs +262 -365
- package/dist/express/routes.cjs.map +1 -1
- package/dist/express/routes.d.cts +11 -12
- package/dist/express/routes.d.ts +11 -12
- package/dist/express/routes.js +256 -336
- package/dist/express/routes.js.map +1 -1
- package/dist/fastify/index.cjs +11 -33
- package/dist/fastify/index.cjs.map +1 -1
- package/dist/fastify/index.d.cts +7 -8
- package/dist/fastify/index.d.ts +7 -8
- package/dist/fastify/index.js +8 -7
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/install.cjs +14 -36
- package/dist/fastify/install.cjs.map +1 -1
- package/dist/fastify/install.d.cts +7 -10
- package/dist/fastify/install.d.ts +7 -10
- package/dist/fastify/install.js +11 -10
- package/dist/fastify/install.js.map +1 -1
- package/dist/fastify/middleware.cjs +91 -129
- package/dist/fastify/middleware.cjs.map +1 -1
- package/dist/fastify/middleware.d.cts +6 -7
- package/dist/fastify/middleware.d.ts +6 -7
- package/dist/fastify/middleware.js +86 -104
- package/dist/fastify/middleware.js.map +1 -1
- package/dist/fastify/routes.cjs +12 -34
- package/dist/fastify/routes.cjs.map +1 -1
- package/dist/fastify/routes.d.cts +7 -8
- package/dist/fastify/routes.d.ts +7 -8
- package/dist/fastify/routes.js +10 -9
- package/dist/fastify/routes.js.map +1 -1
- package/dist/h3/index.cjs +23 -48
- package/dist/h3/index.cjs.map +1 -1
- package/dist/h3/index.d.cts +8 -9
- package/dist/h3/index.d.ts +8 -9
- package/dist/h3/index.js +19 -21
- package/dist/h3/index.js.map +1 -1
- package/dist/h3/middleware.cjs +148 -202
- package/dist/h3/middleware.cjs.map +1 -1
- package/dist/h3/middleware.d.cts +5 -5
- package/dist/h3/middleware.d.ts +5 -5
- package/dist/h3/middleware.js +142 -181
- package/dist/h3/middleware.js.map +1 -1
- package/dist/h3/routes.cjs +35 -59
- package/dist/h3/routes.cjs.map +1 -1
- package/dist/h3/routes.d.cts +7 -8
- package/dist/h3/routes.d.ts +7 -8
- package/dist/h3/routes.js +32 -33
- package/dist/h3/routes.js.map +1 -1
- package/dist/hapi/index.cjs +14 -37
- package/dist/hapi/index.cjs.map +1 -1
- package/dist/hapi/index.d.cts +8 -9
- package/dist/hapi/index.d.ts +8 -9
- package/dist/hapi/index.js +11 -11
- package/dist/hapi/index.js.map +1 -1
- package/dist/hapi/install.cjs +19 -43
- package/dist/hapi/install.cjs.map +1 -1
- package/dist/hapi/install.d.cts +6 -8
- package/dist/hapi/install.d.ts +6 -8
- package/dist/hapi/install.js +16 -17
- package/dist/hapi/install.js.map +1 -1
- package/dist/hapi/middleware.cjs +107 -146
- package/dist/hapi/middleware.cjs.map +1 -1
- package/dist/hapi/middleware.d.cts +5 -5
- package/dist/hapi/middleware.d.ts +5 -5
- package/dist/hapi/middleware.js +102 -121
- package/dist/hapi/middleware.js.map +1 -1
- package/dist/hapi/routes.cjs +11 -32
- package/dist/hapi/routes.cjs.map +1 -1
- package/dist/hapi/routes.d.cts +7 -8
- package/dist/hapi/routes.d.ts +7 -8
- package/dist/hapi/routes.js +9 -7
- package/dist/hapi/routes.js.map +1 -1
- package/dist/hono/index.cjs +16 -38
- package/dist/hono/index.cjs.map +1 -1
- package/dist/hono/index.d.cts +7 -8
- package/dist/hono/index.d.ts +7 -8
- package/dist/hono/index.js +13 -12
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/middleware.cjs +168 -226
- package/dist/hono/middleware.cjs.map +1 -1
- package/dist/hono/middleware.d.cts +5 -5
- package/dist/hono/middleware.d.ts +5 -5
- package/dist/hono/middleware.js +163 -209
- package/dist/hono/middleware.js.map +1 -1
- package/dist/hono/routes.cjs +33 -64
- package/dist/hono/routes.cjs.map +1 -1
- package/dist/hono/routes.d.cts +7 -8
- package/dist/hono/routes.d.ts +7 -8
- package/dist/hono/routes.js +30 -38
- package/dist/hono/routes.js.map +1 -1
- package/dist/index.cjs +51 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -29
- package/dist/index.d.ts +13 -29
- package/dist/index.js +39 -56
- package/dist/index.js.map +1 -1
- package/dist/koa/index.cjs +16 -38
- package/dist/koa/index.cjs.map +1 -1
- package/dist/koa/index.d.cts +6 -8
- package/dist/koa/index.d.ts +6 -8
- package/dist/koa/index.js +13 -12
- package/dist/koa/index.js.map +1 -1
- package/dist/koa/middleware.cjs +81 -113
- package/dist/koa/middleware.cjs.map +1 -1
- package/dist/koa/middleware.d.cts +5 -5
- package/dist/koa/middleware.d.ts +5 -5
- package/dist/koa/middleware.js +76 -89
- package/dist/koa/middleware.js.map +1 -1
- package/dist/koa/routes.cjs +34 -64
- package/dist/koa/routes.cjs.map +1 -1
- package/dist/koa/routes.d.cts +7 -8
- package/dist/koa/routes.d.ts +7 -8
- package/dist/koa/routes.js +31 -38
- package/dist/koa/routes.js.map +1 -1
- package/dist/logCapture.cjs +293 -381
- package/dist/logCapture.cjs.map +1 -1
- package/dist/logCapture.d.cts +17 -17
- package/dist/logCapture.d.ts +17 -17
- package/dist/logCapture.js +285 -352
- package/dist/logCapture.js.map +1 -1
- package/dist/logRecordExporter.cjs +21 -49
- package/dist/logRecordExporter.cjs.map +1 -1
- package/dist/logRecordExporter.d.cts +12 -13
- package/dist/logRecordExporter.d.ts +12 -13
- package/dist/logRecordExporter.js +19 -24
- package/dist/logRecordExporter.js.map +1 -1
- package/dist/logRecordProcessor.cjs +80 -130
- package/dist/logRecordProcessor.cjs.map +1 -1
- package/dist/logRecordProcessor.d.cts +22 -26
- package/dist/logRecordProcessor.d.ts +22 -26
- package/dist/logRecordProcessor.js +78 -105
- package/dist/logRecordProcessor.js.map +1 -1
- package/dist/logger.cjs +17 -48
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +8 -7
- package/dist/logger.d.ts +8 -7
- package/dist/logger.js +12 -20
- package/dist/logger.js.map +1 -1
- package/dist/metrics.cjs +78 -168
- package/dist/metrics.cjs.map +1 -1
- package/dist/metrics.d.cts +20 -25
- package/dist/metrics.d.ts +20 -25
- package/dist/metrics.js +77 -150
- package/dist/metrics.js.map +1 -1
- package/dist/nestjs/index.cjs +61 -106
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.d.cts +7 -8
- package/dist/nestjs/index.d.ts +7 -8
- package/dist/nestjs/index.js +56 -78
- package/dist/nestjs/index.js.map +1 -1
- package/dist/packageVersion.cjs +28 -59
- package/dist/packageVersion.cjs.map +1 -1
- package/dist/packageVersion.d.cts +6 -5
- package/dist/packageVersion.d.ts +6 -5
- package/dist/packageVersion.js +23 -29
- package/dist/packageVersion.js.map +1 -1
- package/dist/providers.cjs +77 -137
- package/dist/providers.cjs.map +1 -1
- package/dist/providers.d.cts +14 -14
- package/dist/providers.d.ts +14 -14
- package/dist/providers.js +70 -121
- package/dist/providers.js.map +1 -1
- package/dist/redaction.cjs +63 -112
- package/dist/redaction.cjs.map +1 -1
- package/dist/redaction.d.cts +17 -16
- package/dist/redaction.d.ts +17 -16
- package/dist/redaction.js +60 -93
- package/dist/redaction.js.map +1 -1
- package/dist/requestAttributes.cjs +15 -42
- package/dist/requestAttributes.cjs.map +1 -1
- package/dist/requestAttributes.d.cts +7 -10
- package/dist/requestAttributes.d.ts +7 -10
- package/dist/requestAttributes.js +12 -16
- package/dist/requestAttributes.js.map +1 -1
- package/dist/requestObservation.cjs +153 -229
- package/dist/requestObservation.cjs.map +1 -1
- package/dist/requestObservation.d.cts +53 -55
- package/dist/requestObservation.d.ts +53 -55
- package/dist/requestObservation.js +145 -205
- package/dist/requestObservation.js.map +1 -1
- package/dist/requestObservationNode.cjs +136 -181
- package/dist/requestObservationNode.cjs.map +1 -1
- package/dist/requestObservationNode.d.cts +23 -27
- package/dist/requestObservationNode.d.ts +23 -27
- package/dist/requestObservationNode.js +132 -157
- package/dist/requestObservationNode.js.map +1 -1
- package/dist/requestObservationWeb.cjs +151 -188
- package/dist/requestObservationWeb.cjs.map +1 -1
- package/dist/requestObservationWeb.d.cts +25 -29
- package/dist/requestObservationWeb.d.ts +25 -29
- package/dist/requestObservationWeb.js +146 -167
- package/dist/requestObservationWeb.js.map +1 -1
- package/dist/sentry.cjs +52 -92
- package/dist/sentry.cjs.map +1 -1
- package/dist/sentry.d.cts +4 -3
- package/dist/sentry.d.ts +4 -3
- package/dist/sentry.js +48 -65
- package/dist/sentry.js.map +1 -1
- package/dist/serverErrors.cjs +59 -94
- package/dist/serverErrors.cjs.map +1 -1
- package/dist/serverErrors.d.cts +8 -8
- package/dist/serverErrors.d.ts +8 -8
- package/dist/serverErrors.js +54 -66
- package/dist/serverErrors.js.map +1 -1
- package/dist/spanExporter.cjs +159 -210
- package/dist/spanExporter.cjs.map +1 -1
- package/dist/spanExporter.d.cts +32 -32
- package/dist/spanExporter.d.ts +32 -32
- package/dist/spanExporter.js +155 -183
- package/dist/spanExporter.js.map +1 -1
- package/dist/spanProcessor.cjs +387 -502
- package/dist/spanProcessor.cjs.map +1 -1
- package/dist/spanProcessor.d.cts +63 -65
- package/dist/spanProcessor.d.ts +63 -65
- package/dist/spanProcessor.js +376 -477
- package/dist/spanProcessor.js.map +1 -1
- package/dist/spool.cjs +239 -304
- package/dist/spool.cjs.map +1 -1
- package/dist/spool.d.cts +46 -46
- package/dist/spool.d.ts +46 -46
- package/dist/spool.js +235 -285
- package/dist/spool.js.map +1 -1
- package/dist/startup.cjs +63 -88
- package/dist/startup.cjs.map +1 -1
- package/dist/startup.d.cts +13 -13
- package/dist/startup.d.ts +13 -13
- package/dist/startup.js +60 -62
- package/dist/startup.js.map +1 -1
- package/dist/tracing.cjs +72 -100
- package/dist/tracing.cjs.map +1 -1
- package/dist/tracing.d.cts +6 -5
- package/dist/tracing.d.ts +6 -5
- package/dist/tracing.js +69 -79
- package/dist/tracing.js.map +1 -1
- package/dist/validationErrors.cjs +122 -190
- package/dist/validationErrors.cjs.map +1 -1
- package/dist/validationErrors.d.cts +20 -20
- package/dist/validationErrors.d.ts +20 -20
- package/dist/validationErrors.js +110 -155
- package/dist/validationErrors.js.map +1 -1
- package/package.json +5 -6
package/dist/activation.cjs
CHANGED
|
@@ -1,393 +1,311 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
getActivationHandles: () => getActivationHandles,
|
|
26
|
-
isActivated: () => isActivated,
|
|
27
|
-
registerStartupEventInfo: () => registerStartupEventInfo,
|
|
28
|
-
resetActivation: () => resetActivation,
|
|
29
|
-
shutdown: () => shutdown
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(activation_exports);
|
|
32
|
-
var import_node_worker_threads = require("node:worker_threads");
|
|
33
|
-
var import_api = require("@opentelemetry/api");
|
|
34
|
-
var import_instrumentation_undici = require("@opentelemetry/instrumentation-undici");
|
|
35
|
-
var import_sdk_logs = require("@opentelemetry/sdk-logs");
|
|
36
|
-
var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
37
|
-
var import_config = require('./config.cjs');
|
|
38
|
-
var import_exportWorker = require('./exportWorker.cjs');
|
|
39
|
-
var import_logCapture = require('./logCapture.cjs');
|
|
40
|
-
var import_logger = require('./logger.cjs');
|
|
41
|
-
var import_logRecordExporter = require('./logRecordExporter.cjs');
|
|
42
|
-
var import_logRecordProcessor = require('./logRecordProcessor.cjs');
|
|
43
|
-
var import_metrics = require('./metrics.cjs');
|
|
44
|
-
var import_packageVersion = require('./packageVersion.cjs');
|
|
45
|
-
var import_providers = require('./providers.cjs');
|
|
46
|
-
var import_redaction = require('./redaction.cjs');
|
|
47
|
-
var import_sentry = require('./sentry.cjs');
|
|
48
|
-
var import_serverErrors = require('./serverErrors.cjs');
|
|
49
|
-
var import_spanExporter = require('./spanExporter.cjs');
|
|
50
|
-
var import_spanProcessor = require('./spanProcessor.cjs');
|
|
51
|
-
var import_spool = require('./spool.cjs');
|
|
52
|
-
var import_startup = require('./startup.cjs');
|
|
53
|
-
var import_validationErrors = require('./validationErrors.cjs');
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_logger = require("./logger.cjs");
|
|
3
|
+
const require_config = require("./config.cjs");
|
|
4
|
+
const require_packageVersion = require("./packageVersion.cjs");
|
|
5
|
+
const require_exportWorker = require("./exportWorker.cjs");
|
|
6
|
+
const require_logCapture = require("./logCapture.cjs");
|
|
7
|
+
const require_logRecordExporter = require("./logRecordExporter.cjs");
|
|
8
|
+
const require_logRecordProcessor = require("./logRecordProcessor.cjs");
|
|
9
|
+
const require_providers = require("./providers.cjs");
|
|
10
|
+
const require_metrics = require("./metrics.cjs");
|
|
11
|
+
const require_redaction = require("./redaction.cjs");
|
|
12
|
+
const require_sentry = require("./sentry.cjs");
|
|
13
|
+
const require_serverErrors = require("./serverErrors.cjs");
|
|
14
|
+
const require_spanProcessor = require("./spanProcessor.cjs");
|
|
15
|
+
const require_spanExporter = require("./spanExporter.cjs");
|
|
16
|
+
const require_spool = require("./spool.cjs");
|
|
17
|
+
const require_startup = require("./startup.cjs");
|
|
18
|
+
const require_validationErrors = require("./validationErrors.cjs");
|
|
19
|
+
let node_worker_threads = require("node:worker_threads");
|
|
20
|
+
let _opentelemetry_api = require("@opentelemetry/api");
|
|
21
|
+
let _opentelemetry_instrumentation_undici = require("@opentelemetry/instrumentation-undici");
|
|
22
|
+
let _opentelemetry_sdk_logs = require("@opentelemetry/sdk-logs");
|
|
23
|
+
let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
24
|
+
//#region src/activation.ts
|
|
54
25
|
const BATCH_SCHEDULE_DELAY_MILLIS = 1e3;
|
|
55
26
|
const BATCH_EXPORT_TIMEOUT_MILLIS = 3e4;
|
|
56
27
|
const BATCH_MAX_QUEUE_SIZE = 2048;
|
|
57
28
|
const BATCH_MAX_EXPORT_BATCH_SIZE = 512;
|
|
58
29
|
const BATCH_MAX_EXPORT_BATCH_SIZE_WITH_BODY_CAPTURE = 32;
|
|
59
30
|
const SIGNAL_FLUSH_TIMEOUT_MILLIS = 5e3;
|
|
60
|
-
const ACTIVATION_STATE_KEY =
|
|
31
|
+
const ACTIVATION_STATE_KEY = Symbol.for("apitally.activation");
|
|
61
32
|
function configure(options = {}) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(0, import_spanProcessor.setServerSpanActivationCallback)(activate);
|
|
67
|
-
return config;
|
|
33
|
+
const config = require_config.setConfig(options);
|
|
34
|
+
if (!config.disabled && process.env.OTEL_SEMCONV_STABILITY_OPT_IN === void 0) process.env.OTEL_SEMCONV_STABILITY_OPT_IN = "http/dup";
|
|
35
|
+
require_spanProcessor.setServerSpanActivationCallback(activate);
|
|
36
|
+
return config;
|
|
68
37
|
}
|
|
69
38
|
function registerStartupEventInfo(info) {
|
|
70
|
-
|
|
71
|
-
|
|
39
|
+
const activationState = getActivationState();
|
|
40
|
+
activationState.startupEventInfo ??= info;
|
|
72
41
|
}
|
|
73
|
-
function activate(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
installSignalHooks(activationState);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
(0, import_logger.logError)(`Apitally activation failed: ${String(error)}`);
|
|
90
|
-
}
|
|
42
|
+
function activate() {
|
|
43
|
+
const activationState = getActivationState();
|
|
44
|
+
if (activationState.activationAttempted) return;
|
|
45
|
+
activationState.activationAttempted = true;
|
|
46
|
+
if (shouldSkipActivation()) return;
|
|
47
|
+
try {
|
|
48
|
+
const handles = startPipelines(activationState.startupEventInfo);
|
|
49
|
+
activationState.handles = handles;
|
|
50
|
+
activationState.runShutdown = () => drainAndStop(handles);
|
|
51
|
+
installBeforeExitHook(activationState);
|
|
52
|
+
installSignalHooks(activationState);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
require_logger.logError(`Apitally activation failed: ${String(error)}`);
|
|
55
|
+
}
|
|
91
56
|
}
|
|
92
57
|
function isActivated() {
|
|
93
|
-
|
|
58
|
+
return getActivationState().handles !== void 0;
|
|
94
59
|
}
|
|
95
60
|
function getActivationHandles() {
|
|
96
|
-
|
|
61
|
+
return getActivationState().handles;
|
|
97
62
|
}
|
|
98
63
|
async function flushTelemetry() {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
64
|
+
try {
|
|
65
|
+
await getActivationState().handles?.worker.runCycle();
|
|
66
|
+
} catch (error) {
|
|
67
|
+
require_logger.logDebug(`Error flushing telemetry: ${String(error)}`);
|
|
68
|
+
}
|
|
104
69
|
}
|
|
105
70
|
function shutdown() {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
return activationState.shutdownPromise;
|
|
71
|
+
const activationState = getActivationState();
|
|
72
|
+
const handles = activationState.handles;
|
|
73
|
+
const runShutdown = activationState.runShutdown;
|
|
74
|
+
if (!handles || !runShutdown) return Promise.resolve();
|
|
75
|
+
if (!activationState.shutdownPromise) {
|
|
76
|
+
removeLifecycleHooks(activationState);
|
|
77
|
+
const signalDrainPromise = activationState.signalDrainPromise;
|
|
78
|
+
activationState.shutdownPromise = (signalDrainPromise ? signalDrainPromise.then(() => handles.worker.waitForIdle()) : Promise.resolve()).then(runShutdown);
|
|
79
|
+
}
|
|
80
|
+
return activationState.shutdownPromise;
|
|
118
81
|
}
|
|
119
82
|
const activationFactories = {
|
|
120
|
-
|
|
121
|
-
|
|
83
|
+
createSpool: () => new require_spool.Spool(),
|
|
84
|
+
createExportWorker: (options) => new require_exportWorker.ExportWorker(options)
|
|
122
85
|
};
|
|
123
86
|
const defaultFactories = { ...activationFactories };
|
|
124
87
|
async function resetActivation() {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
await handles.worker.stop();
|
|
142
|
-
await handles.spanPipeline.shutdown();
|
|
143
|
-
await handles.loggerProvider.shutdown();
|
|
144
|
-
await handles.spool.clear();
|
|
88
|
+
Object.assign(activationFactories, defaultFactories);
|
|
89
|
+
const holder = globalThis;
|
|
90
|
+
const activationState = holder[ACTIVATION_STATE_KEY];
|
|
91
|
+
delete holder[ACTIVATION_STATE_KEY];
|
|
92
|
+
hasWarnedAboutVersionSkew = false;
|
|
93
|
+
require_validationErrors.resetValidationErrors();
|
|
94
|
+
require_serverErrors.resetServerErrors();
|
|
95
|
+
if (!activationState) return;
|
|
96
|
+
removeLifecycleHooks(activationState);
|
|
97
|
+
const handles = activationState.handles;
|
|
98
|
+
if (!handles) return;
|
|
99
|
+
handles.undiciInstrumentation?.disable();
|
|
100
|
+
await handles.worker.stop();
|
|
101
|
+
await handles.spanPipeline.shutdown();
|
|
102
|
+
await handles.loggerProvider.shutdown();
|
|
103
|
+
await handles.spool.clear();
|
|
145
104
|
}
|
|
146
105
|
let hasWarnedAboutVersionSkew = false;
|
|
147
106
|
function emitErrorEvents(loggerProvider) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
}
|
|
107
|
+
const logger = loggerProvider.getLogger("apitally");
|
|
108
|
+
const events = [[require_validationErrors.VALIDATION_ERROR_EVENT_NAME, require_validationErrors.drainValidationErrors()], [require_serverErrors.SERVER_ERROR_EVENT_NAME, require_serverErrors.drainServerErrors()]];
|
|
109
|
+
for (const [eventName, bodies] of events) for (const body of bodies) logger.emit({
|
|
110
|
+
timestamp: Date.now(),
|
|
111
|
+
context: _opentelemetry_api.ROOT_CONTEXT,
|
|
112
|
+
eventName,
|
|
113
|
+
body
|
|
114
|
+
});
|
|
158
115
|
}
|
|
159
116
|
function getActivationState() {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
holder[ACTIVATION_STATE_KEY] = activationState;
|
|
176
|
-
return activationState;
|
|
117
|
+
const holder = globalThis;
|
|
118
|
+
const existing = holder[ACTIVATION_STATE_KEY];
|
|
119
|
+
if (existing) {
|
|
120
|
+
if (!hasWarnedAboutVersionSkew && existing.sdkVersion !== require_packageVersion.getDistroVersion()) {
|
|
121
|
+
hasWarnedAboutVersionSkew = true;
|
|
122
|
+
require_logger.logWarning(`Two copies of the apitally package with different versions (${existing.sdkVersion} and ${require_packageVersion.getDistroVersion()}) are loaded in this process; version ${existing.sdkVersion} stays active. To resolve this, deduplicate the apitally installation.`);
|
|
123
|
+
}
|
|
124
|
+
return existing;
|
|
125
|
+
}
|
|
126
|
+
const activationState = {
|
|
127
|
+
sdkVersion: require_packageVersion.getDistroVersion(),
|
|
128
|
+
activationAttempted: false
|
|
129
|
+
};
|
|
130
|
+
holder[ACTIVATION_STATE_KEY] = activationState;
|
|
131
|
+
return activationState;
|
|
177
132
|
}
|
|
178
133
|
function shouldSkipActivation() {
|
|
179
|
-
|
|
180
|
-
(0, import_config.isApitallyDisabledViaEnv)() || (0, import_config.getConfig)().disabled;
|
|
134
|
+
return Boolean(process.env.JEST_WORKER_ID) || Boolean(process.env.VITEST) || process.env.NODE_ENV === "test" || require_config.getConfig().disabled;
|
|
181
135
|
}
|
|
182
|
-
function startPipelines(startupEventInfo
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
undiciInstrumentation = createUndiciInstrumentation(config.otlpEndpoint);
|
|
251
|
-
}
|
|
252
|
-
worker.start();
|
|
253
|
-
if (startupEventInfo) {
|
|
254
|
-
(0, import_startup.emitStartupEvent)(loggerProvider, startupEventInfo);
|
|
255
|
-
}
|
|
256
|
-
return {
|
|
257
|
-
spanPipeline,
|
|
258
|
-
tracerProvider,
|
|
259
|
-
loggerProvider,
|
|
260
|
-
metricsPipeline,
|
|
261
|
-
spool,
|
|
262
|
-
worker,
|
|
263
|
-
undiciInstrumentation
|
|
264
|
-
};
|
|
136
|
+
function startPipelines(startupEventInfo) {
|
|
137
|
+
const config = require_config.getConfig();
|
|
138
|
+
let hasUserProvider = require_spanProcessor.isApitallySpanProcessorDeclared();
|
|
139
|
+
const { env, resource } = require_providers.resolveEnvAndCreateResource();
|
|
140
|
+
const instanceId = resource.attributes["service.instance.id"];
|
|
141
|
+
const spool = activationFactories.createSpool();
|
|
142
|
+
const spanExporter = new require_spanExporter.ApitallySpanExporter({
|
|
143
|
+
redaction: new require_redaction.Redaction(),
|
|
144
|
+
env,
|
|
145
|
+
instanceId,
|
|
146
|
+
spool,
|
|
147
|
+
maskRequestBody: config.maskRequestBody,
|
|
148
|
+
maskResponseBody: config.maskResponseBody
|
|
149
|
+
});
|
|
150
|
+
const batchSpanProcessor = new _opentelemetry_sdk_trace_base.BatchSpanProcessor(spanExporter, {
|
|
151
|
+
scheduledDelayMillis: BATCH_SCHEDULE_DELAY_MILLIS,
|
|
152
|
+
exportTimeoutMillis: BATCH_EXPORT_TIMEOUT_MILLIS,
|
|
153
|
+
maxQueueSize: BATCH_MAX_QUEUE_SIZE,
|
|
154
|
+
maxExportBatchSize: config.captureRequestBody || config.captureResponseBody ? BATCH_MAX_EXPORT_BATCH_SIZE_WITH_BODY_CAPTURE : BATCH_MAX_EXPORT_BATCH_SIZE
|
|
155
|
+
});
|
|
156
|
+
const spanPipeline = new require_spanProcessor.SpanPipeline(batchSpanProcessor, () => spanExporter.forceFlush());
|
|
157
|
+
let tracerProvider;
|
|
158
|
+
if (!hasUserProvider) {
|
|
159
|
+
tracerProvider = require_providers.setupTracerProvider(resource, [spanPipeline]);
|
|
160
|
+
if (!tracerProvider) {
|
|
161
|
+
hasUserProvider = true;
|
|
162
|
+
require_logger.logWarning("Apitally could not register its OpenTelemetry tracer provider because another provider is already registered. Only metrics and the startup event are sent to Apitally until you add ApitallySpanProcessor (exported by the apitally package) to your tracer provider's spanProcessors constructor option or the NodeSDK spanProcessors option.");
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
require_spanProcessor.setActiveSpanPipeline(spanPipeline);
|
|
166
|
+
const batchLogProcessor = new _opentelemetry_sdk_logs.BatchLogRecordProcessor({
|
|
167
|
+
exporter: new require_logRecordExporter.ApitallyLogRecordExporter(spool),
|
|
168
|
+
scheduledDelayMillis: BATCH_SCHEDULE_DELAY_MILLIS,
|
|
169
|
+
exportTimeoutMillis: BATCH_EXPORT_TIMEOUT_MILLIS,
|
|
170
|
+
maxQueueSize: BATCH_MAX_QUEUE_SIZE,
|
|
171
|
+
maxExportBatchSize: BATCH_MAX_EXPORT_BATCH_SIZE
|
|
172
|
+
});
|
|
173
|
+
const logRecordProcessor = new require_logRecordProcessor.ApitallyLogRecordProcessor(batchLogProcessor, spanPipeline, config.maskLogRecord);
|
|
174
|
+
const loggerProvider = require_providers.createLoggerProvider(resource, [logRecordProcessor]);
|
|
175
|
+
const metricsPipeline = new require_metrics.MetricsPipeline(resource, spool);
|
|
176
|
+
spanPipeline.metricsRecorder = (record) => metricsPipeline.recordFromRequest(record);
|
|
177
|
+
const worker = activationFactories.createExportWorker({
|
|
178
|
+
spool,
|
|
179
|
+
otlpEndpoint: config.otlpEndpoint,
|
|
180
|
+
writeToken: config.writeToken,
|
|
181
|
+
env
|
|
182
|
+
});
|
|
183
|
+
worker.flushCallbacks.push(() => metricsPipeline.collectAndExport(), () => spanPipeline.forceFlush(), () => emitErrorEvents(loggerProvider), () => batchLogProcessor.forceFlush());
|
|
184
|
+
if (config.captureLogs) {
|
|
185
|
+
require_logCapture.installConsoleCapture(loggerProvider);
|
|
186
|
+
require_logCapture.installNestLoggerCapture(loggerProvider);
|
|
187
|
+
require_logCapture.installWinstonCapture(loggerProvider);
|
|
188
|
+
require_logCapture.installPinoCapture(loggerProvider);
|
|
189
|
+
}
|
|
190
|
+
require_sentry.installSentryEventIdRecording();
|
|
191
|
+
let undiciInstrumentation;
|
|
192
|
+
if (!hasUserProvider) undiciInstrumentation = createUndiciInstrumentation(config.otlpEndpoint);
|
|
193
|
+
worker.start();
|
|
194
|
+
if (startupEventInfo) require_startup.emitStartupEvent(loggerProvider, startupEventInfo);
|
|
195
|
+
return {
|
|
196
|
+
spanPipeline,
|
|
197
|
+
tracerProvider,
|
|
198
|
+
loggerProvider,
|
|
199
|
+
metricsPipeline,
|
|
200
|
+
spool,
|
|
201
|
+
worker,
|
|
202
|
+
undiciInstrumentation
|
|
203
|
+
};
|
|
265
204
|
}
|
|
266
205
|
function createUndiciInstrumentation(otlpEndpoint) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
});
|
|
206
|
+
const endpointOrigin = new URL(otlpEndpoint).origin;
|
|
207
|
+
return new _opentelemetry_instrumentation_undici.UndiciInstrumentation({ ignoreRequestHook: (request) => {
|
|
208
|
+
try {
|
|
209
|
+
return new URL(String(request.origin)).origin === endpointOrigin;
|
|
210
|
+
} catch {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
} });
|
|
277
214
|
}
|
|
278
215
|
async function drainAndStop(handles) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
216
|
+
try {
|
|
217
|
+
await handles.spanPipeline.shutdown();
|
|
218
|
+
await handles.worker.finalDrain();
|
|
219
|
+
await handles.loggerProvider.shutdown();
|
|
220
|
+
await handles.worker.stop();
|
|
221
|
+
} catch (error) {
|
|
222
|
+
require_logger.logWarning(`Error draining telemetry on shutdown: ${String(error)}`);
|
|
223
|
+
}
|
|
287
224
|
}
|
|
288
225
|
function installSignalHooks(activationState) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
removeSignalHooks(activationState, listeners);
|
|
303
|
-
(0, import_logger.logWarning)(`Unable to install Apitally signal handlers: ${String(error)}`);
|
|
304
|
-
}
|
|
226
|
+
if (process.platform === "win32" || !node_worker_threads.isMainThread) return;
|
|
227
|
+
let listeners = {
|
|
228
|
+
SIGTERM: () => handleTerminationSignal(activationState, listeners, "SIGTERM"),
|
|
229
|
+
SIGINT: () => handleTerminationSignal(activationState, listeners, "SIGINT")
|
|
230
|
+
};
|
|
231
|
+
activationState.signalListeners = listeners;
|
|
232
|
+
try {
|
|
233
|
+
process.prependOnceListener("SIGTERM", listeners.SIGTERM);
|
|
234
|
+
process.prependOnceListener("SIGINT", listeners.SIGINT);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
removeSignalHooks(activationState, listeners);
|
|
237
|
+
require_logger.logWarning(`Unable to install Apitally signal handlers: ${String(error)}`);
|
|
238
|
+
}
|
|
305
239
|
}
|
|
306
240
|
function handleTerminationSignal(activationState, listeners, signal) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
241
|
+
const hasApplicationListener = process.listeners(signal).some((listener) => listener !== listeners[signal]);
|
|
242
|
+
removeSignalHooks(activationState, listeners);
|
|
243
|
+
const drainPromise = flushAfterTerminationSignal(activationState, signal, hasApplicationListener);
|
|
244
|
+
activationState.signalDrainPromise = drainPromise;
|
|
245
|
+
drainPromise.catch((error) => {
|
|
246
|
+
require_logger.logDebug(`Error flushing telemetry on ${signal}: ${String(error)}`);
|
|
247
|
+
});
|
|
314
248
|
}
|
|
315
249
|
async function flushAfterTerminationSignal(activationState, signal, hasApplicationListener) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
const exitCode = signal === "SIGTERM" ? 143 : 130;
|
|
333
|
-
if (process.platform === "linux" && process.pid === 1) {
|
|
334
|
-
process.exit(exitCode);
|
|
335
|
-
}
|
|
336
|
-
try {
|
|
337
|
-
process.kill(process.pid, signal);
|
|
338
|
-
} catch {
|
|
339
|
-
process.exit(exitCode);
|
|
340
|
-
}
|
|
250
|
+
const handles = activationState.handles;
|
|
251
|
+
if (!handles) return;
|
|
252
|
+
try {
|
|
253
|
+
if (activationState.shutdownPromise) await waitForSignalDeadline(activationState.shutdownPromise);
|
|
254
|
+
else await handles.worker.finalDrain(SIGNAL_FLUSH_TIMEOUT_MILLIS);
|
|
255
|
+
} catch (error) {
|
|
256
|
+
require_logger.logDebug(`Error flushing telemetry on ${signal}: ${String(error)}`);
|
|
257
|
+
}
|
|
258
|
+
if (hasApplicationListener || process.listeners(signal).length > 0) return;
|
|
259
|
+
const exitCode = signal === "SIGTERM" ? 143 : 130;
|
|
260
|
+
if (process.platform === "linux" && process.pid === 1) process.exit(exitCode);
|
|
261
|
+
try {
|
|
262
|
+
process.kill(process.pid, signal);
|
|
263
|
+
} catch {
|
|
264
|
+
process.exit(exitCode);
|
|
265
|
+
}
|
|
341
266
|
}
|
|
342
267
|
async function waitForSignalDeadline(promise) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
}
|
|
268
|
+
let deadlineTimer;
|
|
269
|
+
const deadlineReached = new Promise((resolve) => {
|
|
270
|
+
deadlineTimer = setTimeout(resolve, SIGNAL_FLUSH_TIMEOUT_MILLIS);
|
|
271
|
+
});
|
|
272
|
+
try {
|
|
273
|
+
await Promise.race([promise, deadlineReached]);
|
|
274
|
+
} finally {
|
|
275
|
+
if (deadlineTimer) clearTimeout(deadlineTimer);
|
|
276
|
+
}
|
|
354
277
|
}
|
|
355
278
|
function removeSignalHooks(activationState, listeners = activationState.signalListeners) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
process.removeListener("SIGINT", listeners.SIGINT);
|
|
361
|
-
if (activationState.signalListeners === listeners) {
|
|
362
|
-
activationState.signalListeners = void 0;
|
|
363
|
-
}
|
|
279
|
+
if (!listeners) return;
|
|
280
|
+
process.removeListener("SIGTERM", listeners.SIGTERM);
|
|
281
|
+
process.removeListener("SIGINT", listeners.SIGINT);
|
|
282
|
+
if (activationState.signalListeners === listeners) activationState.signalListeners = void 0;
|
|
364
283
|
}
|
|
365
284
|
function removeLifecycleHooks(activationState) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
285
|
+
removeSignalHooks(activationState);
|
|
286
|
+
if (activationState.beforeExitListener) {
|
|
287
|
+
process.removeListener("beforeExit", activationState.beforeExitListener);
|
|
288
|
+
activationState.beforeExitListener = void 0;
|
|
289
|
+
}
|
|
371
290
|
}
|
|
372
291
|
function installBeforeExitHook(activationState) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
292
|
+
const listener = () => {
|
|
293
|
+
shutdown().catch((error) => {
|
|
294
|
+
require_logger.logDebug(`Error draining telemetry on shutdown: ${String(error)}`);
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
activationState.beforeExitListener = listener;
|
|
298
|
+
process.on("beforeExit", listener);
|
|
380
299
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
});
|
|
300
|
+
//#endregion
|
|
301
|
+
exports.activate = activate;
|
|
302
|
+
exports.activationFactories = activationFactories;
|
|
303
|
+
exports.configure = configure;
|
|
304
|
+
exports.flushTelemetry = flushTelemetry;
|
|
305
|
+
exports.getActivationHandles = getActivationHandles;
|
|
306
|
+
exports.isActivated = isActivated;
|
|
307
|
+
exports.registerStartupEventInfo = registerStartupEventInfo;
|
|
308
|
+
exports.resetActivation = resetActivation;
|
|
309
|
+
exports.shutdown = shutdown;
|
|
310
|
+
|
|
393
311
|
//# sourceMappingURL=activation.cjs.map
|