apitally 0.25.8 → 1.0.0-beta.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 +228 -178
- package/dist/activation.cjs +393 -0
- package/dist/activation.cjs.map +1 -0
- package/dist/activation.d.cts +42 -0
- package/dist/activation.d.ts +42 -0
- package/dist/activation.js +383 -0
- package/dist/activation.js.map +1 -0
- package/dist/adonisjs/configure.cjs +86 -30
- 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 +83 -29
- package/dist/adonisjs/configure.js.map +1 -1
- package/dist/adonisjs/index.cjs +38 -21
- package/dist/adonisjs/index.cjs.map +1 -1
- package/dist/adonisjs/index.d.cts +5 -14
- package/dist/adonisjs/index.d.ts +5 -14
- package/dist/adonisjs/index.js +39 -18
- 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 +227 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +45 -0
- package/dist/config.d.ts +45 -0
- package/dist/config.js +192 -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 +15 -0
- package/dist/consumer.d.ts +15 -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 +33 -0
- package/dist/context.d.ts +33 -0
- package/dist/context.js +40 -0
- package/dist/context.js.map +1 -0
- package/dist/elysia/index.cjs +12 -3
- package/dist/elysia/index.cjs.map +1 -1
- package/dist/elysia/index.d.cts +8 -16
- package/dist/elysia/index.d.ts +8 -16
- package/dist/elysia/index.js +10 -2
- package/dist/elysia/index.js.map +1 -1
- package/dist/elysia/middleware.cjs +261 -0
- package/dist/elysia/middleware.cjs.map +1 -0
- package/dist/elysia/middleware.d.cts +14 -0
- package/dist/elysia/middleware.d.ts +14 -0
- package/dist/elysia/middleware.js +250 -0
- package/dist/elysia/middleware.js.map +1 -0
- package/dist/{otel/index.cjs → elysia/routes.cjs} +16 -7
- 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 +81 -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 +55 -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 +7 -10
- package/dist/express/index.d.ts +7 -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 +10 -0
- package/dist/express/install.d.ts +10 -0
- package/dist/express/install.js +21 -0
- package/dist/express/install.js.map +1 -0
- package/dist/express/middleware.cjs +87 -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 +91 -327
- 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 +429 -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 +401 -0
- package/dist/express/routes.js.map +1 -0
- package/dist/fastify/index.cjs +10 -5
- package/dist/fastify/index.cjs.map +1 -1
- package/dist/fastify/index.d.cts +7 -11
- package/dist/fastify/index.d.ts +7 -11
- package/dist/fastify/index.js +9 -3
- package/dist/fastify/index.js.map +1 -1
- package/dist/{loggers/index.cjs → fastify/install.cjs} +17 -19
- package/dist/fastify/install.cjs.map +1 -0
- package/dist/fastify/install.d.cts +10 -0
- package/dist/fastify/install.d.ts +10 -0
- package/dist/fastify/install.js +15 -0
- package/dist/fastify/install.js.map +1 -0
- package/dist/fastify/middleware.cjs +135 -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 +114 -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 +8 -10
- package/dist/h3/index.d.ts +8 -10
- package/dist/h3/index.js +26 -2
- package/dist/h3/index.js.map +1 -1
- package/dist/h3/middleware.cjs +210 -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 +194 -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 -4
- package/dist/hapi/index.cjs.map +1 -1
- package/dist/hapi/index.d.cts +8 -10
- package/dist/hapi/index.d.ts +8 -10
- package/dist/hapi/index.js +13 -2
- 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 +8 -0
- package/dist/hapi/install.d.ts +8 -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/{common/logging.cjs → hapi/routes.cjs} +14 -17
- 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 +7 -10
- package/dist/hono/index.d.ts +7 -10
- package/dist/hono/index.js +13 -2
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/middleware.cjs +219 -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 +229 -126
- 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 +29 -1
- package/dist/index.d.ts +29 -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 +7 -10
- package/dist/koa/index.d.ts +7 -10
- package/dist/koa/index.js +13 -2
- package/dist/koa/index.js.map +1 -1
- package/dist/koa/middleware.cjs +85 -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 +88 -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 +417 -0
- package/dist/logCapture.cjs.map +1 -0
- package/dist/logCapture.d.cts +18 -0
- package/dist/logCapture.d.ts +18 -0
- package/dist/logCapture.js +390 -0
- package/dist/logCapture.js.map +1 -0
- package/dist/logRecordExporter.cjs +51 -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 +27 -0
- package/dist/logRecordExporter.js.map +1 -0
- package/dist/logRecordProcessor.cjs +137 -0
- package/dist/logRecordProcessor.cjs.map +1 -0
- package/dist/logRecordProcessor.d.cts +27 -0
- package/dist/logRecordProcessor.d.ts +27 -0
- package/dist/logRecordProcessor.js +113 -0
- package/dist/logRecordProcessor.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 +26 -0
- package/dist/metrics.d.ts +26 -0
- package/dist/metrics.js +153 -0
- package/dist/metrics.js.map +1 -0
- package/dist/nestjs/index.cjs +81 -71
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.d.cts +4 -11
- package/dist/nestjs/index.d.ts +4 -11
- package/dist/nestjs/index.js +81 -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 +10 -0
- package/dist/requestAttributes.d.ts +10 -0
- package/dist/requestAttributes.js +22 -0
- package/dist/requestAttributes.js.map +1 -0
- package/dist/requestObservation.cjs +246 -0
- package/dist/requestObservation.cjs.map +1 -0
- package/dist/requestObservation.d.cts +62 -0
- package/dist/requestObservation.d.ts +62 -0
- package/dist/requestObservation.js +226 -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 +31 -0
- package/dist/requestObservationNode.d.ts +31 -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 +34 -0
- package/dist/requestObservationWeb.d.ts +34 -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/serverErrors.cjs +118 -0
- package/dist/serverErrors.cjs.map +1 -0
- package/dist/serverErrors.d.cts +8 -0
- package/dist/serverErrors.d.ts +8 -0
- package/dist/serverErrors.js +91 -0
- package/dist/serverErrors.js.map +1 -0
- package/dist/spanExporter.cjs +217 -0
- package/dist/spanExporter.cjs.map +1 -0
- package/dist/spanExporter.d.cts +34 -0
- package/dist/spanExporter.d.ts +34 -0
- package/dist/spanExporter.js +193 -0
- package/dist/spanExporter.js.map +1 -0
- package/dist/spanProcessor.cjs +535 -0
- package/dist/spanProcessor.cjs.map +1 -0
- package/dist/spanProcessor.d.cts +70 -0
- package/dist/spanProcessor.d.ts +70 -0
- package/dist/spanProcessor.js +513 -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 +98 -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 +73 -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/dist/validationErrors.cjs +229 -0
- package/dist/validationErrors.cjs.map +1 -0
- package/dist/validationErrors.d.cts +21 -0
- package/dist/validationErrors.d.ts +21 -0
- package/dist/validationErrors.js +195 -0
- package/dist/validationErrors.js.map +1 -0
- package/package.json +113 -154
- 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 -86
- 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 -62
- 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 -114
- 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 -91
- package/dist/common/requestCounter.js.map +0 -1
- package/dist/common/requestLogger.cjs +0 -543
- package/dist/common/requestLogger.cjs.map +0 -1
- package/dist/common/requestLogger.d.cts +0 -85
- package/dist/common/requestLogger.d.ts +0 -85
- package/dist/common/requestLogger.js +0 -508
- 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 -123
- 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 -98
- package/dist/common/serverErrorCounter.js.map +0 -1
- package/dist/common/spanCollector.cjs +0 -201
- 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 -177
- package/dist/common/spanCollector.js.map +0 -1
- package/dist/common/tempGzipFile.cjs +0 -127
- 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 -103
- 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 -79
- 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 -56
- package/dist/common/validationErrorCounter.js.map +0 -1
- package/dist/elysia/plugin.cjs +0 -242
- 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 -219
- 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 -319
- 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 -284
- 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 -212
- 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 -188
- 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,7 +19,7 @@
|
|
|
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)
|
|
@@ -28,304 +28,354 @@
|
|
|
28
28
|
Apitally is a simple API monitoring and analytics tool that makes it easy to understand API usage, monitor performance, and troubleshoot issues.
|
|
29
29
|
Get started in minutes by just adding a few lines of code. No infrastructure changes required, no dashboards to build.
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
The SDK is an [OpenTelemetry](https://opentelemetry.io) distribution and works alongside an existing OpenTelemetry setup.
|
|
32
|
+
|
|
33
|
+
Learn more about Apitally on our 🌎 [website](https://apitally.io) or check out the 📚 [documentation](https://docs.apitally.io).
|
|
34
|
+
|
|
35
|
+
> [!IMPORTANT]
|
|
36
|
+
> **Upgrading from 0.x?** Version 1.0 is a full rewrite with a new setup API. See the [migration guide](MIGRATION.md) for a full 0.x to 1.x mapping.
|
|
33
37
|
|
|
34
38
|
## Key features
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
- **API analytics**: Traffic, error and performance metrics for your API, each endpoint, and per API consumer. Drill down from metrics to individual API requests.
|
|
41
|
+
- **Request logs and traces**: Every request as a searchable log entry, with optional capture of headers and request/response bodies. Requests are exported as OpenTelemetry spans, including spans from any other instrumentations you have.
|
|
42
|
+
- **Application logs**: Logs written via `console` and other supported loggers are captured automatically and correlated with the requests they belong to.
|
|
43
|
+
- **Error tracking**: Validation errors and exceptions with stack traces for server errors, automatically linked to Sentry events if you use Sentry.
|
|
44
|
+
- **Server metrics**: CPU and memory usage of your app's processes.
|
|
45
|
+
- **API monitoring & alerts**: Get notified if something isn't right using custom alerts, synthetic uptime checks and heartbeat monitoring. Alert notifications can be delivered via email, Slack and Microsoft Teams.
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
individual API consumers, allowing you to make informed, data-driven engineering
|
|
40
|
-
and product decisions.
|
|
47
|
+
## Supported frameworks
|
|
41
48
|
|
|
42
|
-
|
|
49
|
+
The SDK supports **Node.js** `>= 20.6` and **Bun** `>= 1.1.13`.
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
| Framework | Supported versions | Setup guide |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| [**AdonisJS**](https://github.com/adonisjs/core) | `>= 6.3`, `< 8` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/adonisjs) |
|
|
54
|
+
| [**Elysia**](https://github.com/elysiajs/elysia) | `>= 1.1`, `< 2` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/elysia) |
|
|
55
|
+
| [**Express**](https://github.com/expressjs/express) | `>= 4.18.2`, `< 6` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/express) |
|
|
56
|
+
| [**Fastify**](https://github.com/fastify/fastify) | `>= 4.10.2`, `< 6` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/fastify) |
|
|
57
|
+
| [**H3**](https://github.com/h3js/h3) | `>= 2.0.1-rc.26`, `< 3` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/h3) |
|
|
58
|
+
| [**Hapi**](https://github.com/hapijs/hapi) | `21.x` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/hapi) |
|
|
59
|
+
| [**Hono**](https://github.com/honojs/hono) \* | `>= 4.8.4`, `< 5` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/hono) |
|
|
60
|
+
| [**Koa**](https://github.com/koajs/koa) | `2.x`, `3.x` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/koa) |
|
|
61
|
+
| [**NestJS**](https://github.com/nestjs/nest) | `10.x`, `11.x`, `12.x` | [Link](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/nestjs) |
|
|
47
62
|
|
|
48
|
-
|
|
63
|
+
\* For Hono on Cloudflare Workers use our [Serverless SDK](https://github.com/apitally/apitally-js-serverless) instead.
|
|
49
64
|
|
|
50
|
-
|
|
51
|
-
error details and stack traces for 500 error responses, and have them linked to
|
|
52
|
-
Sentry issues automatically.
|
|
65
|
+
Apitally also supports many other web frameworks in [Python](https://github.com/apitally/apitally-py), [Go](https://github.com/apitally/apitally-go), [.NET](https://github.com/apitally/apitally-dotnet) and [Java](https://github.com/apitally/apitally-java) via our other SDKs.
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
## Getting started
|
|
55
68
|
|
|
56
|
-
|
|
57
|
-
uptime checks and heartbeat monitoring. Alert notifications can be delivered via
|
|
58
|
-
email, Slack and Microsoft Teams.
|
|
69
|
+
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. These also include your write token.
|
|
59
70
|
|
|
60
|
-
|
|
71
|
+
To install the SDK as a dependency in your project run:
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
| [**Fastify**](https://github.com/fastify/fastify) | `4.x`, `5.x` | [Link](https://docs.apitally.io/setup-guides/fastify) |
|
|
66
|
-
| [**NestJS**](https://github.com/nestjs/nest) | `9.x`, `10.x`, `11.x` | [Link](https://docs.apitally.io/setup-guides/nestjs) |
|
|
67
|
-
| [**AdonisJS**](https://github.com/adonisjs/core) | `6.x` | [Link](https://docs.apitally.io/setup-guides/adonisjs) |
|
|
68
|
-
| [**Hono**](https://github.com/honojs/hono) \* | `4.x` | [Link](https://docs.apitally.io/setup-guides/hono) |
|
|
69
|
-
| [**H3**](https://github.com/h3js/h3) | `2.x` | [Link](https://docs.apitally.io/setup-guides/h3) |
|
|
70
|
-
| [**Elysia**](https://github.com/elysiajs/elysia) | `1.x` | [Link](https://docs.apitally.io/setup-guides/elysia) |
|
|
71
|
-
| [**Koa**](https://github.com/koajs/koa) | `2.x`, `3.x` | [Link](https://docs.apitally.io/setup-guides/koa) |
|
|
72
|
-
| [**Hapi**](https://github.com/hapijs/hapi) | `21.x` | [Link](https://docs.apitally.io/setup-guides/hapi) |
|
|
73
|
+
```bash
|
|
74
|
+
npm install apitally
|
|
75
|
+
```
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
See the [SDK reference](https://docs.apitally.io/sdk-reference/javascript/v1/configuration) for all available configuration options, including how to mask sensitive data, capture request and response payloads, and more.
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
### AdonisJS
|
|
77
80
|
|
|
78
|
-
|
|
81
|
+
Run the Ace add command from your application directory:
|
|
79
82
|
|
|
80
|
-
|
|
83
|
+
```bash
|
|
84
|
+
node ace add apitally
|
|
85
|
+
```
|
|
81
86
|
|
|
82
|
-
|
|
87
|
+
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 capture validation and server errors.
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
If needed, you can change settings in `config/apitally.ts`.
|
|
85
90
|
|
|
86
|
-
|
|
91
|
+
For further instructions, see our [setup guide for AdonisJS](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/adonisjs).
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
### Elysia
|
|
94
|
+
|
|
95
|
+
Register `apitallyPlugin()` immediately after creating the app, before routes or plugins that add routes:
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
import { Elysia } from "elysia";
|
|
99
|
+
import { apitallyPlugin } from "apitally/elysia";
|
|
100
|
+
|
|
101
|
+
const app = new Elysia()
|
|
102
|
+
.use(
|
|
103
|
+
apitallyPlugin({
|
|
104
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
105
|
+
env: "dev", // optional, defaults to "dev"
|
|
106
|
+
}),
|
|
107
|
+
)
|
|
108
|
+
// register plugins and routes below this point
|
|
109
|
+
.get("/items/:id", ({ params }) => ({ id: params.id }));
|
|
90
110
|
```
|
|
91
111
|
|
|
92
|
-
|
|
112
|
+
For further instructions, see our [setup guide for Elysia](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/elysia).
|
|
113
|
+
|
|
114
|
+
### Express
|
|
115
|
+
|
|
116
|
+
Import `apitally/express/register` on the first line of your entry module, then call `useApitally(app)` anywhere after creating the app:
|
|
93
117
|
|
|
94
118
|
```javascript
|
|
95
|
-
|
|
96
|
-
|
|
119
|
+
import "apitally/express/register"; // must be the first import
|
|
120
|
+
|
|
121
|
+
import express from "express";
|
|
122
|
+
import { useApitally } from "apitally";
|
|
97
123
|
|
|
98
124
|
const app = express();
|
|
99
|
-
app.use(express.json());
|
|
100
125
|
|
|
101
126
|
useApitally(app, {
|
|
102
|
-
|
|
127
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
103
128
|
env: "dev", // or "prod" etc.
|
|
104
129
|
});
|
|
105
130
|
```
|
|
106
131
|
|
|
107
|
-
For further instructions, see our
|
|
108
|
-
[setup guide for Express](https://docs.apitally.io/setup-guides/express).
|
|
132
|
+
For further instructions, see our [setup guide for Express](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/express).
|
|
109
133
|
|
|
110
134
|
### Fastify
|
|
111
135
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
npm install apitally fastify-plugin
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Then register the Apitally plugin with your application:
|
|
136
|
+
Call `useApitally(app)` immediately after creating the app, before registering plugins and routes:
|
|
119
137
|
|
|
120
138
|
```javascript
|
|
121
139
|
import Fastify from "fastify";
|
|
122
|
-
import {
|
|
140
|
+
import { useApitally } from "apitally";
|
|
123
141
|
|
|
124
|
-
const
|
|
142
|
+
const app = Fastify();
|
|
125
143
|
|
|
126
|
-
|
|
127
|
-
|
|
144
|
+
useApitally(app, {
|
|
145
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
128
146
|
env: "dev", // or "prod" etc.
|
|
129
147
|
});
|
|
130
|
-
```
|
|
131
148
|
|
|
132
|
-
|
|
149
|
+
// register plugins and routes below this point
|
|
150
|
+
```
|
|
133
151
|
|
|
134
|
-
For further instructions, see our
|
|
135
|
-
[setup guide for Fastify](https://docs.apitally.io/setup-guides/fastify).
|
|
152
|
+
For further instructions, see our [setup guide for Fastify](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/fastify).
|
|
136
153
|
|
|
137
154
|
### NestJS
|
|
138
155
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
npm install apitally
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Then add the Apitally middleware to your application:
|
|
156
|
+
Call `useApitally(app)` immediately after creating the Nest application, before `app.init()` or `app.listen()`:
|
|
146
157
|
|
|
147
158
|
```javascript
|
|
148
159
|
import { NestFactory } from "@nestjs/core";
|
|
149
160
|
import { useApitally } from "apitally/nestjs";
|
|
150
|
-
import { AppModule } from "./app.module";
|
|
161
|
+
import { AppModule } from "./app.module.js";
|
|
151
162
|
|
|
152
|
-
|
|
153
|
-
const app = await NestFactory.create(AppModule);
|
|
163
|
+
const app = await NestFactory.create(AppModule);
|
|
154
164
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
// ...
|
|
161
|
-
}
|
|
165
|
+
useApitally(app, {
|
|
166
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
167
|
+
env: "dev", // or "prod" etc.
|
|
168
|
+
});
|
|
162
169
|
|
|
163
|
-
|
|
170
|
+
await app.listen(3000);
|
|
164
171
|
```
|
|
165
172
|
|
|
166
|
-
For further instructions, see our
|
|
167
|
-
[setup guide for NestJS](https://docs.apitally.io/setup-guides/nestjs).
|
|
173
|
+
For further instructions, see our [setup guide for NestJS](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/nestjs).
|
|
168
174
|
|
|
169
|
-
###
|
|
175
|
+
### H3
|
|
170
176
|
|
|
171
|
-
|
|
177
|
+
Add `apitallyPlugin()` when constructing the root H3 app:
|
|
172
178
|
|
|
173
|
-
```
|
|
174
|
-
|
|
179
|
+
```javascript
|
|
180
|
+
import { H3 } from "h3";
|
|
181
|
+
import { apitallyPlugin } from "apitally/h3";
|
|
182
|
+
|
|
183
|
+
const app = new H3({
|
|
184
|
+
plugins: [
|
|
185
|
+
apitallyPlugin({
|
|
186
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
187
|
+
env: "dev", // or "prod" etc.
|
|
188
|
+
}),
|
|
189
|
+
],
|
|
190
|
+
});
|
|
175
191
|
```
|
|
176
192
|
|
|
177
|
-
|
|
193
|
+
For further instructions, see our [setup guide for H3](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/h3).
|
|
178
194
|
|
|
179
|
-
|
|
180
|
-
node ace configure apitally/adonisjs
|
|
181
|
-
```
|
|
195
|
+
### Hapi
|
|
182
196
|
|
|
183
|
-
|
|
184
|
-
[setup guide for AdonisJS](https://docs.apitally.io/setup-guides/adonisjs).
|
|
197
|
+
Register `apitallyPlugin()` before calling `server.initialize()` or `server.start()`:
|
|
185
198
|
|
|
186
|
-
|
|
199
|
+
```javascript
|
|
200
|
+
import Hapi from "@hapi/hapi";
|
|
201
|
+
import { apitallyPlugin } from "apitally/hapi";
|
|
187
202
|
|
|
188
|
-
|
|
203
|
+
const server = Hapi.server({ port: 3000 });
|
|
189
204
|
|
|
190
|
-
|
|
191
|
-
|
|
205
|
+
await server.register(
|
|
206
|
+
apitallyPlugin({
|
|
207
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
208
|
+
env: "dev", // or "prod" etc.
|
|
209
|
+
}),
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
// register application plugins and routes below this point
|
|
213
|
+
await server.start();
|
|
192
214
|
```
|
|
193
215
|
|
|
194
|
-
|
|
216
|
+
For further instructions, see our [setup guide for Hapi](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/hapi).
|
|
217
|
+
|
|
218
|
+
### Hono
|
|
219
|
+
|
|
220
|
+
Call `useApitally(app)` immediately after creating the app, before registering middleware and routes:
|
|
195
221
|
|
|
196
222
|
```javascript
|
|
197
223
|
import { Hono } from "hono";
|
|
198
|
-
import { useApitally } from "apitally
|
|
224
|
+
import { useApitally } from "apitally";
|
|
199
225
|
|
|
200
226
|
const app = new Hono();
|
|
201
227
|
|
|
202
228
|
useApitally(app, {
|
|
203
|
-
|
|
229
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
204
230
|
env: "dev", // or "prod" etc.
|
|
205
231
|
});
|
|
232
|
+
|
|
233
|
+
// register middleware and routes below this point
|
|
206
234
|
```
|
|
207
235
|
|
|
208
|
-
For further instructions, see our
|
|
209
|
-
[setup guide for Hono](https://docs.apitally.io/setup-guides/hono).
|
|
236
|
+
For further instructions, see our [setup guide for Hono](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/hono).
|
|
210
237
|
|
|
211
|
-
###
|
|
238
|
+
### Koa
|
|
212
239
|
|
|
213
|
-
|
|
240
|
+
Call `useApitally(app)` immediately after creating the app, before registering middleware and routes:
|
|
214
241
|
|
|
215
|
-
```
|
|
216
|
-
|
|
242
|
+
```javascript
|
|
243
|
+
const Koa = require("koa");
|
|
244
|
+
const { useApitally } = require("apitally");
|
|
245
|
+
|
|
246
|
+
const app = new Koa();
|
|
247
|
+
|
|
248
|
+
useApitally(app, {
|
|
249
|
+
writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
|
|
250
|
+
env: "dev", // or "prod" etc.
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// register middleware and routes below this point
|
|
217
254
|
```
|
|
218
255
|
|
|
219
|
-
|
|
256
|
+
For further instructions, see our [setup guide for Koa](https://docs.apitally.io/sdk-reference/javascript/v1/setup-guides/koa).
|
|
220
257
|
|
|
221
|
-
|
|
222
|
-
import { H3 } from "h3";
|
|
223
|
-
import { apitallyPlugin } from "apitally/h3";
|
|
258
|
+
## Configuration
|
|
224
259
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
260
|
+
The write token and environment can also be provided via the `APITALLY_WRITE_TOKEN` and `APITALLY_ENV` environment variables instead of the `writeToken` and `env` options. The environment defaults to `dev`.
|
|
261
|
+
|
|
262
|
+
By default, Apitally captures response headers but not request headers or request and response bodies. You can opt in with options:
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
useApitally(app, {
|
|
266
|
+
writeToken: "your-write-token",
|
|
267
|
+
env: "dev",
|
|
268
|
+
captureRequestHeaders: true,
|
|
269
|
+
captureRequestBody: true,
|
|
270
|
+
captureResponseBody: true,
|
|
232
271
|
});
|
|
233
272
|
```
|
|
234
273
|
|
|
235
|
-
|
|
236
|
-
[setup guide for H3](https://docs.apitally.io/setup-guides/h3).
|
|
274
|
+
Sensitive values in query parameters, headers, and body fields are masked automatically based on built-in patterns, and you can add your own via the `maskQueryParams`, `maskHeaders`, and `maskBodyFields` options.
|
|
237
275
|
|
|
238
|
-
|
|
276
|
+
On high-traffic applications you can capture logs and traces for only a fraction of requests by setting `sampleRate` (e.g. `0.1` for 10%), or decide per request with the `sampleOnRequest` and `sampleOnResponse` callbacks. Metrics always count every request, regardless of sampling.
|
|
239
277
|
|
|
240
|
-
|
|
278
|
+
Application logs written via `console` and other supported loggers are captured and correlated with requests by default. Use `maskLogRecord` to transform or drop Apitally's captured copy, or opt out with `captureLogs: false`.
|
|
241
279
|
|
|
242
|
-
|
|
243
|
-
npm install apitally
|
|
244
|
-
```
|
|
280
|
+
See the [SDK reference](https://docs.apitally.io/sdk-reference/javascript/v1/configuration) for all configuration options.
|
|
245
281
|
|
|
246
|
-
|
|
282
|
+
## Identifying consumers and more
|
|
283
|
+
|
|
284
|
+
The top-level `apitally` package provides functions you can call from anywhere in your request handling code:
|
|
247
285
|
|
|
248
286
|
```javascript
|
|
249
|
-
import {
|
|
250
|
-
import { apitallyPlugin } from "apitally/elysia";
|
|
287
|
+
import { setConsumer, setRequestAttribute, captureException } from "apitally";
|
|
251
288
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
289
|
+
// Associate the current request with an API consumer
|
|
290
|
+
setConsumer({ identifier: user.identifier, name: user.name, group: user.group });
|
|
291
|
+
|
|
292
|
+
// Attach a custom attribute to the current request
|
|
293
|
+
setRequestAttribute("tenant", tenantId);
|
|
294
|
+
|
|
295
|
+
// Capture a handled exception for the current request
|
|
296
|
+
captureException(error);
|
|
260
297
|
```
|
|
261
298
|
|
|
262
|
-
|
|
263
|
-
[setup guide for Elysia](https://docs.apitally.io/setup-guides/elysia).
|
|
299
|
+
`setConsumer()` also accepts an identifier string, for example `setConsumer(user.identifier)`.
|
|
264
300
|
|
|
265
|
-
|
|
301
|
+
For further details, check out our [documentation](https://docs.apitally.io).
|
|
266
302
|
|
|
267
|
-
|
|
303
|
+
## Existing OpenTelemetry setup
|
|
268
304
|
|
|
269
|
-
|
|
270
|
-
npm install apitally
|
|
271
|
-
```
|
|
305
|
+
If your app doesn't already use OpenTelemetry, you don't need to know it's there. The Apitally SDK configures OpenTelemetry automatically.
|
|
272
306
|
|
|
273
|
-
|
|
307
|
+
If your app already registers its own tracer provider (e.g. via `NodeSDK`), Apitally does not replace it. Instead, you need to add the `ApitallySpanProcessor` to your provider's span processors:
|
|
274
308
|
|
|
275
309
|
```javascript
|
|
276
|
-
|
|
277
|
-
|
|
310
|
+
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
311
|
+
import { ApitallySpanProcessor } from "apitally";
|
|
278
312
|
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
clientId: "your-client-id",
|
|
283
|
-
env: "dev", // or "prod" etc.
|
|
313
|
+
const sdk = new NodeSDK({
|
|
314
|
+
spanProcessors: [new ApitallySpanProcessor()],
|
|
315
|
+
// ...your existing configuration
|
|
284
316
|
});
|
|
285
317
|
```
|
|
286
318
|
|
|
287
|
-
|
|
288
|
-
[setup guide for Koa](https://docs.apitally.io/setup-guides/koa).
|
|
319
|
+
Your tracer provider's sampling settings also affect Apitally. Requests excluded by the sampler will not have request logs or traces in Apitally. Metrics still include all requests, regardless of sampling.
|
|
289
320
|
|
|
290
|
-
###
|
|
321
|
+
### Sentry
|
|
291
322
|
|
|
292
|
-
|
|
323
|
+
Sentry's Node.js SDK configures OpenTelemetry automatically. To use Apitally alongside Sentry, add `ApitallySpanProcessor` to Sentry's configuration and call `Sentry.init()` before `useApitally()`:
|
|
293
324
|
|
|
294
|
-
```
|
|
295
|
-
|
|
325
|
+
```javascript
|
|
326
|
+
import * as Sentry from "@sentry/node";
|
|
327
|
+
import { ApitallySpanProcessor } from "apitally";
|
|
328
|
+
|
|
329
|
+
Sentry.init({
|
|
330
|
+
dsn: "your-sentry-dsn",
|
|
331
|
+
// Enable tracing
|
|
332
|
+
tracesSampleRate: 1.0,
|
|
333
|
+
// Add Apitally's span processor
|
|
334
|
+
openTelemetrySpanProcessors: [new ApitallySpanProcessor()],
|
|
335
|
+
// Optional: send only errors to Sentry
|
|
336
|
+
beforeSendTransaction: () => null,
|
|
337
|
+
});
|
|
296
338
|
```
|
|
297
339
|
|
|
298
|
-
|
|
340
|
+
Apitally uses the spans recorded by Sentry, so tracing must be enabled in Sentry. Requests excluded by Sentry's sampler will also be missing from Apitally's request logs and traces.
|
|
341
|
+
|
|
342
|
+
Returning `null` from `beforeSendTransaction` prevents traces from being sent to Sentry without affecting Apitally's request logs and traces.
|
|
343
|
+
|
|
344
|
+
### Elysia's OpenTelemetry plugin
|
|
345
|
+
|
|
346
|
+
When using Elysia's `@elysia/opentelemetry` plugin, register Apitally first so it adopts the OpenTelemetry SERVER span:
|
|
299
347
|
|
|
300
348
|
```javascript
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const init = async () => {
|
|
305
|
-
const server = Hapi.server({
|
|
306
|
-
port: 3000,
|
|
307
|
-
host: "localhost",
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
await server.register({
|
|
311
|
-
plugin: apitallyPlugin({
|
|
312
|
-
clientId: "your-client-id",
|
|
313
|
-
env: "dev", // or "prod" etc.
|
|
314
|
-
}),
|
|
315
|
-
});
|
|
316
|
-
};
|
|
349
|
+
import { opentelemetry } from "@elysia/opentelemetry";
|
|
350
|
+
import { Elysia } from "elysia";
|
|
351
|
+
import { apitallyPlugin } from "apitally/elysia";
|
|
317
352
|
|
|
318
|
-
|
|
353
|
+
const app = new Elysia()
|
|
354
|
+
.use(apitallyPlugin(options))
|
|
355
|
+
.use(opentelemetry());
|
|
319
356
|
```
|
|
320
357
|
|
|
321
|
-
|
|
322
|
-
|
|
358
|
+
## Trusted proxies
|
|
359
|
+
|
|
360
|
+
If your application runs behind a reverse proxy or load balancer, configure trusted proxies in your framework so Apitally can record the real client IP for GeoIP. Apitally uses the client IP reported by your framework. It does not read forwarding headers itself to determine the client IP.
|
|
361
|
+
|
|
362
|
+
## Graceful shutdown
|
|
363
|
+
|
|
364
|
+
Apitally sends telemetry in batches and automatically attempts a final export during normal process shutdown.
|
|
365
|
+
|
|
366
|
+
If your code calls `process.exit()`, await `shutdown()` first to give Apitally time to send buffered telemetry. Close your server and let any remaining requests finish before doing this:
|
|
367
|
+
|
|
368
|
+
```javascript
|
|
369
|
+
import { shutdown } from "apitally";
|
|
370
|
+
|
|
371
|
+
// After the server has closed and requests have finished:
|
|
372
|
+
await shutdown();
|
|
373
|
+
process.exit(0);
|
|
374
|
+
```
|
|
323
375
|
|
|
324
376
|
## Getting help
|
|
325
377
|
|
|
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.
|
|
378
|
+
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
379
|
|
|
330
380
|
## License
|
|
331
381
|
|