apitally 0.25.6 → 1.0.0-alpha.1
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 +191 -184
- package/dist/activation.cjs +371 -0
- package/dist/activation.cjs.map +1 -0
- package/dist/activation.d.cts +41 -0
- package/dist/activation.d.ts +41 -0
- package/dist/activation.js +357 -0
- package/dist/activation.js.map +1 -0
- package/dist/adonisjs/configure.cjs +88 -31
- package/dist/adonisjs/configure.cjs.map +1 -1
- package/dist/adonisjs/configure.d.cts +0 -4
- package/dist/adonisjs/configure.d.ts +0 -4
- package/dist/adonisjs/configure.js +85 -30
- package/dist/adonisjs/configure.js.map +1 -1
- package/dist/adonisjs/index.cjs +4 -23
- package/dist/adonisjs/index.cjs.map +1 -1
- package/dist/adonisjs/index.d.cts +3 -15
- package/dist/adonisjs/index.d.ts +3 -15
- package/dist/adonisjs/index.js +3 -20
- package/dist/adonisjs/index.js.map +1 -1
- package/dist/adonisjs/middleware.cjs +43 -109
- package/dist/adonisjs/middleware.cjs.map +1 -1
- package/dist/adonisjs/middleware.d.cts +1 -16
- package/dist/adonisjs/middleware.d.ts +1 -16
- package/dist/adonisjs/middleware.js +43 -110
- package/dist/adonisjs/middleware.js.map +1 -1
- package/dist/adonisjs/provider.cjs +19 -87
- package/dist/adonisjs/provider.cjs.map +1 -1
- package/dist/adonisjs/provider.d.cts +0 -22
- package/dist/adonisjs/provider.d.ts +0 -22
- package/dist/adonisjs/provider.js +19 -88
- package/dist/adonisjs/provider.js.map +1 -1
- package/dist/adonisjs/stubs/config/apitally.stub +11 -15
- package/dist/bodyCapture.cjs +128 -0
- package/dist/bodyCapture.cjs.map +1 -0
- package/dist/bodyCapture.d.cts +31 -0
- package/dist/bodyCapture.d.ts +31 -0
- package/dist/bodyCapture.js +101 -0
- package/dist/bodyCapture.js.map +1 -0
- package/dist/config.cjs +209 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +42 -0
- package/dist/config.d.ts +42 -0
- package/dist/config.js +174 -0
- package/dist/config.js.map +1 -0
- package/dist/consumer.cjs +98 -0
- package/dist/consumer.cjs.map +1 -0
- package/dist/consumer.d.cts +13 -0
- package/dist/consumer.d.ts +13 -0
- package/dist/consumer.js +78 -0
- package/dist/consumer.js.map +1 -0
- package/dist/context.cjs +68 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +29 -0
- package/dist/context.d.ts +29 -0
- package/dist/context.js +40 -0
- package/dist/context.js.map +1 -0
- package/dist/elysia/index.cjs +12 -13
- package/dist/elysia/index.cjs.map +1 -1
- package/dist/elysia/index.d.cts +7 -16
- package/dist/elysia/index.d.ts +7 -16
- package/dist/elysia/index.js +10 -2
- package/dist/elysia/index.js.map +1 -1
- package/dist/elysia/middleware.cjs +248 -0
- package/dist/elysia/middleware.cjs.map +1 -0
- package/dist/elysia/middleware.d.cts +13 -0
- package/dist/elysia/middleware.d.ts +13 -0
- package/dist/elysia/middleware.js +237 -0
- package/dist/elysia/middleware.js.map +1 -0
- package/dist/{loggers/index.cjs → elysia/routes.cjs} +16 -19
- package/dist/elysia/routes.cjs.map +1 -0
- package/dist/elysia/routes.d.cts +7 -0
- package/dist/elysia/routes.d.ts +7 -0
- package/dist/elysia/routes.js +14 -0
- package/dist/elysia/routes.js.map +1 -0
- package/dist/exceptions.cjs +75 -0
- package/dist/exceptions.cjs.map +1 -0
- package/dist/exceptions.d.cts +7 -0
- package/dist/exceptions.d.ts +7 -0
- package/dist/exceptions.js +49 -0
- package/dist/exceptions.js.map +1 -0
- package/dist/exportSerialization.cjs +56 -0
- package/dist/exportSerialization.cjs.map +1 -0
- package/dist/exportSerialization.d.cts +7 -0
- package/dist/exportSerialization.d.ts +7 -0
- package/dist/exportSerialization.js +32 -0
- package/dist/exportSerialization.js.map +1 -0
- package/dist/exportWorker.cjs +305 -0
- package/dist/exportWorker.cjs.map +1 -0
- package/dist/exportWorker.d.cts +46 -0
- package/dist/exportWorker.d.ts +46 -0
- package/dist/exportWorker.js +279 -0
- package/dist/exportWorker.js.map +1 -0
- package/dist/express/index.cjs +9 -4
- package/dist/express/index.cjs.map +1 -1
- package/dist/express/index.d.cts +6 -10
- package/dist/express/index.d.ts +6 -10
- package/dist/express/index.js +8 -2
- package/dist/express/index.js.map +1 -1
- package/dist/express/install.cjs +45 -0
- package/dist/express/install.cjs.map +1 -0
- package/dist/express/install.d.cts +9 -0
- package/dist/express/install.d.ts +9 -0
- package/dist/express/install.js +21 -0
- package/dist/express/install.js.map +1 -0
- package/dist/express/middleware.cjs +80 -331
- package/dist/express/middleware.cjs.map +1 -1
- package/dist/express/middleware.d.cts +3 -21
- package/dist/express/middleware.d.ts +3 -21
- package/dist/express/middleware.js +81 -328
- package/dist/express/middleware.js.map +1 -1
- package/dist/express/register.cjs +20 -0
- package/dist/express/register.cjs.map +1 -0
- package/dist/express/register.d.cts +2 -0
- package/dist/express/register.d.ts +2 -0
- package/dist/express/register.js +19 -0
- package/dist/express/register.js.map +1 -0
- package/dist/express/routes.cjs +419 -0
- package/dist/express/routes.cjs.map +1 -0
- package/dist/express/routes.d.cts +14 -0
- package/dist/express/routes.d.ts +14 -0
- package/dist/express/routes.js +391 -0
- package/dist/express/routes.js.map +1 -0
- package/dist/fastify/index.cjs +10 -15
- package/dist/fastify/index.cjs.map +1 -1
- package/dist/fastify/index.d.cts +6 -11
- package/dist/fastify/index.d.ts +6 -11
- package/dist/fastify/index.js +9 -3
- package/dist/fastify/index.js.map +1 -1
- package/dist/{common/logging.cjs → fastify/install.cjs} +15 -16
- package/dist/fastify/install.cjs.map +1 -0
- package/dist/fastify/install.d.cts +9 -0
- package/dist/fastify/install.d.ts +9 -0
- package/dist/fastify/install.js +15 -0
- package/dist/fastify/install.js.map +1 -0
- package/dist/fastify/middleware.cjs +118 -0
- package/dist/fastify/middleware.cjs.map +1 -0
- package/dist/fastify/middleware.d.cts +7 -0
- package/dist/fastify/middleware.d.ts +7 -0
- package/dist/fastify/middleware.js +97 -0
- package/dist/fastify/middleware.js.map +1 -0
- package/dist/{common/paramValidation.cjs → fastify/routes.cjs} +15 -17
- package/dist/fastify/routes.cjs.map +1 -0
- package/dist/fastify/routes.d.cts +8 -0
- package/dist/fastify/routes.d.ts +8 -0
- package/dist/fastify/routes.js +14 -0
- package/dist/fastify/routes.js.map +1 -0
- package/dist/h3/index.cjs +28 -4
- package/dist/h3/index.cjs.map +1 -1
- package/dist/h3/index.d.cts +7 -10
- package/dist/h3/index.d.ts +7 -10
- package/dist/h3/index.js +26 -2
- package/dist/h3/index.js.map +1 -1
- package/dist/h3/middleware.cjs +204 -0
- package/dist/h3/middleware.cjs.map +1 -0
- package/dist/h3/middleware.d.cts +5 -0
- package/dist/h3/middleware.d.ts +5 -0
- package/dist/h3/middleware.js +188 -0
- package/dist/h3/middleware.js.map +1 -0
- package/dist/h3/routes.cjs +66 -0
- package/dist/h3/routes.cjs.map +1 -0
- package/dist/h3/routes.d.cts +8 -0
- package/dist/h3/routes.d.ts +8 -0
- package/dist/h3/routes.js +41 -0
- package/dist/h3/routes.js.map +1 -0
- package/dist/hapi/index.cjs +15 -14
- package/dist/hapi/index.cjs.map +1 -1
- package/dist/hapi/index.d.cts +7 -10
- package/dist/hapi/index.d.ts +7 -10
- package/dist/hapi/index.js +14 -3
- package/dist/hapi/index.js.map +1 -1
- package/dist/{loggers/hapi.cjs → hapi/install.cjs} +20 -26
- package/dist/hapi/install.cjs.map +1 -0
- package/dist/hapi/install.d.cts +7 -0
- package/dist/hapi/install.d.ts +7 -0
- package/dist/hapi/install.js +22 -0
- package/dist/hapi/install.js.map +1 -0
- package/dist/hapi/middleware.cjs +158 -0
- package/dist/hapi/middleware.cjs.map +1 -0
- package/dist/hapi/middleware.d.cts +5 -0
- package/dist/hapi/middleware.d.ts +5 -0
- package/dist/hapi/middleware.js +137 -0
- package/dist/hapi/middleware.js.map +1 -0
- package/dist/hapi/routes.cjs +37 -0
- package/dist/hapi/routes.cjs.map +1 -0
- package/dist/hapi/routes.d.cts +8 -0
- package/dist/hapi/routes.d.ts +8 -0
- package/dist/hapi/routes.js +12 -0
- package/dist/hapi/routes.js.map +1 -0
- package/dist/hono/index.cjs +13 -3
- package/dist/hono/index.cjs.map +1 -1
- package/dist/hono/index.d.cts +6 -10
- package/dist/hono/index.d.ts +6 -10
- package/dist/hono/index.js +13 -2
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/middleware.cjs +211 -127
- package/dist/hono/middleware.cjs.map +1 -1
- package/dist/hono/middleware.d.cts +3 -18
- package/dist/hono/middleware.d.ts +3 -18
- package/dist/hono/middleware.js +216 -125
- package/dist/hono/middleware.js.map +1 -1
- package/dist/hono/routes.cjs +74 -0
- package/dist/hono/routes.cjs.map +1 -0
- package/dist/hono/routes.d.cts +8 -0
- package/dist/hono/routes.d.ts +8 -0
- package/dist/hono/routes.js +49 -0
- package/dist/hono/routes.js.map +1 -0
- package/dist/index.cjs +108 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -1
- package/dist/koa/index.cjs +13 -3
- package/dist/koa/index.cjs.map +1 -1
- package/dist/koa/index.d.cts +6 -10
- package/dist/koa/index.d.ts +6 -10
- package/dist/koa/index.js +13 -2
- package/dist/koa/index.js.map +1 -1
- package/dist/koa/middleware.cjs +75 -184
- package/dist/koa/middleware.cjs.map +1 -1
- package/dist/koa/middleware.d.cts +3 -13
- package/dist/koa/middleware.d.ts +3 -13
- package/dist/koa/middleware.js +78 -183
- package/dist/koa/middleware.js.map +1 -1
- package/dist/koa/routes.cjs +71 -0
- package/dist/koa/routes.cjs.map +1 -0
- package/dist/koa/routes.d.cts +8 -0
- package/dist/koa/routes.d.ts +8 -0
- package/dist/koa/routes.js +46 -0
- package/dist/koa/routes.js.map +1 -0
- package/dist/logCapture.cjs +410 -0
- package/dist/logCapture.cjs.map +1 -0
- package/dist/logCapture.d.cts +16 -0
- package/dist/logCapture.d.ts +16 -0
- package/dist/logCapture.js +383 -0
- package/dist/logCapture.js.map +1 -0
- package/dist/logRecordExporter.cjs +83 -0
- package/dist/logRecordExporter.cjs.map +1 -0
- package/dist/logRecordExporter.d.cts +14 -0
- package/dist/logRecordExporter.d.ts +14 -0
- package/dist/logRecordExporter.js +59 -0
- package/dist/logRecordExporter.js.map +1 -0
- package/dist/logRecordProcessor.cjs +120 -0
- package/dist/logRecordProcessor.cjs.map +1 -0
- package/dist/logRecordProcessor.d.cts +23 -0
- package/dist/logRecordProcessor.d.ts +23 -0
- package/dist/logRecordProcessor.js +96 -0
- package/dist/logRecordProcessor.js.map +1 -0
- package/dist/{otel/index.cjs → logRecordTruncation.cjs} +10 -7
- package/dist/logRecordTruncation.cjs.map +1 -0
- package/dist/logRecordTruncation.d.cts +6 -0
- package/dist/logRecordTruncation.d.ts +6 -0
- package/dist/logRecordTruncation.js +8 -0
- package/dist/logRecordTruncation.js.map +1 -0
- package/dist/logger.cjs +62 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +7 -0
- package/dist/logger.d.ts +7 -0
- package/dist/logger.js +34 -0
- package/dist/logger.js.map +1 -0
- package/dist/metrics.cjs +171 -0
- package/dist/metrics.cjs.map +1 -0
- package/dist/metrics.d.cts +24 -0
- package/dist/metrics.d.ts +24 -0
- package/dist/metrics.js +153 -0
- package/dist/metrics.js.map +1 -0
- package/dist/nestjs/index.cjs +61 -71
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.d.cts +3 -11
- package/dist/nestjs/index.d.ts +3 -11
- package/dist/nestjs/index.js +61 -61
- package/dist/nestjs/index.js.map +1 -1
- package/dist/packageVersion.cjs +67 -0
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.cts +5 -0
- package/dist/packageVersion.d.ts +5 -0
- package/dist/packageVersion.js +39 -0
- package/dist/packageVersion.js.map +1 -0
- package/dist/providers.cjs +149 -0
- package/dist/providers.cjs.map +1 -0
- package/dist/providers.d.cts +15 -0
- package/dist/providers.d.ts +15 -0
- package/dist/providers.js +136 -0
- package/dist/providers.js.map +1 -0
- package/dist/redaction.cjs +116 -0
- package/dist/redaction.cjs.map +1 -0
- package/dist/redaction.d.cts +17 -0
- package/dist/redaction.d.ts +17 -0
- package/dist/redaction.js +98 -0
- package/dist/redaction.js.map +1 -0
- package/dist/{common/packageVersions.cjs → requestAttributes.cjs} +21 -19
- package/dist/requestAttributes.cjs.map +1 -0
- package/dist/requestAttributes.d.cts +8 -0
- package/dist/requestAttributes.d.ts +8 -0
- package/dist/requestAttributes.js +22 -0
- package/dist/requestAttributes.js.map +1 -0
- package/dist/requestObservation.cjs +228 -0
- package/dist/requestObservation.cjs.map +1 -0
- package/dist/requestObservation.d.cts +60 -0
- package/dist/requestObservation.d.ts +60 -0
- package/dist/requestObservation.js +208 -0
- package/dist/requestObservation.js.map +1 -0
- package/dist/requestObservationNode.cjs +193 -0
- package/dist/requestObservationNode.cjs.map +1 -0
- package/dist/requestObservationNode.d.cts +29 -0
- package/dist/requestObservationNode.d.ts +29 -0
- package/dist/requestObservationNode.js +170 -0
- package/dist/requestObservationNode.js.map +1 -0
- package/dist/requestObservationWeb.cjs +202 -0
- package/dist/requestObservationWeb.cjs.map +1 -0
- package/dist/requestObservationWeb.d.cts +32 -0
- package/dist/requestObservationWeb.d.ts +32 -0
- package/dist/requestObservationWeb.js +182 -0
- package/dist/requestObservationWeb.js.map +1 -0
- package/dist/sentry.cjs +103 -0
- package/dist/sentry.cjs.map +1 -0
- package/dist/sentry.d.cts +3 -0
- package/dist/sentry.d.ts +3 -0
- package/dist/sentry.js +79 -0
- package/dist/sentry.js.map +1 -0
- package/dist/spanExporter.cjs +218 -0
- package/dist/spanExporter.cjs.map +1 -0
- package/dist/spanExporter.d.cts +33 -0
- package/dist/spanExporter.d.ts +33 -0
- package/dist/spanExporter.js +194 -0
- package/dist/spanExporter.js.map +1 -0
- package/dist/spanProcessor.cjs +523 -0
- package/dist/spanProcessor.cjs.map +1 -0
- package/dist/spanProcessor.d.cts +67 -0
- package/dist/spanProcessor.d.ts +67 -0
- package/dist/spanProcessor.js +501 -0
- package/dist/spanProcessor.js.map +1 -0
- package/dist/spool.cjs +314 -0
- package/dist/spool.cjs.map +1 -0
- package/dist/spool.d.cts +49 -0
- package/dist/spool.d.ts +49 -0
- package/dist/spool.js +297 -0
- package/dist/spool.js.map +1 -0
- package/dist/startup.cjs +93 -0
- package/dist/startup.cjs.map +1 -0
- package/dist/startup.d.cts +15 -0
- package/dist/startup.d.ts +15 -0
- package/dist/startup.js +68 -0
- package/dist/startup.js.map +1 -0
- package/dist/tracing.cjs +116 -0
- package/dist/tracing.cjs.map +1 -0
- package/dist/tracing.d.cts +5 -0
- package/dist/tracing.d.ts +5 -0
- package/dist/tracing.js +96 -0
- package/dist/tracing.js.map +1 -0
- package/package.json +114 -150
- package/dist/common/client.cjs +0 -335
- package/dist/common/client.cjs.map +0 -1
- package/dist/common/client.d.cts +0 -50
- package/dist/common/client.d.ts +0 -50
- package/dist/common/client.js +0 -302
- package/dist/common/client.js.map +0 -1
- package/dist/common/consumerRegistry.cjs +0 -84
- package/dist/common/consumerRegistry.cjs.map +0 -1
- package/dist/common/consumerRegistry.d.cts +0 -20
- package/dist/common/consumerRegistry.d.ts +0 -20
- package/dist/common/consumerRegistry.js +0 -61
- package/dist/common/consumerRegistry.js.map +0 -1
- package/dist/common/headers.cjs +0 -55
- package/dist/common/headers.cjs.map +0 -1
- package/dist/common/headers.d.cts +0 -6
- package/dist/common/headers.d.ts +0 -6
- package/dist/common/headers.js +0 -31
- package/dist/common/headers.js.map +0 -1
- package/dist/common/instance.cjs +0 -158
- package/dist/common/instance.cjs.map +0 -1
- package/dist/common/instance.d.cts +0 -4
- package/dist/common/instance.d.ts +0 -4
- package/dist/common/instance.js +0 -134
- package/dist/common/instance.js.map +0 -1
- package/dist/common/logging.cjs.map +0 -1
- package/dist/common/logging.d.cts +0 -11
- package/dist/common/logging.d.ts +0 -11
- package/dist/common/logging.js +0 -17
- package/dist/common/logging.js.map +0 -1
- package/dist/common/packageVersions.cjs.map +0 -1
- package/dist/common/packageVersions.d.cts +0 -3
- package/dist/common/packageVersions.d.ts +0 -3
- package/dist/common/packageVersions.js +0 -21
- package/dist/common/packageVersions.js.map +0 -1
- package/dist/common/paramValidation.cjs.map +0 -1
- package/dist/common/paramValidation.d.cts +0 -4
- package/dist/common/paramValidation.d.ts +0 -4
- package/dist/common/paramValidation.js +0 -17
- package/dist/common/paramValidation.js.map +0 -1
- package/dist/common/requestCounter.cjs +0 -109
- package/dist/common/requestCounter.cjs.map +0 -1
- package/dist/common/requestCounter.d.cts +0 -24
- package/dist/common/requestCounter.d.ts +0 -24
- package/dist/common/requestCounter.js +0 -90
- package/dist/common/requestCounter.js.map +0 -1
- package/dist/common/requestLogger.cjs +0 -527
- package/dist/common/requestLogger.cjs.map +0 -1
- package/dist/common/requestLogger.d.cts +0 -84
- package/dist/common/requestLogger.d.ts +0 -84
- package/dist/common/requestLogger.js +0 -493
- package/dist/common/requestLogger.js.map +0 -1
- package/dist/common/resources.cjs +0 -49
- package/dist/common/resources.cjs.map +0 -1
- package/dist/common/resources.d.cts +0 -6
- package/dist/common/resources.d.ts +0 -6
- package/dist/common/resources.js +0 -26
- package/dist/common/resources.js.map +0 -1
- package/dist/common/response.cjs +0 -104
- package/dist/common/response.cjs.map +0 -1
- package/dist/common/response.d.cts +0 -15
- package/dist/common/response.d.ts +0 -15
- package/dist/common/response.js +0 -80
- package/dist/common/response.js.map +0 -1
- package/dist/common/sentry.cjs +0 -56
- package/dist/common/sentry.cjs.map +0 -1
- package/dist/common/sentry.d.cts +0 -6
- package/dist/common/sentry.d.ts +0 -6
- package/dist/common/sentry.js +0 -23
- package/dist/common/sentry.js.map +0 -1
- package/dist/common/serverErrorCounter.cjs +0 -121
- package/dist/common/serverErrorCounter.cjs.map +0 -1
- package/dist/common/serverErrorCounter.d.cts +0 -23
- package/dist/common/serverErrorCounter.d.ts +0 -23
- package/dist/common/serverErrorCounter.js +0 -97
- package/dist/common/serverErrorCounter.js.map +0 -1
- package/dist/common/spanCollector.cjs +0 -199
- package/dist/common/spanCollector.cjs.map +0 -1
- package/dist/common/spanCollector.d.cts +0 -45
- package/dist/common/spanCollector.d.ts +0 -45
- package/dist/common/spanCollector.js +0 -176
- package/dist/common/spanCollector.js.map +0 -1
- package/dist/common/tempGzipFile.cjs +0 -121
- package/dist/common/tempGzipFile.cjs.map +0 -1
- package/dist/common/tempGzipFile.d.cts +0 -19
- package/dist/common/tempGzipFile.d.ts +0 -19
- package/dist/common/tempGzipFile.js +0 -98
- package/dist/common/tempGzipFile.js.map +0 -1
- package/dist/common/types.cjs +0 -17
- package/dist/common/types.cjs.map +0 -1
- package/dist/common/types.d.cts +0 -95
- package/dist/common/types.d.ts +0 -95
- package/dist/common/types.js +0 -1
- package/dist/common/types.js.map +0 -1
- package/dist/common/validationErrorCounter.cjs +0 -74
- package/dist/common/validationErrorCounter.cjs.map +0 -1
- package/dist/common/validationErrorCounter.d.cts +0 -20
- package/dist/common/validationErrorCounter.d.ts +0 -20
- package/dist/common/validationErrorCounter.js +0 -55
- package/dist/common/validationErrorCounter.js.map +0 -1
- package/dist/elysia/plugin.cjs +0 -237
- package/dist/elysia/plugin.cjs.map +0 -1
- package/dist/elysia/plugin.d.cts +0 -70
- package/dist/elysia/plugin.d.ts +0 -70
- package/dist/elysia/plugin.js +0 -218
- package/dist/elysia/plugin.js.map +0 -1
- package/dist/elysia/utils.cjs +0 -77
- package/dist/elysia/utils.cjs.map +0 -1
- package/dist/elysia/utils.d.cts +0 -14
- package/dist/elysia/utils.d.ts +0 -14
- package/dist/elysia/utils.js +0 -54
- package/dist/elysia/utils.js.map +0 -1
- package/dist/express/utils.cjs +0 -217
- package/dist/express/utils.cjs.map +0 -1
- package/dist/express/utils.d.cts +0 -37
- package/dist/express/utils.d.ts +0 -37
- package/dist/express/utils.js +0 -189
- package/dist/express/utils.js.map +0 -1
- package/dist/fastify/plugin.cjs +0 -316
- package/dist/fastify/plugin.cjs.map +0 -1
- package/dist/fastify/plugin.d.cts +0 -34
- package/dist/fastify/plugin.d.ts +0 -34
- package/dist/fastify/plugin.js +0 -282
- package/dist/fastify/plugin.js.map +0 -1
- package/dist/h3/plugin.cjs +0 -183
- package/dist/h3/plugin.cjs.map +0 -1
- package/dist/h3/plugin.d.cts +0 -27
- package/dist/h3/plugin.d.ts +0 -27
- package/dist/h3/plugin.js +0 -159
- package/dist/h3/plugin.js.map +0 -1
- package/dist/h3/utils.cjs +0 -77
- package/dist/h3/utils.cjs.map +0 -1
- package/dist/h3/utils.d.cts +0 -14
- package/dist/h3/utils.d.ts +0 -14
- package/dist/h3/utils.js +0 -54
- package/dist/h3/utils.js.map +0 -1
- package/dist/hapi/plugin.cjs +0 -210
- package/dist/hapi/plugin.cjs.map +0 -1
- package/dist/hapi/plugin.d.cts +0 -40
- package/dist/hapi/plugin.d.ts +0 -40
- package/dist/hapi/plugin.js +0 -187
- package/dist/hapi/plugin.js.map +0 -1
- package/dist/hapi/utils.cjs +0 -77
- package/dist/hapi/utils.cjs.map +0 -1
- package/dist/hapi/utils.d.cts +0 -16
- package/dist/hapi/utils.d.ts +0 -16
- package/dist/hapi/utils.js +0 -53
- package/dist/hapi/utils.js.map +0 -1
- package/dist/hono/utils.cjs +0 -113
- package/dist/hono/utils.cjs.map +0 -1
- package/dist/hono/utils.d.cts +0 -16
- package/dist/hono/utils.d.ts +0 -16
- package/dist/hono/utils.js +0 -88
- package/dist/hono/utils.js.map +0 -1
- package/dist/loggers/console.cjs +0 -67
- package/dist/loggers/console.cjs.map +0 -1
- package/dist/loggers/console.d.cts +0 -11
- package/dist/loggers/console.d.ts +0 -11
- package/dist/loggers/console.js +0 -44
- package/dist/loggers/console.js.map +0 -1
- package/dist/loggers/hapi.cjs.map +0 -1
- package/dist/loggers/hapi.d.cts +0 -12
- package/dist/loggers/hapi.d.ts +0 -12
- package/dist/loggers/hapi.js +0 -29
- package/dist/loggers/hapi.js.map +0 -1
- package/dist/loggers/index.cjs.map +0 -1
- package/dist/loggers/index.d.cts +0 -13
- package/dist/loggers/index.d.ts +0 -13
- package/dist/loggers/index.js +0 -13
- package/dist/loggers/index.js.map +0 -1
- package/dist/loggers/nestjs.cjs +0 -104
- package/dist/loggers/nestjs.cjs.map +0 -1
- package/dist/loggers/nestjs.d.cts +0 -11
- package/dist/loggers/nestjs.d.ts +0 -11
- package/dist/loggers/nestjs.js +0 -71
- package/dist/loggers/nestjs.js.map +0 -1
- package/dist/loggers/pino.cjs +0 -152
- package/dist/loggers/pino.cjs.map +0 -1
- package/dist/loggers/pino.d.cts +0 -11
- package/dist/loggers/pino.d.ts +0 -11
- package/dist/loggers/pino.js +0 -119
- package/dist/loggers/pino.js.map +0 -1
- package/dist/loggers/utils.cjs +0 -64
- package/dist/loggers/utils.cjs.map +0 -1
- package/dist/loggers/utils.d.cts +0 -6
- package/dist/loggers/utils.d.ts +0 -6
- package/dist/loggers/utils.js +0 -40
- package/dist/loggers/utils.js.map +0 -1
- package/dist/loggers/winston.cjs +0 -101
- package/dist/loggers/winston.cjs.map +0 -1
- package/dist/loggers/winston.d.cts +0 -11
- package/dist/loggers/winston.d.ts +0 -11
- package/dist/loggers/winston.js +0 -68
- package/dist/loggers/winston.js.map +0 -1
- package/dist/otel/index.cjs.map +0 -1
- package/dist/otel/index.d.cts +0 -2
- package/dist/otel/index.d.ts +0 -2
- package/dist/otel/index.js +0 -5
- package/dist/otel/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -19,57 +19,39 @@
|
|
|
19
19
|
</p>
|
|
20
20
|
<br>
|
|
21
21
|
|
|
22
|
-
# Apitally SDK for
|
|
22
|
+
# Apitally SDK for JavaScript
|
|
23
23
|
|
|
24
24
|
[](https://github.com/apitally/apitally-js/actions)
|
|
25
25
|
[](https://codecov.io/gh/apitally/apitally-js)
|
|
26
26
|
[](https://www.npmjs.com/package/apitally)
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
Get started in minutes by just adding a few lines of code. No infrastructure changes required, no dashboards to build.
|
|
28
|
+
API monitoring, analytics and request logging for [AdonisJS](https://github.com/adonisjs/core), [Elysia](https://github.com/elysiajs/elysia), [Express](https://github.com/expressjs/express), [Fastify](https://github.com/fastify/fastify), [H3](https://github.com/h3js/h3), [Hapi](https://github.com/hapijs/hapi), [Hono](https://github.com/honojs/hono), [Koa](https://github.com/koajs/koa) and [NestJS](https://github.com/nestjs/nest), built on OpenTelemetry. One line of setup instruments your app and streams traces, logs and metrics to Apitally. No OpenTelemetry knowledge, infrastructure changes or dashboards are required.
|
|
30
29
|
|
|
31
|
-
Learn more about Apitally on our 🌎 [website](https://apitally.io) or check out
|
|
32
|
-
the 📚 [documentation](https://docs.apitally.io).
|
|
30
|
+
Learn more about Apitally on our 🌎 [website](https://apitally.io) or check out the 📚 [documentation](https://docs.apitally.io).
|
|
33
31
|
|
|
34
32
|
## Key features
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Drill down from insights to individual API requests or use powerful search and filters to
|
|
45
|
-
find specific requests. View correlated application logs and traces for a complete picture
|
|
46
|
-
of each request, making troubleshooting faster and easier.
|
|
47
|
-
|
|
48
|
-
### Error tracking
|
|
49
|
-
|
|
50
|
-
Understand which validation rules in your endpoints cause client errors. Capture
|
|
51
|
-
error details and stack traces for 500 error responses, and have them linked to
|
|
52
|
-
Sentry issues automatically.
|
|
53
|
-
|
|
54
|
-
### API monitoring & alerts
|
|
55
|
-
|
|
56
|
-
Get notified immediately if something isn't right using custom alerts, synthetic
|
|
57
|
-
uptime checks and heartbeat monitoring. Alert notifications can be delivered via
|
|
58
|
-
email, Slack and Microsoft Teams.
|
|
34
|
+
- **API analytics**: Traffic, error and performance metrics for your API, each endpoint, and individual API consumers.
|
|
35
|
+
- **Request logging**: Every request as a searchable log entry, with optional capture of headers and request/response bodies.
|
|
36
|
+
- **Application logs**: Logs written via `console`, winston, pino, Hapi's `request.log()` or Nest's default `ConsoleLogger` are captured automatically and correlated with the request they belong to.
|
|
37
|
+
- **Distributed tracing**: Requests are exported as OpenTelemetry spans, including spans from any other instrumentations you run.
|
|
38
|
+
- **Error tracking**: Exceptions with stack traces for server errors, automatically linked to Sentry events if you use Sentry.
|
|
39
|
+
- **Server metrics**: CPU, memory and uptime of your app's processes.
|
|
40
|
+
- **Data privacy built in**: Sensitive headers and query parameters are masked by default, with configurable masking for anything else, plus sampling to control data volume.
|
|
59
41
|
|
|
60
42
|
## Supported frameworks
|
|
61
43
|
|
|
62
|
-
| Framework
|
|
63
|
-
|
|
|
64
|
-
| [**
|
|
65
|
-
| [**
|
|
66
|
-
| [**
|
|
67
|
-
| [**
|
|
68
|
-
| [**
|
|
69
|
-
| [**
|
|
70
|
-
| [**
|
|
71
|
-
| [**Koa**](https://github.com/koajs/koa)
|
|
72
|
-
| [**
|
|
44
|
+
| Framework | Supported versions | Setup guide |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| [**AdonisJS**](https://github.com/adonisjs/core) | `>= 6.3`, `< 8` | [Link](https://docs.apitally.io/setup-guides/adonisjs) |
|
|
47
|
+
| [**Elysia**](https://github.com/elysiajs/elysia) | `>= 1.1`, `< 2` | [Link](https://docs.apitally.io/setup-guides/elysia) |
|
|
48
|
+
| [**Express**](https://github.com/expressjs/express) | `>= 4.18.2`, `< 6` | [Link](https://docs.apitally.io/setup-guides/express) |
|
|
49
|
+
| [**Fastify**](https://github.com/fastify/fastify) | `>= 4.10.2`, `< 6` | [Link](https://docs.apitally.io/setup-guides/fastify) |
|
|
50
|
+
| [**H3**](https://github.com/h3js/h3) \* | `>= 2.0.1-rc.26`, `< 3` | [Link](https://docs.apitally.io/setup-guides/h3) |
|
|
51
|
+
| [**Hapi**](https://github.com/hapijs/hapi) | `21.x` | [Link](https://docs.apitally.io/setup-guides/hapi) |
|
|
52
|
+
| [**Hono**](https://github.com/honojs/hono) \* | `>= 4.8.4`, `< 5` | [Link](https://docs.apitally.io/setup-guides/hono) |
|
|
53
|
+
| [**Koa**](https://github.com/koajs/koa) | `2.x`, `3.x` | [Link](https://docs.apitally.io/setup-guides/koa) |
|
|
54
|
+
| [**NestJS**](https://github.com/nestjs/nest) | `10.x`, `11.x` | [Link](https://docs.apitally.io/setup-guides/nestjs) |
|
|
73
55
|
|
|
74
56
|
\* For Hono on Cloudflare Workers use our [Serverless SDK](https://github.com/apitally/apitally-js-serverless) instead.
|
|
75
57
|
|
|
@@ -77,146 +59,125 @@ Apitally also supports many other web frameworks in [Python](https://github.com/
|
|
|
77
59
|
|
|
78
60
|
## Getting started
|
|
79
61
|
|
|
80
|
-
If you don't have an Apitally account yet, first [sign up here](https://app.apitally.io/?signup). Then create an app in the Apitally dashboard. You'll see detailed setup instructions with code snippets you can copy and paste
|
|
62
|
+
If you don't have an Apitally account yet, first [sign up here](https://app.apitally.io/?signup). Then create an app in the Apitally dashboard. You'll see detailed setup instructions with code snippets you can copy and paste, including your write token.
|
|
81
63
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Express
|
|
85
|
-
|
|
86
|
-
Install the SDK:
|
|
64
|
+
Install the SDK. AdonisJS applications should use the Ace command in the next section instead.
|
|
87
65
|
|
|
88
66
|
```bash
|
|
89
67
|
npm install apitally
|
|
90
68
|
```
|
|
91
69
|
|
|
92
|
-
|
|
70
|
+
Pass the write token via the `writeToken` option, or set the `APITALLY_WRITE_TOKEN` environment variable. See the [SDK reference](https://docs.apitally.io/sdk-reference/javascript) for all available configuration options, including how to mask sensitive data, customize request logging, and more.
|
|
93
71
|
|
|
94
|
-
|
|
95
|
-
const express = require("express");
|
|
96
|
-
const { useApitally } = require("apitally/express");
|
|
72
|
+
### AdonisJS
|
|
97
73
|
|
|
98
|
-
|
|
99
|
-
app.use(express.json());
|
|
74
|
+
Run the Ace add command from your application directory:
|
|
100
75
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
env: "dev", // or "prod" etc.
|
|
104
|
-
});
|
|
76
|
+
```bash
|
|
77
|
+
node ace add apitally
|
|
105
78
|
```
|
|
106
79
|
|
|
107
|
-
|
|
108
|
-
[setup guide for Express](https://docs.apitally.io/setup-guides/express).
|
|
109
|
-
|
|
110
|
-
### Fastify
|
|
80
|
+
The command installs and configures Apitally. It creates `config/apitally.ts`, adds the required environment declarations, registers the service provider and server middleware, and updates the conventional exception handler to report unhandled 5xx errors.
|
|
111
81
|
|
|
112
|
-
|
|
82
|
+
If Apitally is already installed, or to rerun setup, use:
|
|
113
83
|
|
|
114
84
|
```bash
|
|
115
|
-
|
|
85
|
+
node ace configure apitally
|
|
116
86
|
```
|
|
117
87
|
|
|
118
|
-
|
|
88
|
+
Request headers, request bodies, and response bodies are opt-in prompts during setup. Response headers are enabled by default. You can change these settings later in `config/apitally.ts`.
|
|
119
89
|
|
|
120
|
-
|
|
121
|
-
import Fastify from "fastify";
|
|
122
|
-
import { apitallyPlugin } from "apitally/fastify";
|
|
90
|
+
The SDK-wide environment default is `dev`. `APITALLY_ENV` is deployment-specific, so set it appropriately for staging and production.
|
|
123
91
|
|
|
124
|
-
|
|
92
|
+
For further instructions, see our [setup guide for AdonisJS](https://docs.apitally.io/setup-guides/adonisjs).
|
|
125
93
|
|
|
126
|
-
|
|
127
|
-
clientId: "your-client-id",
|
|
128
|
-
env: "dev", // or "prod" etc.
|
|
129
|
-
});
|
|
130
|
-
```
|
|
94
|
+
### Elysia
|
|
131
95
|
|
|
132
|
-
|
|
96
|
+
Register `apitallyPlugin()` immediately after creating the app, before routes or plugins that add routes:
|
|
133
97
|
|
|
134
|
-
|
|
135
|
-
|
|
98
|
+
```javascript
|
|
99
|
+
import { Elysia } from "elysia";
|
|
100
|
+
import { apitallyPlugin } from "apitally/elysia";
|
|
136
101
|
|
|
137
|
-
|
|
102
|
+
const app = new Elysia()
|
|
103
|
+
.use(
|
|
104
|
+
apitallyPlugin({
|
|
105
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
106
|
+
env: "dev", // optional, defaults to "dev"
|
|
107
|
+
}),
|
|
108
|
+
)
|
|
109
|
+
// register plugins and routes below this point
|
|
110
|
+
.get("/items/:id", ({ params }) => ({ id: params.id }));
|
|
111
|
+
```
|
|
138
112
|
|
|
139
|
-
|
|
113
|
+
For further instructions, see our [setup guide for Elysia](https://docs.apitally.io/setup-guides/elysia).
|
|
140
114
|
|
|
141
|
-
|
|
142
|
-
npm install apitally
|
|
143
|
-
```
|
|
115
|
+
### Express
|
|
144
116
|
|
|
145
|
-
|
|
117
|
+
Import `apitally/express/register` on the first line of your entry module, then call `useApitally(app)` anywhere after creating the app:
|
|
146
118
|
|
|
147
119
|
```javascript
|
|
148
|
-
import
|
|
149
|
-
import { useApitally } from "apitally/nestjs";
|
|
150
|
-
import { AppModule } from "./app.module";
|
|
120
|
+
import "apitally/express/register"; // must be the first import
|
|
151
121
|
|
|
152
|
-
|
|
153
|
-
|
|
122
|
+
import express from "express";
|
|
123
|
+
import { useApitally } from "apitally";
|
|
154
124
|
|
|
155
|
-
|
|
156
|
-
clientId: "your-client-id",
|
|
157
|
-
env: "dev", // or "prod" etc.
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// ...
|
|
161
|
-
}
|
|
125
|
+
const app = express();
|
|
162
126
|
|
|
163
|
-
|
|
127
|
+
useApitally(app, {
|
|
128
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
129
|
+
env: "dev", // optional, defaults to "dev"
|
|
130
|
+
});
|
|
164
131
|
```
|
|
165
132
|
|
|
166
|
-
|
|
167
|
-
[setup guide for NestJS](https://docs.apitally.io/setup-guides/nestjs).
|
|
133
|
+
The register import ensures routes are captured no matter where they are registered — including routers assembled at module scope. It's one rule for every app shape: first line of your entry module.
|
|
168
134
|
|
|
169
|
-
|
|
135
|
+
For further instructions, see our [setup guide for Express](https://docs.apitally.io/setup-guides/express).
|
|
170
136
|
|
|
171
|
-
|
|
137
|
+
### Fastify
|
|
172
138
|
|
|
173
|
-
|
|
174
|
-
npm install apitally
|
|
175
|
-
```
|
|
139
|
+
Call `useApitally(app)` immediately after creating the app, before registering plugins and routes:
|
|
176
140
|
|
|
177
|
-
|
|
141
|
+
```javascript
|
|
142
|
+
import Fastify from "fastify";
|
|
143
|
+
import { useApitally } from "apitally";
|
|
178
144
|
|
|
179
|
-
|
|
180
|
-
node ace configure apitally/adonisjs
|
|
181
|
-
```
|
|
145
|
+
const app = Fastify();
|
|
182
146
|
|
|
183
|
-
|
|
184
|
-
|
|
147
|
+
useApitally(app, {
|
|
148
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
149
|
+
env: "dev", // optional, defaults to "dev"
|
|
150
|
+
});
|
|
185
151
|
|
|
186
|
-
|
|
152
|
+
// register plugins and routes below this point
|
|
153
|
+
```
|
|
187
154
|
|
|
188
|
-
|
|
155
|
+
For further instructions, see our [setup guide for Fastify](https://docs.apitally.io/setup-guides/fastify).
|
|
189
156
|
|
|
190
|
-
|
|
191
|
-
npm install apitally
|
|
192
|
-
```
|
|
157
|
+
### NestJS
|
|
193
158
|
|
|
194
|
-
|
|
159
|
+
Call the synchronous `useApitally(app)` immediately after creating the Nest application, before `app.init()` or `app.listen()`:
|
|
195
160
|
|
|
196
161
|
```javascript
|
|
197
|
-
import {
|
|
198
|
-
import { useApitally } from "apitally/
|
|
162
|
+
import { NestFactory } from "@nestjs/core";
|
|
163
|
+
import { useApitally } from "apitally/nestjs";
|
|
164
|
+
import { AppModule } from "./app.module.js";
|
|
199
165
|
|
|
200
|
-
const app =
|
|
166
|
+
const app = await NestFactory.create(AppModule);
|
|
201
167
|
|
|
202
168
|
useApitally(app, {
|
|
203
|
-
|
|
204
|
-
env: "dev", //
|
|
169
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
170
|
+
env: "dev", // optional, defaults to "dev"
|
|
205
171
|
});
|
|
172
|
+
|
|
173
|
+
await app.listen(3000);
|
|
206
174
|
```
|
|
207
175
|
|
|
208
|
-
For further instructions, see our
|
|
209
|
-
[setup guide for Hono](https://docs.apitally.io/setup-guides/hono).
|
|
176
|
+
For further instructions, see our [setup guide for NestJS](https://docs.apitally.io/setup-guides/nestjs).
|
|
210
177
|
|
|
211
178
|
### H3
|
|
212
179
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
npm install apitally
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
Then register the Apitally plugin with your application:
|
|
180
|
+
Add `apitallyPlugin()` when constructing the root H3 app:
|
|
220
181
|
|
|
221
182
|
```javascript
|
|
222
183
|
import { H3 } from "h3";
|
|
@@ -225,107 +186,153 @@ import { apitallyPlugin } from "apitally/h3";
|
|
|
225
186
|
const app = new H3({
|
|
226
187
|
plugins: [
|
|
227
188
|
apitallyPlugin({
|
|
228
|
-
|
|
229
|
-
env: "dev", //
|
|
189
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
190
|
+
env: "dev", // optional, defaults to "dev"
|
|
230
191
|
}),
|
|
231
192
|
],
|
|
232
193
|
});
|
|
233
194
|
```
|
|
234
195
|
|
|
235
|
-
For further instructions, see our
|
|
236
|
-
[setup guide for H3](https://docs.apitally.io/setup-guides/h3).
|
|
196
|
+
For further instructions, see our [setup guide for H3](https://docs.apitally.io/setup-guides/h3).
|
|
237
197
|
|
|
238
|
-
###
|
|
198
|
+
### Hapi
|
|
239
199
|
|
|
240
|
-
|
|
200
|
+
Register `apitallyPlugin()` before calling `server.initialize()` or `server.start()`:
|
|
241
201
|
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
|
|
202
|
+
```javascript
|
|
203
|
+
import Hapi from "@hapi/hapi";
|
|
204
|
+
import { apitallyPlugin } from "apitally/hapi";
|
|
245
205
|
|
|
246
|
-
|
|
206
|
+
const server = Hapi.server({ port: 3000 });
|
|
247
207
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
208
|
+
await server.register(
|
|
209
|
+
apitallyPlugin({
|
|
210
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
211
|
+
env: "dev", // optional, defaults to "dev"
|
|
212
|
+
}),
|
|
213
|
+
);
|
|
251
214
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
apitallyPlugin({
|
|
255
|
-
clientId: "your-client-id",
|
|
256
|
-
env: "dev", // or "prod" etc.
|
|
257
|
-
}),
|
|
258
|
-
)
|
|
259
|
-
.get("/", () => "hello");
|
|
215
|
+
// register application plugins and routes below this point
|
|
216
|
+
await server.start();
|
|
260
217
|
```
|
|
261
218
|
|
|
262
|
-
For further instructions, see our
|
|
263
|
-
[setup guide for Elysia](https://docs.apitally.io/setup-guides/elysia).
|
|
219
|
+
For further instructions, see our [setup guide for Hapi](https://docs.apitally.io/setup-guides/hapi).
|
|
264
220
|
|
|
265
|
-
###
|
|
221
|
+
### Hono
|
|
266
222
|
|
|
267
|
-
|
|
223
|
+
Call `useApitally(app)` immediately after creating the app — before registering middleware and routes, and before `app.fetch` is handed to the server:
|
|
268
224
|
|
|
269
|
-
```
|
|
270
|
-
|
|
225
|
+
```javascript
|
|
226
|
+
import { Hono } from "hono";
|
|
227
|
+
import { useApitally } from "apitally";
|
|
228
|
+
|
|
229
|
+
const app = new Hono();
|
|
230
|
+
|
|
231
|
+
useApitally(app, {
|
|
232
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
233
|
+
env: "dev", // optional, defaults to "dev"
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// register middleware and routes below this point
|
|
271
237
|
```
|
|
272
238
|
|
|
273
|
-
|
|
239
|
+
For further instructions, see our [setup guide for Hono](https://docs.apitally.io/setup-guides/hono).
|
|
240
|
+
|
|
241
|
+
### Koa
|
|
242
|
+
|
|
243
|
+
Call `useApitally(app)` immediately after creating the app, before registering middleware and routes:
|
|
274
244
|
|
|
275
245
|
```javascript
|
|
276
246
|
const Koa = require("koa");
|
|
277
|
-
const { useApitally } = require("apitally
|
|
247
|
+
const { useApitally } = require("apitally");
|
|
278
248
|
|
|
279
249
|
const app = new Koa();
|
|
280
250
|
|
|
281
251
|
useApitally(app, {
|
|
282
|
-
|
|
283
|
-
env: "dev", //
|
|
252
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
253
|
+
env: "dev", // optional, defaults to "dev"
|
|
284
254
|
});
|
|
255
|
+
|
|
256
|
+
// register middleware and routes below this point
|
|
285
257
|
```
|
|
286
258
|
|
|
287
|
-
For further instructions, see our
|
|
288
|
-
[setup guide for Koa](https://docs.apitally.io/setup-guides/koa).
|
|
259
|
+
For further instructions, see our [setup guide for Koa](https://docs.apitally.io/setup-guides/koa).
|
|
289
260
|
|
|
290
|
-
|
|
261
|
+
## Trusted proxies
|
|
291
262
|
|
|
292
|
-
|
|
263
|
+
When your application runs behind a reverse proxy, configure the framework's trusted-proxy setting so Apitally can record the client IP for GeoIP. The SDK uses the client address resolved by Express, Fastify, Koa, AdonisJS, or the corresponding NestJS adapter. It does not trust forwarding headers directly.
|
|
293
264
|
|
|
294
|
-
|
|
295
|
-
|
|
265
|
+
## Using Sentry
|
|
266
|
+
|
|
267
|
+
Sentry's Node.js SDK registers an OpenTelemetry tracer provider by default. If you use Sentry for error monitoring without performance tracing, let Apitally configure OpenTelemetry by disabling Sentry's setup:
|
|
268
|
+
|
|
269
|
+
```javascript
|
|
270
|
+
Sentry.init({
|
|
271
|
+
dsn: "your-sentry-dsn",
|
|
272
|
+
skipOpenTelemetrySetup: true,
|
|
273
|
+
});
|
|
296
274
|
```
|
|
297
275
|
|
|
298
|
-
|
|
276
|
+
This keeps Sentry error reporting and Apitally's request logs and traces working together. If you use Sentry performance tracing, configure a shared OpenTelemetry provider and include `ApitallySpanProcessor` as described below.
|
|
277
|
+
|
|
278
|
+
## Works with your existing OpenTelemetry setup
|
|
279
|
+
|
|
280
|
+
If your app doesn't use OpenTelemetry, you don't need to know it's there — the SDK sets up a private, fully configured pipeline.
|
|
281
|
+
|
|
282
|
+
If your app already registers its own tracer provider (e.g. via `NodeSDK`), Apitally never replaces it. Instead, add the `ApitallySpanProcessor` to your provider's span processors:
|
|
299
283
|
|
|
300
284
|
```javascript
|
|
301
|
-
|
|
302
|
-
|
|
285
|
+
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
286
|
+
import { ApitallySpanProcessor } from "apitally";
|
|
303
287
|
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
288
|
+
const sdk = new NodeSDK({
|
|
289
|
+
spanProcessors: [new ApitallySpanProcessor()],
|
|
290
|
+
// ...your existing configuration
|
|
291
|
+
});
|
|
292
|
+
```
|
|
309
293
|
|
|
310
|
-
|
|
311
|
-
plugin: apitallyPlugin({
|
|
312
|
-
clientId: "your-client-id",
|
|
313
|
-
env: "dev", // or "prod" etc.
|
|
314
|
-
}),
|
|
315
|
-
});
|
|
316
|
-
};
|
|
294
|
+
Your existing exporters keep seeing everything they already see: Apitally adopts the spans your instrumentation produces instead of creating duplicates, and its meter and logger providers stay private, so nothing leaks into your own pipelines.
|
|
317
295
|
|
|
318
|
-
|
|
296
|
+
When using Elysia's `@elysia/opentelemetry` plugin, register Apitally first so it adopts the OpenTelemetry SERVER span:
|
|
297
|
+
|
|
298
|
+
```javascript
|
|
299
|
+
import { opentelemetry } from "@elysia/opentelemetry";
|
|
300
|
+
import { Elysia } from "elysia";
|
|
301
|
+
import { apitallyPlugin } from "apitally/elysia";
|
|
302
|
+
|
|
303
|
+
const app = new Elysia()
|
|
304
|
+
.use(apitallyPlugin(options))
|
|
305
|
+
.use(opentelemetry());
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Graceful shutdown
|
|
309
|
+
|
|
310
|
+
Telemetry is exported in the background roughly every 15 seconds. After successful activation, Apitally installs `SIGTERM` and `SIGINT` listeners by default on supported POSIX main-thread processes. There is no opt-out, and the fixed five-second timeout is not configurable.
|
|
311
|
+
|
|
312
|
+
On either signal, Apitally makes a non-destructive best-effort final drain of completed telemetry for up to five seconds. If another listener exists for that signal, that listener retains application lifecycle ownership. It must eventually terminate the process or allow it to drain naturally. If Apitally is the sole listener, it removes its listeners before draining and then restores the signal's original termination behavior. A repeated signal is therefore not delayed by another Apitally drain.
|
|
313
|
+
|
|
314
|
+
Use the `shutdown()` function for the coordinated full teardown path. Stop traffic and wait for in-flight work before awaiting it:
|
|
315
|
+
|
|
316
|
+
```javascript
|
|
317
|
+
import { shutdown } from "apitally";
|
|
318
|
+
|
|
319
|
+
process.on("SIGTERM", () => {
|
|
320
|
+
server.close(async () => {
|
|
321
|
+
await shutdown();
|
|
322
|
+
});
|
|
323
|
+
});
|
|
319
324
|
```
|
|
320
325
|
|
|
321
|
-
|
|
322
|
-
|
|
326
|
+
## Runtime support
|
|
327
|
+
|
|
328
|
+
- **Node.js** `>= 20.6`
|
|
329
|
+
- **Bun** is supported for Elysia, H3 and Hono apps
|
|
330
|
+
|
|
331
|
+
For edge and serverless runtimes like Cloudflare Workers, use our [Serverless SDK](https://github.com/apitally/apitally-js-serverless) instead.
|
|
323
332
|
|
|
324
333
|
## Getting help
|
|
325
334
|
|
|
326
|
-
If you need help please
|
|
327
|
-
[create a new discussion](https://github.com/orgs/apitally/discussions/categories/q-a)
|
|
328
|
-
on GitHub or email us at [support@apitally.io](mailto:support@apitally.io). We'll get back to you as soon as possible.
|
|
335
|
+
If you need help please [create a new discussion](https://github.com/orgs/apitally/discussions/categories/q-a) on GitHub or email us at [support@apitally.io](mailto:support@apitally.io). We'll get back to you as soon as possible.
|
|
329
336
|
|
|
330
337
|
## License
|
|
331
338
|
|