apitally 0.25.7 → 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.
Files changed (549) hide show
  1. package/README.md +191 -184
  2. package/dist/activation.cjs +371 -0
  3. package/dist/activation.cjs.map +1 -0
  4. package/dist/activation.d.cts +41 -0
  5. package/dist/activation.d.ts +41 -0
  6. package/dist/activation.js +357 -0
  7. package/dist/activation.js.map +1 -0
  8. package/dist/adonisjs/configure.cjs +88 -31
  9. package/dist/adonisjs/configure.cjs.map +1 -1
  10. package/dist/adonisjs/configure.d.cts +0 -4
  11. package/dist/adonisjs/configure.d.ts +0 -4
  12. package/dist/adonisjs/configure.js +85 -30
  13. package/dist/adonisjs/configure.js.map +1 -1
  14. package/dist/adonisjs/index.cjs +4 -23
  15. package/dist/adonisjs/index.cjs.map +1 -1
  16. package/dist/adonisjs/index.d.cts +3 -15
  17. package/dist/adonisjs/index.d.ts +3 -15
  18. package/dist/adonisjs/index.js +3 -20
  19. package/dist/adonisjs/index.js.map +1 -1
  20. package/dist/adonisjs/middleware.cjs +43 -109
  21. package/dist/adonisjs/middleware.cjs.map +1 -1
  22. package/dist/adonisjs/middleware.d.cts +1 -16
  23. package/dist/adonisjs/middleware.d.ts +1 -16
  24. package/dist/adonisjs/middleware.js +43 -110
  25. package/dist/adonisjs/middleware.js.map +1 -1
  26. package/dist/adonisjs/provider.cjs +19 -87
  27. package/dist/adonisjs/provider.cjs.map +1 -1
  28. package/dist/adonisjs/provider.d.cts +0 -22
  29. package/dist/adonisjs/provider.d.ts +0 -22
  30. package/dist/adonisjs/provider.js +19 -88
  31. package/dist/adonisjs/provider.js.map +1 -1
  32. package/dist/adonisjs/stubs/config/apitally.stub +11 -15
  33. package/dist/bodyCapture.cjs +128 -0
  34. package/dist/bodyCapture.cjs.map +1 -0
  35. package/dist/bodyCapture.d.cts +31 -0
  36. package/dist/bodyCapture.d.ts +31 -0
  37. package/dist/bodyCapture.js +101 -0
  38. package/dist/bodyCapture.js.map +1 -0
  39. package/dist/config.cjs +209 -0
  40. package/dist/config.cjs.map +1 -0
  41. package/dist/config.d.cts +42 -0
  42. package/dist/config.d.ts +42 -0
  43. package/dist/config.js +174 -0
  44. package/dist/config.js.map +1 -0
  45. package/dist/consumer.cjs +98 -0
  46. package/dist/consumer.cjs.map +1 -0
  47. package/dist/consumer.d.cts +13 -0
  48. package/dist/consumer.d.ts +13 -0
  49. package/dist/consumer.js +78 -0
  50. package/dist/consumer.js.map +1 -0
  51. package/dist/context.cjs +68 -0
  52. package/dist/context.cjs.map +1 -0
  53. package/dist/context.d.cts +29 -0
  54. package/dist/context.d.ts +29 -0
  55. package/dist/context.js +40 -0
  56. package/dist/context.js.map +1 -0
  57. package/dist/elysia/index.cjs +12 -13
  58. package/dist/elysia/index.cjs.map +1 -1
  59. package/dist/elysia/index.d.cts +7 -16
  60. package/dist/elysia/index.d.ts +7 -16
  61. package/dist/elysia/index.js +10 -2
  62. package/dist/elysia/index.js.map +1 -1
  63. package/dist/elysia/middleware.cjs +248 -0
  64. package/dist/elysia/middleware.cjs.map +1 -0
  65. package/dist/elysia/middleware.d.cts +13 -0
  66. package/dist/elysia/middleware.d.ts +13 -0
  67. package/dist/elysia/middleware.js +237 -0
  68. package/dist/elysia/middleware.js.map +1 -0
  69. package/dist/{loggers/index.cjs → elysia/routes.cjs} +16 -19
  70. package/dist/elysia/routes.cjs.map +1 -0
  71. package/dist/elysia/routes.d.cts +7 -0
  72. package/dist/elysia/routes.d.ts +7 -0
  73. package/dist/elysia/routes.js +14 -0
  74. package/dist/elysia/routes.js.map +1 -0
  75. package/dist/exceptions.cjs +75 -0
  76. package/dist/exceptions.cjs.map +1 -0
  77. package/dist/exceptions.d.cts +7 -0
  78. package/dist/exceptions.d.ts +7 -0
  79. package/dist/exceptions.js +49 -0
  80. package/dist/exceptions.js.map +1 -0
  81. package/dist/exportSerialization.cjs +56 -0
  82. package/dist/exportSerialization.cjs.map +1 -0
  83. package/dist/exportSerialization.d.cts +7 -0
  84. package/dist/exportSerialization.d.ts +7 -0
  85. package/dist/exportSerialization.js +32 -0
  86. package/dist/exportSerialization.js.map +1 -0
  87. package/dist/exportWorker.cjs +305 -0
  88. package/dist/exportWorker.cjs.map +1 -0
  89. package/dist/exportWorker.d.cts +46 -0
  90. package/dist/exportWorker.d.ts +46 -0
  91. package/dist/exportWorker.js +279 -0
  92. package/dist/exportWorker.js.map +1 -0
  93. package/dist/express/index.cjs +9 -4
  94. package/dist/express/index.cjs.map +1 -1
  95. package/dist/express/index.d.cts +6 -10
  96. package/dist/express/index.d.ts +6 -10
  97. package/dist/express/index.js +8 -2
  98. package/dist/express/index.js.map +1 -1
  99. package/dist/express/install.cjs +45 -0
  100. package/dist/express/install.cjs.map +1 -0
  101. package/dist/express/install.d.cts +9 -0
  102. package/dist/express/install.d.ts +9 -0
  103. package/dist/express/install.js +21 -0
  104. package/dist/express/install.js.map +1 -0
  105. package/dist/express/middleware.cjs +80 -331
  106. package/dist/express/middleware.cjs.map +1 -1
  107. package/dist/express/middleware.d.cts +3 -21
  108. package/dist/express/middleware.d.ts +3 -21
  109. package/dist/express/middleware.js +81 -328
  110. package/dist/express/middleware.js.map +1 -1
  111. package/dist/express/register.cjs +20 -0
  112. package/dist/express/register.cjs.map +1 -0
  113. package/dist/express/register.d.cts +2 -0
  114. package/dist/express/register.d.ts +2 -0
  115. package/dist/express/register.js +19 -0
  116. package/dist/express/register.js.map +1 -0
  117. package/dist/express/routes.cjs +419 -0
  118. package/dist/express/routes.cjs.map +1 -0
  119. package/dist/express/routes.d.cts +14 -0
  120. package/dist/express/routes.d.ts +14 -0
  121. package/dist/express/routes.js +391 -0
  122. package/dist/express/routes.js.map +1 -0
  123. package/dist/fastify/index.cjs +10 -15
  124. package/dist/fastify/index.cjs.map +1 -1
  125. package/dist/fastify/index.d.cts +6 -11
  126. package/dist/fastify/index.d.ts +6 -11
  127. package/dist/fastify/index.js +9 -3
  128. package/dist/fastify/index.js.map +1 -1
  129. package/dist/{common/logging.cjs → fastify/install.cjs} +15 -16
  130. package/dist/fastify/install.cjs.map +1 -0
  131. package/dist/fastify/install.d.cts +9 -0
  132. package/dist/fastify/install.d.ts +9 -0
  133. package/dist/fastify/install.js +15 -0
  134. package/dist/fastify/install.js.map +1 -0
  135. package/dist/fastify/middleware.cjs +118 -0
  136. package/dist/fastify/middleware.cjs.map +1 -0
  137. package/dist/fastify/middleware.d.cts +7 -0
  138. package/dist/fastify/middleware.d.ts +7 -0
  139. package/dist/fastify/middleware.js +97 -0
  140. package/dist/fastify/middleware.js.map +1 -0
  141. package/dist/{common/paramValidation.cjs → fastify/routes.cjs} +15 -17
  142. package/dist/fastify/routes.cjs.map +1 -0
  143. package/dist/fastify/routes.d.cts +8 -0
  144. package/dist/fastify/routes.d.ts +8 -0
  145. package/dist/fastify/routes.js +14 -0
  146. package/dist/fastify/routes.js.map +1 -0
  147. package/dist/h3/index.cjs +28 -4
  148. package/dist/h3/index.cjs.map +1 -1
  149. package/dist/h3/index.d.cts +7 -10
  150. package/dist/h3/index.d.ts +7 -10
  151. package/dist/h3/index.js +26 -2
  152. package/dist/h3/index.js.map +1 -1
  153. package/dist/h3/middleware.cjs +204 -0
  154. package/dist/h3/middleware.cjs.map +1 -0
  155. package/dist/h3/middleware.d.cts +5 -0
  156. package/dist/h3/middleware.d.ts +5 -0
  157. package/dist/h3/middleware.js +188 -0
  158. package/dist/h3/middleware.js.map +1 -0
  159. package/dist/h3/routes.cjs +66 -0
  160. package/dist/h3/routes.cjs.map +1 -0
  161. package/dist/h3/routes.d.cts +8 -0
  162. package/dist/h3/routes.d.ts +8 -0
  163. package/dist/h3/routes.js +41 -0
  164. package/dist/h3/routes.js.map +1 -0
  165. package/dist/hapi/index.cjs +15 -14
  166. package/dist/hapi/index.cjs.map +1 -1
  167. package/dist/hapi/index.d.cts +7 -10
  168. package/dist/hapi/index.d.ts +7 -10
  169. package/dist/hapi/index.js +14 -3
  170. package/dist/hapi/index.js.map +1 -1
  171. package/dist/{loggers/hapi.cjs → hapi/install.cjs} +20 -26
  172. package/dist/hapi/install.cjs.map +1 -0
  173. package/dist/hapi/install.d.cts +7 -0
  174. package/dist/hapi/install.d.ts +7 -0
  175. package/dist/hapi/install.js +22 -0
  176. package/dist/hapi/install.js.map +1 -0
  177. package/dist/hapi/middleware.cjs +158 -0
  178. package/dist/hapi/middleware.cjs.map +1 -0
  179. package/dist/hapi/middleware.d.cts +5 -0
  180. package/dist/hapi/middleware.d.ts +5 -0
  181. package/dist/hapi/middleware.js +137 -0
  182. package/dist/hapi/middleware.js.map +1 -0
  183. package/dist/hapi/routes.cjs +37 -0
  184. package/dist/hapi/routes.cjs.map +1 -0
  185. package/dist/hapi/routes.d.cts +8 -0
  186. package/dist/hapi/routes.d.ts +8 -0
  187. package/dist/hapi/routes.js +12 -0
  188. package/dist/hapi/routes.js.map +1 -0
  189. package/dist/hono/index.cjs +13 -3
  190. package/dist/hono/index.cjs.map +1 -1
  191. package/dist/hono/index.d.cts +6 -10
  192. package/dist/hono/index.d.ts +6 -10
  193. package/dist/hono/index.js +13 -2
  194. package/dist/hono/index.js.map +1 -1
  195. package/dist/hono/middleware.cjs +211 -127
  196. package/dist/hono/middleware.cjs.map +1 -1
  197. package/dist/hono/middleware.d.cts +3 -18
  198. package/dist/hono/middleware.d.ts +3 -18
  199. package/dist/hono/middleware.js +216 -125
  200. package/dist/hono/middleware.js.map +1 -1
  201. package/dist/hono/routes.cjs +74 -0
  202. package/dist/hono/routes.cjs.map +1 -0
  203. package/dist/hono/routes.d.cts +8 -0
  204. package/dist/hono/routes.d.ts +8 -0
  205. package/dist/hono/routes.js +49 -0
  206. package/dist/hono/routes.js.map +1 -0
  207. package/dist/index.cjs +108 -0
  208. package/dist/index.cjs.map +1 -1
  209. package/dist/index.d.cts +28 -1
  210. package/dist/index.d.ts +28 -1
  211. package/dist/index.js +77 -0
  212. package/dist/index.js.map +1 -1
  213. package/dist/koa/index.cjs +13 -3
  214. package/dist/koa/index.cjs.map +1 -1
  215. package/dist/koa/index.d.cts +6 -10
  216. package/dist/koa/index.d.ts +6 -10
  217. package/dist/koa/index.js +13 -2
  218. package/dist/koa/index.js.map +1 -1
  219. package/dist/koa/middleware.cjs +75 -184
  220. package/dist/koa/middleware.cjs.map +1 -1
  221. package/dist/koa/middleware.d.cts +3 -13
  222. package/dist/koa/middleware.d.ts +3 -13
  223. package/dist/koa/middleware.js +78 -183
  224. package/dist/koa/middleware.js.map +1 -1
  225. package/dist/koa/routes.cjs +71 -0
  226. package/dist/koa/routes.cjs.map +1 -0
  227. package/dist/koa/routes.d.cts +8 -0
  228. package/dist/koa/routes.d.ts +8 -0
  229. package/dist/koa/routes.js +46 -0
  230. package/dist/koa/routes.js.map +1 -0
  231. package/dist/logCapture.cjs +410 -0
  232. package/dist/logCapture.cjs.map +1 -0
  233. package/dist/logCapture.d.cts +16 -0
  234. package/dist/logCapture.d.ts +16 -0
  235. package/dist/logCapture.js +383 -0
  236. package/dist/logCapture.js.map +1 -0
  237. package/dist/logRecordExporter.cjs +83 -0
  238. package/dist/logRecordExporter.cjs.map +1 -0
  239. package/dist/logRecordExporter.d.cts +14 -0
  240. package/dist/logRecordExporter.d.ts +14 -0
  241. package/dist/logRecordExporter.js +59 -0
  242. package/dist/logRecordExporter.js.map +1 -0
  243. package/dist/logRecordProcessor.cjs +120 -0
  244. package/dist/logRecordProcessor.cjs.map +1 -0
  245. package/dist/logRecordProcessor.d.cts +23 -0
  246. package/dist/logRecordProcessor.d.ts +23 -0
  247. package/dist/logRecordProcessor.js +96 -0
  248. package/dist/logRecordProcessor.js.map +1 -0
  249. package/dist/{otel/index.cjs → logRecordTruncation.cjs} +10 -7
  250. package/dist/logRecordTruncation.cjs.map +1 -0
  251. package/dist/logRecordTruncation.d.cts +6 -0
  252. package/dist/logRecordTruncation.d.ts +6 -0
  253. package/dist/logRecordTruncation.js +8 -0
  254. package/dist/logRecordTruncation.js.map +1 -0
  255. package/dist/logger.cjs +62 -0
  256. package/dist/logger.cjs.map +1 -0
  257. package/dist/logger.d.cts +7 -0
  258. package/dist/logger.d.ts +7 -0
  259. package/dist/logger.js +34 -0
  260. package/dist/logger.js.map +1 -0
  261. package/dist/metrics.cjs +171 -0
  262. package/dist/metrics.cjs.map +1 -0
  263. package/dist/metrics.d.cts +24 -0
  264. package/dist/metrics.d.ts +24 -0
  265. package/dist/metrics.js +153 -0
  266. package/dist/metrics.js.map +1 -0
  267. package/dist/nestjs/index.cjs +61 -71
  268. package/dist/nestjs/index.cjs.map +1 -1
  269. package/dist/nestjs/index.d.cts +3 -11
  270. package/dist/nestjs/index.d.ts +3 -11
  271. package/dist/nestjs/index.js +61 -61
  272. package/dist/nestjs/index.js.map +1 -1
  273. package/dist/packageVersion.cjs +67 -0
  274. package/dist/packageVersion.cjs.map +1 -0
  275. package/dist/packageVersion.d.cts +5 -0
  276. package/dist/packageVersion.d.ts +5 -0
  277. package/dist/packageVersion.js +39 -0
  278. package/dist/packageVersion.js.map +1 -0
  279. package/dist/providers.cjs +149 -0
  280. package/dist/providers.cjs.map +1 -0
  281. package/dist/providers.d.cts +15 -0
  282. package/dist/providers.d.ts +15 -0
  283. package/dist/providers.js +136 -0
  284. package/dist/providers.js.map +1 -0
  285. package/dist/redaction.cjs +116 -0
  286. package/dist/redaction.cjs.map +1 -0
  287. package/dist/redaction.d.cts +17 -0
  288. package/dist/redaction.d.ts +17 -0
  289. package/dist/redaction.js +98 -0
  290. package/dist/redaction.js.map +1 -0
  291. package/dist/{common/packageVersions.cjs → requestAttributes.cjs} +21 -19
  292. package/dist/requestAttributes.cjs.map +1 -0
  293. package/dist/requestAttributes.d.cts +8 -0
  294. package/dist/requestAttributes.d.ts +8 -0
  295. package/dist/requestAttributes.js +22 -0
  296. package/dist/requestAttributes.js.map +1 -0
  297. package/dist/requestObservation.cjs +228 -0
  298. package/dist/requestObservation.cjs.map +1 -0
  299. package/dist/requestObservation.d.cts +60 -0
  300. package/dist/requestObservation.d.ts +60 -0
  301. package/dist/requestObservation.js +208 -0
  302. package/dist/requestObservation.js.map +1 -0
  303. package/dist/requestObservationNode.cjs +193 -0
  304. package/dist/requestObservationNode.cjs.map +1 -0
  305. package/dist/requestObservationNode.d.cts +29 -0
  306. package/dist/requestObservationNode.d.ts +29 -0
  307. package/dist/requestObservationNode.js +170 -0
  308. package/dist/requestObservationNode.js.map +1 -0
  309. package/dist/requestObservationWeb.cjs +202 -0
  310. package/dist/requestObservationWeb.cjs.map +1 -0
  311. package/dist/requestObservationWeb.d.cts +32 -0
  312. package/dist/requestObservationWeb.d.ts +32 -0
  313. package/dist/requestObservationWeb.js +182 -0
  314. package/dist/requestObservationWeb.js.map +1 -0
  315. package/dist/sentry.cjs +103 -0
  316. package/dist/sentry.cjs.map +1 -0
  317. package/dist/sentry.d.cts +3 -0
  318. package/dist/sentry.d.ts +3 -0
  319. package/dist/sentry.js +79 -0
  320. package/dist/sentry.js.map +1 -0
  321. package/dist/spanExporter.cjs +218 -0
  322. package/dist/spanExporter.cjs.map +1 -0
  323. package/dist/spanExporter.d.cts +33 -0
  324. package/dist/spanExporter.d.ts +33 -0
  325. package/dist/spanExporter.js +194 -0
  326. package/dist/spanExporter.js.map +1 -0
  327. package/dist/spanProcessor.cjs +523 -0
  328. package/dist/spanProcessor.cjs.map +1 -0
  329. package/dist/spanProcessor.d.cts +67 -0
  330. package/dist/spanProcessor.d.ts +67 -0
  331. package/dist/spanProcessor.js +501 -0
  332. package/dist/spanProcessor.js.map +1 -0
  333. package/dist/spool.cjs +314 -0
  334. package/dist/spool.cjs.map +1 -0
  335. package/dist/spool.d.cts +49 -0
  336. package/dist/spool.d.ts +49 -0
  337. package/dist/spool.js +297 -0
  338. package/dist/spool.js.map +1 -0
  339. package/dist/startup.cjs +93 -0
  340. package/dist/startup.cjs.map +1 -0
  341. package/dist/startup.d.cts +15 -0
  342. package/dist/startup.d.ts +15 -0
  343. package/dist/startup.js +68 -0
  344. package/dist/startup.js.map +1 -0
  345. package/dist/tracing.cjs +116 -0
  346. package/dist/tracing.cjs.map +1 -0
  347. package/dist/tracing.d.cts +5 -0
  348. package/dist/tracing.d.ts +5 -0
  349. package/dist/tracing.js +96 -0
  350. package/dist/tracing.js.map +1 -0
  351. package/package.json +113 -155
  352. package/dist/common/client.cjs +0 -335
  353. package/dist/common/client.cjs.map +0 -1
  354. package/dist/common/client.d.cts +0 -50
  355. package/dist/common/client.d.ts +0 -50
  356. package/dist/common/client.js +0 -302
  357. package/dist/common/client.js.map +0 -1
  358. package/dist/common/consumerRegistry.cjs +0 -84
  359. package/dist/common/consumerRegistry.cjs.map +0 -1
  360. package/dist/common/consumerRegistry.d.cts +0 -20
  361. package/dist/common/consumerRegistry.d.ts +0 -20
  362. package/dist/common/consumerRegistry.js +0 -61
  363. package/dist/common/consumerRegistry.js.map +0 -1
  364. package/dist/common/headers.cjs +0 -55
  365. package/dist/common/headers.cjs.map +0 -1
  366. package/dist/common/headers.d.cts +0 -6
  367. package/dist/common/headers.d.ts +0 -6
  368. package/dist/common/headers.js +0 -31
  369. package/dist/common/headers.js.map +0 -1
  370. package/dist/common/instance.cjs +0 -158
  371. package/dist/common/instance.cjs.map +0 -1
  372. package/dist/common/instance.d.cts +0 -4
  373. package/dist/common/instance.d.ts +0 -4
  374. package/dist/common/instance.js +0 -134
  375. package/dist/common/instance.js.map +0 -1
  376. package/dist/common/logging.cjs.map +0 -1
  377. package/dist/common/logging.d.cts +0 -11
  378. package/dist/common/logging.d.ts +0 -11
  379. package/dist/common/logging.js +0 -17
  380. package/dist/common/logging.js.map +0 -1
  381. package/dist/common/packageVersions.cjs.map +0 -1
  382. package/dist/common/packageVersions.d.cts +0 -3
  383. package/dist/common/packageVersions.d.ts +0 -3
  384. package/dist/common/packageVersions.js +0 -21
  385. package/dist/common/packageVersions.js.map +0 -1
  386. package/dist/common/paramValidation.cjs.map +0 -1
  387. package/dist/common/paramValidation.d.cts +0 -4
  388. package/dist/common/paramValidation.d.ts +0 -4
  389. package/dist/common/paramValidation.js +0 -17
  390. package/dist/common/paramValidation.js.map +0 -1
  391. package/dist/common/requestCounter.cjs +0 -109
  392. package/dist/common/requestCounter.cjs.map +0 -1
  393. package/dist/common/requestCounter.d.cts +0 -24
  394. package/dist/common/requestCounter.d.ts +0 -24
  395. package/dist/common/requestCounter.js +0 -90
  396. package/dist/common/requestCounter.js.map +0 -1
  397. package/dist/common/requestLogger.cjs +0 -541
  398. package/dist/common/requestLogger.cjs.map +0 -1
  399. package/dist/common/requestLogger.d.cts +0 -85
  400. package/dist/common/requestLogger.d.ts +0 -85
  401. package/dist/common/requestLogger.js +0 -507
  402. package/dist/common/requestLogger.js.map +0 -1
  403. package/dist/common/resources.cjs +0 -49
  404. package/dist/common/resources.cjs.map +0 -1
  405. package/dist/common/resources.d.cts +0 -6
  406. package/dist/common/resources.d.ts +0 -6
  407. package/dist/common/resources.js +0 -26
  408. package/dist/common/resources.js.map +0 -1
  409. package/dist/common/response.cjs +0 -104
  410. package/dist/common/response.cjs.map +0 -1
  411. package/dist/common/response.d.cts +0 -15
  412. package/dist/common/response.d.ts +0 -15
  413. package/dist/common/response.js +0 -80
  414. package/dist/common/response.js.map +0 -1
  415. package/dist/common/sentry.cjs +0 -56
  416. package/dist/common/sentry.cjs.map +0 -1
  417. package/dist/common/sentry.d.cts +0 -6
  418. package/dist/common/sentry.d.ts +0 -6
  419. package/dist/common/sentry.js +0 -23
  420. package/dist/common/sentry.js.map +0 -1
  421. package/dist/common/serverErrorCounter.cjs +0 -121
  422. package/dist/common/serverErrorCounter.cjs.map +0 -1
  423. package/dist/common/serverErrorCounter.d.cts +0 -23
  424. package/dist/common/serverErrorCounter.d.ts +0 -23
  425. package/dist/common/serverErrorCounter.js +0 -97
  426. package/dist/common/serverErrorCounter.js.map +0 -1
  427. package/dist/common/spanCollector.cjs +0 -199
  428. package/dist/common/spanCollector.cjs.map +0 -1
  429. package/dist/common/spanCollector.d.cts +0 -45
  430. package/dist/common/spanCollector.d.ts +0 -45
  431. package/dist/common/spanCollector.js +0 -176
  432. package/dist/common/spanCollector.js.map +0 -1
  433. package/dist/common/tempGzipFile.cjs +0 -125
  434. package/dist/common/tempGzipFile.cjs.map +0 -1
  435. package/dist/common/tempGzipFile.d.cts +0 -19
  436. package/dist/common/tempGzipFile.d.ts +0 -19
  437. package/dist/common/tempGzipFile.js +0 -102
  438. package/dist/common/tempGzipFile.js.map +0 -1
  439. package/dist/common/types.cjs +0 -17
  440. package/dist/common/types.cjs.map +0 -1
  441. package/dist/common/types.d.cts +0 -95
  442. package/dist/common/types.d.ts +0 -95
  443. package/dist/common/types.js +0 -1
  444. package/dist/common/types.js.map +0 -1
  445. package/dist/common/validationErrorCounter.cjs +0 -74
  446. package/dist/common/validationErrorCounter.cjs.map +0 -1
  447. package/dist/common/validationErrorCounter.d.cts +0 -20
  448. package/dist/common/validationErrorCounter.d.ts +0 -20
  449. package/dist/common/validationErrorCounter.js +0 -55
  450. package/dist/common/validationErrorCounter.js.map +0 -1
  451. package/dist/elysia/plugin.cjs +0 -237
  452. package/dist/elysia/plugin.cjs.map +0 -1
  453. package/dist/elysia/plugin.d.cts +0 -70
  454. package/dist/elysia/plugin.d.ts +0 -70
  455. package/dist/elysia/plugin.js +0 -218
  456. package/dist/elysia/plugin.js.map +0 -1
  457. package/dist/elysia/utils.cjs +0 -77
  458. package/dist/elysia/utils.cjs.map +0 -1
  459. package/dist/elysia/utils.d.cts +0 -14
  460. package/dist/elysia/utils.d.ts +0 -14
  461. package/dist/elysia/utils.js +0 -54
  462. package/dist/elysia/utils.js.map +0 -1
  463. package/dist/express/utils.cjs +0 -217
  464. package/dist/express/utils.cjs.map +0 -1
  465. package/dist/express/utils.d.cts +0 -37
  466. package/dist/express/utils.d.ts +0 -37
  467. package/dist/express/utils.js +0 -189
  468. package/dist/express/utils.js.map +0 -1
  469. package/dist/fastify/plugin.cjs +0 -316
  470. package/dist/fastify/plugin.cjs.map +0 -1
  471. package/dist/fastify/plugin.d.cts +0 -34
  472. package/dist/fastify/plugin.d.ts +0 -34
  473. package/dist/fastify/plugin.js +0 -282
  474. package/dist/fastify/plugin.js.map +0 -1
  475. package/dist/h3/plugin.cjs +0 -183
  476. package/dist/h3/plugin.cjs.map +0 -1
  477. package/dist/h3/plugin.d.cts +0 -27
  478. package/dist/h3/plugin.d.ts +0 -27
  479. package/dist/h3/plugin.js +0 -159
  480. package/dist/h3/plugin.js.map +0 -1
  481. package/dist/h3/utils.cjs +0 -77
  482. package/dist/h3/utils.cjs.map +0 -1
  483. package/dist/h3/utils.d.cts +0 -14
  484. package/dist/h3/utils.d.ts +0 -14
  485. package/dist/h3/utils.js +0 -54
  486. package/dist/h3/utils.js.map +0 -1
  487. package/dist/hapi/plugin.cjs +0 -210
  488. package/dist/hapi/plugin.cjs.map +0 -1
  489. package/dist/hapi/plugin.d.cts +0 -40
  490. package/dist/hapi/plugin.d.ts +0 -40
  491. package/dist/hapi/plugin.js +0 -187
  492. package/dist/hapi/plugin.js.map +0 -1
  493. package/dist/hapi/utils.cjs +0 -77
  494. package/dist/hapi/utils.cjs.map +0 -1
  495. package/dist/hapi/utils.d.cts +0 -16
  496. package/dist/hapi/utils.d.ts +0 -16
  497. package/dist/hapi/utils.js +0 -53
  498. package/dist/hapi/utils.js.map +0 -1
  499. package/dist/hono/utils.cjs +0 -113
  500. package/dist/hono/utils.cjs.map +0 -1
  501. package/dist/hono/utils.d.cts +0 -16
  502. package/dist/hono/utils.d.ts +0 -16
  503. package/dist/hono/utils.js +0 -88
  504. package/dist/hono/utils.js.map +0 -1
  505. package/dist/loggers/console.cjs +0 -67
  506. package/dist/loggers/console.cjs.map +0 -1
  507. package/dist/loggers/console.d.cts +0 -11
  508. package/dist/loggers/console.d.ts +0 -11
  509. package/dist/loggers/console.js +0 -44
  510. package/dist/loggers/console.js.map +0 -1
  511. package/dist/loggers/hapi.cjs.map +0 -1
  512. package/dist/loggers/hapi.d.cts +0 -12
  513. package/dist/loggers/hapi.d.ts +0 -12
  514. package/dist/loggers/hapi.js +0 -29
  515. package/dist/loggers/hapi.js.map +0 -1
  516. package/dist/loggers/index.cjs.map +0 -1
  517. package/dist/loggers/index.d.cts +0 -13
  518. package/dist/loggers/index.d.ts +0 -13
  519. package/dist/loggers/index.js +0 -13
  520. package/dist/loggers/index.js.map +0 -1
  521. package/dist/loggers/nestjs.cjs +0 -104
  522. package/dist/loggers/nestjs.cjs.map +0 -1
  523. package/dist/loggers/nestjs.d.cts +0 -11
  524. package/dist/loggers/nestjs.d.ts +0 -11
  525. package/dist/loggers/nestjs.js +0 -71
  526. package/dist/loggers/nestjs.js.map +0 -1
  527. package/dist/loggers/pino.cjs +0 -152
  528. package/dist/loggers/pino.cjs.map +0 -1
  529. package/dist/loggers/pino.d.cts +0 -11
  530. package/dist/loggers/pino.d.ts +0 -11
  531. package/dist/loggers/pino.js +0 -119
  532. package/dist/loggers/pino.js.map +0 -1
  533. package/dist/loggers/utils.cjs +0 -64
  534. package/dist/loggers/utils.cjs.map +0 -1
  535. package/dist/loggers/utils.d.cts +0 -6
  536. package/dist/loggers/utils.d.ts +0 -6
  537. package/dist/loggers/utils.js +0 -40
  538. package/dist/loggers/utils.js.map +0 -1
  539. package/dist/loggers/winston.cjs +0 -101
  540. package/dist/loggers/winston.cjs.map +0 -1
  541. package/dist/loggers/winston.d.cts +0 -11
  542. package/dist/loggers/winston.d.ts +0 -11
  543. package/dist/loggers/winston.js +0 -68
  544. package/dist/loggers/winston.js.map +0 -1
  545. package/dist/otel/index.cjs.map +0 -1
  546. package/dist/otel/index.d.cts +0 -2
  547. package/dist/otel/index.d.ts +0 -2
  548. package/dist/otel/index.js +0 -5
  549. 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 Node.js
