Skip to content

Commit 3fbfd76

Browse files
committed
feat(node-experimental): Add koa integration
This should auto-instrument Koa performance. We still needs tests for this at some point.
1 parent c1848cd commit 3fbfd76

File tree

4 files changed

+125
-9
lines changed

4 files changed

+125
-9
lines changed

packages/node-experimental/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@opentelemetry/instrumentation-graphql": "0.37.0",
3939
"@opentelemetry/instrumentation-hapi": "0.34.0",
4040
"@opentelemetry/instrumentation-http": "0.48.0",
41+
"@opentelemetry/instrumentation-koa": "0.37.0",
4142
"@opentelemetry/instrumentation-mongodb": "0.39.0",
4243
"@opentelemetry/instrumentation-mongoose": "0.35.0",
4344
"@opentelemetry/instrumentation-mysql": "0.35.0",

packages/node-experimental/src/integrations/getAutoPerformanceIntegrations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { expressIntegration } from './express';
44
import { fastifyIntegration } from './fastify';
55
import { graphqlIntegration } from './graphql';
66
import { hapiIntegration } from './hapi';
7+
import { koaIntegration } from './koa';
78
import { mongoIntegration } from './mongo';
89
import { mongooseIntegration } from './mongoose';
910
import { mysqlIntegration } from './mysql';
@@ -28,5 +29,6 @@ export function getAutoPerformanceIntegrations(): Integration[] {
2829
prismaIntegration(),
2930
nestIntegration(),
3031
hapiIntegration(),
32+
koaIntegration(),
3133
];
3234
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
2+
import { KoaInstrumentation } from '@opentelemetry/instrumentation-koa';
3+
import { defineIntegration } from '@sentry/core';
4+
import type { IntegrationFn } from '@sentry/types';
5+
6+
const _koaIntegration = (() => {
7+
return {
8+
name: 'Koa',
9+
setupOnce() {
10+
registerInstrumentations({
11+
instrumentations: [new KoaInstrumentation()],
12+
});
13+
},
14+
};
15+
}) satisfies IntegrationFn;
16+
17+
export const koaIntegration = defineIntegration(_koaIntegration);

yarn.lock

Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4788,6 +4788,17 @@
47884788
"@opentelemetry/semantic-conventions" "1.21.0"
47894789
semver "^7.5.2"
47904790

4791+
"@opentelemetry/[email protected]":
4792+
version "0.37.0"
4793+
resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-koa/-/instrumentation-koa-0.37.0.tgz#f12e608afb7b58cee0f27abb3c2a166ea8596c68"
4794+
integrity sha512-EfuGv1RJCSZh77dDc3PtvZXGwcsTufn9tU6T9VOTFcxovpyJ6w0og73eD0D02syR8R+kzv6rg1TeS8+lj7pyrQ==
4795+
dependencies:
4796+
"@opentelemetry/core" "^1.8.0"
4797+
"@opentelemetry/instrumentation" "^0.48.0"
4798+
"@opentelemetry/semantic-conventions" "^1.0.0"
4799+
"@types/koa" "2.14.0"
4800+
"@types/koa__router" "12.0.3"
4801+
47914802
"@opentelemetry/[email protected]":
47924803
version "0.39.0"
47934804
resolved "https://registry.yarnpkg.com/@opentelemetry/instrumentation-mongodb/-/instrumentation-mongodb-0.39.0.tgz#31bc92c137b578219bfaf4d15c7f247bc8d3b2c6"
@@ -5560,15 +5571,6 @@
55605571
"@sentry/types" "7.93.0"
55615572
"@sentry/utils" "7.93.0"
55625573

5563-
5564-
version "7.93.0"
5565-
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-7.93.0.tgz#3db26f74dc1269650fa9ec553f0837af5caa0d30"
5566-
integrity sha512-gfPyT3DFGYYM5d+CHiS0YJHkIJHa8MKSfl32RkCMA5KQr9RF0H+GR5LZCinQOWq43fpsncSLyuoMfBjgbMLN+w==
5567-
dependencies:
5568-
"@sentry/core" "7.93.0"
5569-
"@sentry/types" "7.93.0"
5570-
"@sentry/utils" "7.93.0"
5571-
55725574
55735575
version "7.93.0"
55745576
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.93.0.tgz#7786d05d1e3e984207a866b07df1bf891355892e"
@@ -5892,6 +5894,13 @@
58925894
"@tufjs/canonical-json" "1.0.0"
58935895
minimatch "^9.0.0"
58945896

