Skip to content

Commit 74f9341

Browse files
authored
feat: add support for @koa/router (#1346)
The `koa-router` module is abandoned and a fork is being maintained under `@koa/router` instead. This fork is published as a major bump (v8.0.0) of the original, but our patch still works fine on that version. Closes #1343
1 parent 66765c1 commit 74f9341

File tree

10 files changed

+206
-189
lines changed

10 files changed

+206
-189
lines changed

.ci/.jenkins_tav.yml

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
TAV:
2+
- '@koa/router'
3+
- apollo-server-express
4+
- bluebird
5+
- cassandra-driver
6+
- elasticsearch
7+
- express
8+
- express-graphql
9+
- express-queue
10+
- fastify
11+
- finalhandler
212
- generic-pool
3-
- mysql
4-
- mysql2
5-
- redis
6-
- koa-router
13+
- got
14+
- graphql
715
- handlebars
16+
- hapi
17+
- ioredis
818
- jade
9-
- pug
19+
- knex
20+
- koa-router
21+
- memcached
22+
- mimic-response
1023
- mongodb-core
11-
- finalhandler
12-
- ioredis
24+
- mysql
25+
- mysql2
1326
- pg
14-
- cassandra-driver
15-
- tedious
27+
- pug
28+
- redis
1629
- restify
17-
- fastify
18-
- mimic-response
19-
- got
20-
- bluebird
21-
- apollo-server-express
22-
- knex
30+
- tedious
2331
- ws
24-
- graphql
25-
- express-graphql
26-
- elasticsearch
27-
- hapi
28-
- express
29-
- express-queue
30-
- memcached

.tav.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,13 @@ koa-router:
201201
node: '>=6.0.0'
202202
peerDependencies: koa@2
203203
versions: '>=5.2.0 <8'
204-
commands: node test/instrumentation/modules/koa-router/index.js
204+
commands: node test/instrumentation/modules/koa-router/old-name.js
205+
'@koa/router':
206+
node: '>=8.0.0'
207+
peerDependencies: koa@2
208+
versions: '>=8 <9'
209+
commands: node test/instrumentation/modules/koa-router/new-name.js
210+
205211
elasticsearch:
206212
versions: '>=8.0.0'
207213
commands: node test/instrumentation/modules/elasticsearch.js

docs/supported-technologies.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ These are the frameworks that we officially support:
4747
|<<express,Express>> |^4.0.0 |
4848
|<<hapi,hapi>> |>=9.0.0 <19.0.0 |
4949
|<<hapi,@hapi/hapi>> |>=17.9.0 <19.0.0 |
50-
|<<koa,Koa>> via koa-router |>=5.2.0 <8.0.0 |Koa doesn't have a built in router,
50+
|<<koa,Koa>> via koa-router or @koa/router |>=5.2.0 <9.0.0 |Koa doesn't have a built in router,
5151
so we can't support Koa directly since we rely on router information for full support.
5252
We currently support the most popular Koa router called https://github.com/alexmingoia/koa-router[koa-router]
5353
|<<restify,Restify>> |>=5.2.0 |

lib/instrumentation/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var MODULES = [
3131
'jade',
3232
'knex',
3333
'koa',
34-
'koa-router',
34+
['koa-router', '@koa/router'],
3535
'memcached',
3636
'mimic-response',
3737
'mongodb-core',

lib/instrumentation/modules/koa-router.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var shimmer = require('../shimmer')
66

77
module.exports = function (Router, agent, { version, enabled }) {
88
if (!enabled) return Router
9-
if (!semver.satisfies(version, '>=5.2.0 <8')) {
9+
if (!semver.satisfies(version, '>=5.2.0 <9')) {
1010
agent.logger.debug('koa-router version %s not supported - aborting...', version)
1111
return Router
1212
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"@commitlint/config-conventional": "^8.0.0",
113113
"@commitlint/travis-cli": "^8.0.0",
114114
"@hapi/hapi": "^18.2.0",
115+
"@koa/router": "^8.0.1",
115116
"@types/node": "^12.0.8",
116117
"apollo-server-express": "^2.6.3",
117118
"aws-sdk": "^2.477.0",

test/instrumentation/modules/koa-router/index.js

-163
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict'
2+
3+
require('./shared')('@koa/router')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict'
2+
3+
require('./shared')('koa-router')

0 commit comments

Comments
 (0)