22
+ # Apitally SDK for JavaScript
23
23
 
24
24
  [![Tests](https://github.com/apitally/apitally-js/actions/workflows/tests.yaml/badge.svg?event=push)](https://github.com/apitally/apitally-js/actions)
25
25
  [![Codecov](https://codecov.io/gh/apitally/apitally-js/graph/badge.svg?token=j5jqlrL7Pd)](https://codecov.io/gh/apitally/apitally-js)
26
26
  [![npm](https://img.shields.io/npm/v/apitally?logo=npm&color=%23cb0000)](https://www.npmjs.com/package/apitally)
27
27
 
28
- Apitally is a simple API monitoring and analytics tool that makes it easy to understand API usage, monitor performance, and troubleshoot issues.
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
- ### API analytics
37
-
38
- Track traffic, error and performance metrics for your API, each endpoint and
39
- individual API consumers, allowing you to make informed, data-driven engineering
40
- and product decisions.
41
-
42
- ### Request logs
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 | Supported versions | Setup guide |
63
- | --------------------------------------------------- | --------------------- | ------------------------------------------------------ |
64
- | [**Express**](https://github.com/expressjs/express) | `4.x`, `5.x` | [Link](https://docs.apitally.io/setup-guides/express) |
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) |
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. These also include your client ID.
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
- 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.
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
- Then add the Apitally middleware to your application:
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
- ```javascript
95
- const express = require("express");
96
- const { useApitally } = require("apitally/express");
72
+ ### AdonisJS
97
73
 
98
- const app = express();
99
- app.use(express.json());
74
+ Run the Ace add command from your application directory:
100
75
 
101
- useApitally(app, {
102
- clientId: "your-client-id",
103
- env: "dev", // or "prod" etc.
104
- });
76
+ ```bash
77
+ node ace add apitally
105
78
  ```
106
79
 
107
- For further instructions, see our
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
- Install the SDK with the `fastify-plugin` peer dependency:
82
+ If Apitally is already installed, or to rerun setup, use:
113
83
 
114
84
  ```bash
115
- npm install apitally fastify-plugin
85
+ node ace configure apitally
116
86
  ```
117
87
 
118
- Then register the Apitally plugin with your application:
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
- ```javascript
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
- const fastify = Fastify({ logger: true });
92
+ For further instructions, see our [setup guide for AdonisJS](https://docs.apitally.io/setup-guides/adonisjs).
125
93
 
126
- await fastify.register(apitallyPlugin, {
127
- clientId: "your-client-id",
128
- env: "dev", // or "prod" etc.
129
- });
130
- ```
94
+ ### Elysia
131
95
 
132
- _Note:_ If your project uses CommonJS you need to wrap your routes in a plugin, so Apitally can detect them.
96
+ Register `apitallyPlugin()` immediately after creating the app, before routes or plugins that add routes:
133
97
 
134
- For further instructions, see our
135
- [setup guide for Fastify](https://docs.apitally.io/setup-guides/fastify).
98
+ ```javascript
99
+ import { Elysia } from "elysia";
100
+ import { apitallyPlugin } from "apitally/elysia";
136
101
 
137
- ### NestJS
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
- Install the SDK:
113
+ For further instructions, see our [setup guide for Elysia](https://docs.apitally.io/setup-guides/elysia).
140
114
 
141
- ```bash
142
- npm install apitally
143
- ```
115
+ ### Express
144
116
 
145
- Then add the Apitally middleware to your application:
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 { NestFactory } from "@nestjs/core";
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
- async function bootstrap() {
153
- const app = await NestFactory.create(AppModule);
122
+ import express from "express";
123
+ import { useApitally } from "apitally";
154
124
 
155
- await useApitally(app, {
156
- clientId: "your-client-id",
157
- env: "dev", // or "prod" etc.
158
- });
159
-
160
- // ...
161
- }
125
+ const app = express();
162
126
 
163
- bootstrap();
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
- For further instructions, see our
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
- ### AdonisJS
135
+ For further instructions, see our [setup guide for Express](https://docs.apitally.io/setup-guides/express).
170
136
 
171
- Install the SDK:
137
+ ### Fastify
172
138
 
173
- ```bash
174
- npm install apitally
175
- ```
139
+ Call `useApitally(app)` immediately after creating the app, before registering plugins and routes:
176
140
 
177
- Then use the following Ace command to configure Apitally in your AdonisJS application:
141
+ ```javascript
142
+ import Fastify from "fastify";
143
+ import { useApitally } from "apitally";
178
144
 
179
- ```bash
180
- node ace configure apitally/adonisjs
181
- ```
145
+ const app = Fastify();
182
146
 
183
- For further instructions, see our
184
- [setup guide for AdonisJS](https://docs.apitally.io/setup-guides/adonisjs).
147
+ useApitally(app, {
148
+ writeToken: "your-write-token", // or set APITALLY_WRITE_TOKEN
149
+ env: "dev", // optional, defaults to "dev"
150
+ });
185
151
 
186
- ### Hono
152
+ // register plugins and routes below this point
153
+ ```
187
154
 
188
- Install the SDK:
155
+ For further instructions, see our [setup guide for Fastify](https://docs.apitally.io/setup-guides/fastify).
189
156
 
190
- ```bash
191
- npm install apitally
192
- ```
157
+ ### NestJS
193
158
 
194
- Then add the Apitally middleware to your application:
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 { Hono } from "hono";
198
- import { useApitally } from "apitally/hono";
162
+ import { NestFactory } from "@nestjs/core";
163
+ import { useApitally } from "apitally/nestjs";
164
+ import { AppModule } from "./app.module.js";
199
165
 
200
- const app = new Hono();
166
+ const app = await NestFactory.create(AppModule);
201
167
 
202
168
  useApitally(app, {
203
- clientId: "your-client-id",
204
- env: "dev", // or "prod" etc.
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
- Install the SDK:
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
- clientId: "your-client-id",
229
- env: "dev", // or "prod" etc.
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
- ### Elysia
198
+ ### Hapi
239
199
 
240
- Install the SDK:
200
+ Register `apitallyPlugin()` before calling `server.initialize()` or `server.start()`:
241
201
 
242
- ```bash
243
- npm install apitally
244
- ```
202
+ ```javascript
203
+ import Hapi from "@hapi/hapi";
204
+ import { apitallyPlugin } from "apitally/hapi";
245
205
 
246
- Then add the Apitally plugin to your application:
206
+ const server = Hapi.server({ port: 3000 });
247
207
 
248
- ```javascript
249
- import { Elysia } from "elysia";
250
- import { apitallyPlugin } from "apitally/elysia";
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
- const app = new Elysia()
253
- .use(
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
- ### Koa
221
+ ### Hono
266
222
 
267
- Install the SDK:
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
- ```bash
270
- npm install apitally
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
- Then add the Apitally middleware to your application:
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/koa");
247
+ const { useApitally } = require("apitally");
278
248
 
279
249
  const app = new Koa();
280
250
 
281
251
  useApitally(app, {
282
- clientId: "your-client-id",
283
- env: "dev", // or "prod" etc.
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
- ### Hapi
261
+ ## Trusted proxies
291
262
 
292
- Install the SDK:
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
- ```bash
295
- npm install apitally
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
- Then register the Apitally plugin with your application:
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
- const Hapi = require("@hapi/hapi");
302
- const { apitallyPlugin } = require("apitally/hapi");
285
+ import { NodeSDK } from "@opentelemetry/sdk-node";
286
+ import { ApitallySpanProcessor } from "apitally";
303
287
 
304
- const init = async () => {
305
- const server = Hapi.server({
306
- port: 3000,
307
- host: "localhost",
308
- });
288
+ const sdk = new NodeSDK({
289
+ spanProcessors: [new ApitallySpanProcessor()],
290
+ // ...your existing configuration
291
+ });
292
+ ```
309
293
 
310
- await server.register({
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
- init();
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
- For further instructions, see our
322
- [setup guide for Hapi](https://docs.apitally.io/setup-guides/hapi).
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