5897+
"@types/accepts@*":
5898+
version "1.3.7"
5899+
resolved "https://registry.yarnpkg.com/@types/accepts/-/accepts-1.3.7.tgz#3b98b1889d2b2386604c2bbbe62e4fb51e95b265"
5900+
integrity sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==
5901+
dependencies:
5902+
"@types/node" "*"
5903+
58955904
"@types/accepts@^1.3.5":
58965905
version "1.3.5"
58975906
resolved "https://registry.yarnpkg.com/@types/accepts/-/accepts-1.3.5.tgz#c34bec115cfc746e04fe5a059df4ce7e7b391575"
@@ -6011,6 +6020,11 @@
60116020
dependencies:
60126021
"@types/node" "*"
60136022

6023+
"@types/content-disposition@*":
6024+
version "0.5.8"
6025+
resolved "https://registry.yarnpkg.com/@types/content-disposition/-/content-disposition-0.5.8.tgz#6742a5971f490dc41e59d277eee71361fea0b537"
6026+
integrity sha512-QVSSvno3dE0MgO76pJhmv4Qyi/j0Yk9pBp0Y7TJ2Tlj+KCgJWY6qX7nnxCOLkZ3VYRSIk1WTxCvwUSdx6CCLdg==
6027+
60146028
60156029
version "0.5.2"
60166030
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.5.2.tgz#9bf9d62c838c85a07c92fdf2334c2c14fd9c59a9"
@@ -6026,6 +6040,16 @@
60266040
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.6.0.tgz#eac397f28bf1d6ae0ae081363eca2f425bedf0d5"
60276041
integrity sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==
60286042

6043+
"@types/cookies@*":
6044+
version "0.9.0"
6045+
resolved "https://registry.yarnpkg.com/@types/cookies/-/cookies-0.9.0.tgz#a2290cfb325f75f0f28720939bee854d4142aee2"
6046+
integrity sha512-40Zk8qR147RABiQ7NQnBzWzDcjKzNrntB5BAmeGCb2p/MIyOE+4BVvc17wumsUqUw00bJYqoXFHYygQnEFh4/Q==
6047+
dependencies:
6048+
"@types/connect" "*"
6049+
"@types/express" "*"
6050+
"@types/keygrip" "*"
6051+
"@types/node" "*"
6052+
60296053
"@types/[email protected]", "@types/cors@^2.8.12":
60306054
version "2.8.12"
60316055
resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.12.tgz#6b2c510a7ad7039e98e7b8d3d6598f4359e5c080"
@@ -6298,6 +6322,26 @@
62986322
"@types/qs" "*"
62996323
"@types/range-parser" "*"
63006324

6325+
"@types/express-serve-static-core@^4.17.33":
6326+
version "4.17.42"
6327+
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.42.tgz#2a276952acc73d1b8dc63fd4210647abbc553a71"
6328+
integrity sha512-ckM3jm2bf/MfB3+spLPWYPUH573plBFwpOhqQ2WottxYV85j1HQFlxmnTq57X1yHY9awZPig06hL/cLMgNWHIQ==
6329+
dependencies:
6330+
"@types/node" "*"
6331+
"@types/qs" "*"
6332+
"@types/range-parser" "*"
6333+
"@types/send" "*"
6334+
6335+
"@types/express@*":
6336+
version "4.17.21"
6337+
resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.21.tgz#c26d4a151e60efe0084b23dc3369ebc631ed192d"
6338+
integrity sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==
6339+
dependencies:
6340+
"@types/body-parser" "*"
6341+
"@types/express-serve-static-core" "^4.17.33"
6342+
"@types/qs" "*"
6343+
"@types/serve-static" "*"
6344+
63016345
"@types/[email protected]", "@types/express@^4.17.14", "@types/express@^4.17.2":
63026346
version "4.17.14"
63036347
resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.14.tgz#143ea0557249bc1b3b54f15db4c81c3d4eb3569c"
@@ -6421,6 +6465,16 @@
64216465
resolved "https://registry.yarnpkg.com/@types/htmlbars-inline-precompile/-/htmlbars-inline-precompile-1.0.1.tgz#de564513fabb165746aecd76369c87bd85e5bbb4"
64226466
integrity sha512-sVD2e6QAAHW0Y6Btse+tTA9k9g0iKm87wjxRsgZRU5EwSooz80tenbV+fA+f2BI2g0G2CqxsS1rIlwQCtPRQow==
64236467

6468+
"@types/http-assert@*":
6469+
version "1.5.5"
6470+
resolved "https://registry.yarnpkg.com/@types/http-assert/-/http-assert-1.5.5.tgz#dfb1063eb7c240ee3d3fe213dac5671cfb6a8dbf"
6471+
integrity sha512-4+tE/lwdAahgZT1g30Jkdm9PzFRde0xwxBNUyRsCitRvCQB90iuA2uJYdUnhnANRcqGXaWOGY4FEoxeElNAK2g==
6472+
6473+
"@types/http-errors@*":
6474+
version "2.0.4"
6475+
resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.4.tgz#7eb47726c391b7345a6ec35ad7f4de469cf5ba4f"
6476+
integrity sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==
6477+
64246478
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
64256479
version "2.0.4"
64266480
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44"
@@ -6479,6 +6533,39 @@
64796533
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
64806534
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
64816535

6536+
"@types/keygrip@*":
6537+
version "1.0.6"
6538+
resolved "https://registry.yarnpkg.com/@types/keygrip/-/keygrip-1.0.6.tgz#1749535181a2a9b02ac04a797550a8787345b740"
6539+
integrity sha512-lZuNAY9xeJt7Bx4t4dx0rYCDqGPW8RXhQZK1td7d4H6E9zYbLoOtjBvfwdTKpsyxQI/2jv+armjX/RW+ZNpXOQ==
6540+
6541+
"@types/koa-compose@*":
6542+
version "3.2.8"
6543+
resolved "https://registry.yarnpkg.com/@types/koa-compose/-/koa-compose-3.2.8.tgz#dec48de1f6b3d87f87320097686a915f1e954b57"
6544+
integrity sha512-4Olc63RY+MKvxMwVknCUDhRQX1pFQoBZ/lXcRLP69PQkEpze/0cr8LNqJQe5NFb/b19DWi2a5bTi2VAlQzhJuA==
6545+
dependencies:
6546+
"@types/koa" "*"
6547+
6548+
"@types/koa@*", "@types/[email protected]":
6549+
version "2.14.0"
6550+
resolved "https://registry.yarnpkg.com/@types/koa/-/koa-2.14.0.tgz#8939e8c3b695defc12f2ef9f38064509e564be18"
6551+
integrity sha512-DTDUyznHGNHAl+wd1n0z1jxNajduyTh8R53xoewuerdBzGo6Ogj6F2299BFtrexJw4NtgjsI5SMPCmV9gZwGXA==
6552+
dependencies:
6553+
"@types/accepts" "*"
6554+
"@types/content-disposition" "*"
6555+
"@types/cookies" "*"
6556+
"@types/http-assert" "*"
6557+
"@types/http-errors" "*"
6558+
"@types/keygrip" "*"
6559+
"@types/koa-compose" "*"
6560+
"@types/node" "*"
6561+
6562+
6563+
version "12.0.3"
6564+
resolved "https://registry.yarnpkg.com/@types/koa__router/-/koa__router-12.0.3.tgz#3fb74ea1991cadd6c6712b6106657aa6e64afca4"
6565+
integrity sha512-5YUJVv6NwM1z7m6FuYpKfNLTZ932Z6EF6xy2BbtpJSyn13DKNQEkXVffFVSnJHxvwwWh2SAeumpjAYUELqgjyw==
6566+
dependencies:
6567+
"@types/koa" "*"
6568+
64826569
"@types/long@^4.0.0", "@types/long@^4.0.1":
64836570
version "4.0.2"
64846571
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"
@@ -6793,6 +6880,14 @@
67936880
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.3.tgz#9a726e116beb26c24f1ccd6850201e1246122e04"
67946881
integrity sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==
67956882

6883+
"@types/send@*":
6884+
version "0.17.4"
6885+
resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.4.tgz#6619cd24e7270793702e4e6a4b958a9010cfc57a"
6886+
integrity sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==
6887+
dependencies:
6888+
"@types/mime" "^1"
6889+
"@types/node" "*"
6890+
67966891
"@types/serve-static@*":
67976892
version "1.13.9"
67986893
resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.9.tgz#aacf28a85a05ee29a11fb7c3ead935ac56f33e4e"
@@ -12196,6 +12291,7 @@ cron@^3.1.6:
1219612291
dependencies:
1219712292
"@types/luxon" "~3.3.0"
1219812293
luxon "~3.4.0"
12294+
1219912295
cross-env@^7.0.3:
1220012296
version "7.0.3"
1220112297
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"

0 commit comments

Comments
 (0)