Skip to content

Commit b7a416a

Browse files
trentmPeterEinberger
authored andcommitted
tests: stop testing 'express-graphql' instrumentation (elastic#3304)
https://www.npmjs.com/package/express-graphql is deprecated. https://github.com/graphql/express-graphql is archived. The latest release, [email protected] was 2022-11-19. Support for instrumenting this will remain, but we will stop testing it. A motivation for dropping this is that the `preinstall: npm uninstall express-graphql` parts of the `graphql` TAV testing could be significantly contributing to the graphql TAV tests being among the slowest; similar for `apollo-server-express` TAV tests.
1 parent afc16c6 commit b7a416a

14 files changed

+12
-406
lines changed

.ci/tav.json

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"cassandra-driver",
1414
"elasticsearch",
1515
"express",
16-
"express-graphql",
1716
"express-queue",
1817
"fastify",
1918
"finalhandler",

.npmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Workaround unresolvable peerDependencies between express-graphql, graphql,
1+
# Workaround unresolvable peerDependencies between graphql, @apollo-server,
22
# and apollo-server-express. npm v7 (included with node v15) makes these
33
# peerDependencies issues an install error. Until the community catches up
44
# and resolves peerDependencies issues or apm-agent-nodejs.git's tests are

.tav.yml

-39
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,10 @@ ws-new:
184184

185185
graphql-v0.7-v16:
186186
name: graphql
187-
preinstall: npm uninstall express-graphql
188187
versions: '>=0.7.0 <0.11.0 || >=0.11.1 <16'
189188
commands: node test/instrumentation/modules/graphql.test.js
190189
graphql:
191190
name: graphql
192-
preinstall: npm uninstall express-graphql
193191
node: '>=12'
194192
versions: '>=16.0.0 <17'
195193
commands: node test/instrumentation/modules/graphql.test.js
@@ -202,43 +200,8 @@ express:
202200
- node test/instrumentation/modules/express/capture-exceptions-on.test.js
203201
- node test/instrumentation/modules/express/set-framework.test.js
204202

205-
# - Skip [email protected] because it briefly, accidentally introduced
206-
# syntax that required ES2020 (node v14).
207-
# - Limit to node >=10.4 because of a known issue.
208-
# https://github.com/elastic/apm-agent-nodejs/issues/2516
209-
express-graphql-0.10.1_graphql-14:
210-
name: express-graphql
211-
preinstall: npm uninstall apollo-server-express
212-
peerDependencies: graphql@^14.6.0
213-
versions: '>=0.10.1 <0.11.0'
214-
node: '>=10.4'
215-
commands: node test/instrumentation/modules/express-graphql.test.js
216-
express-graphql-0.10.1_graphql-15:
217-
name: express-graphql
218-
preinstall: npm uninstall apollo-server-express
219-
peerDependencies: graphql@^15.0.0
220-
versions: '>=0.10.1 <0.11.0'
221-
node: '>=10.4'
222-
commands: node test/instrumentation/modules/express-graphql.test.js
223-
224-
express-graphql-0.11.0_graphql-14:
225-
name: express-graphql
226-
preinstall: npm uninstall apollo-server-express
227-
peerDependencies: graphql@^14.7.0
228-
versions: '>=0.11.0 <0.13.0'
229-
node: '>=10.4'
230-
commands: node test/instrumentation/modules/express-graphql.test.js
231-
express-graphql-0.11.0_graphql-15:
232-
name: express-graphql
233-
preinstall: npm uninstall apollo-server-express
234-
peerDependencies: graphql@^15.3.0
235-
versions: '>=0.11.0 <0.13.0'
236-
node: '>=10.4'
237-
commands: node test/instrumentation/modules/express-graphql.test.js
238-
239203
apollo-server-express-2_graphql-14:
240204
name: apollo-server-express
241-
preinstall: npm uninstall express-graphql
242205
peerDependencies: graphql@^14.0.0
243206
# We want this version range:
244207
# versions: '>=2.9.16 <2.2 || >= 2.3.2 <3'
@@ -250,7 +213,6 @@ apollo-server-express-2_graphql-14:
250213
commands: node test/instrumentation/modules/apollo-server-express.test.js
251214
apollo-server-express-2_graphql-15:
252215
name: apollo-server-express
253-
preinstall: npm uninstall express-graphql
254216
peerDependencies: graphql@^15.0.0
255217
# We want this version range (2.12.0 was the first release of
256218
# apollo-server-express after graphql@15 was released):
@@ -265,7 +227,6 @@ apollo-server-express-2_graphql-15:
265227
commands: node test/instrumentation/modules/apollo-server-express.test.js
266228
apollo-server-express-3_graphql-15:
267229
name: apollo-server-express
268-
preinstall: npm uninstall express-graphql
269230
peerDependencies: graphql@^15.0.0
270231
# We want this version range:
271232
# versions: '^3.0.0'

CHANGELOG.asciidoc

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ Notes:
6868
[float]
6969
===== Chores
7070
71+
* Stop testing `express-graphql` instrumentation -- the module is deprecated.
72+
({pull}3304[#3304])
73+
7174
7275
[[release-notes-3.45.0]]
7376
==== 3.45.0 2023/04/28

docs/configuration.asciidoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1008,15 +1008,15 @@ Example using options object:
10081008
[source,js]
10091009
----
10101010
require('elastic-apm-node').start({
1011-
disableInstrumentations: ['graphql', 'express-graphql']
1011+
disableInstrumentations: ['graphql', 'redis']
10121012
})
10131013
----
10141014

10151015
Example using environment variable:
10161016

10171017
[source,bash]
10181018
----
1019-
ELASTIC_APM_DISABLE_INSTRUMENTATIONS=graphql,express-graphql
1019+
ELASTIC_APM_DISABLE_INSTRUMENTATIONS=graphql,redis
10201020
----
10211021

10221022
For an always up-to-date list of modules for which instrumentation can be disabled,

docs/supported-technologies.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ These modules override that behavior to give better insights into specialized HT
125125
[options="header"]
126126
|=======================================================================
127127
|Module |Version |Note
128-
|https://www.npmjs.com/package/express-graphql[express-graphql] |>=0.6.1 <0.13.0 |Will name all transactions by the GraphQL query name. There is a https://github.com/elastic/apm-agent-nodejs/issues/2516[known issue with node <10.4]. Versions before 0.10.0 are no longer tested.
128+
|https://www.npmjs.com/package/express-graphql[express-graphql] |>=0.6.1 <0.13.0 |Will name all transactions by the GraphQL query name. There is a https://github.com/elastic/apm-agent-nodejs/issues/2516[known issue with node <10.4]. This module is deprecated and is no longer tested.
129129
|https://www.npmjs.com/package/apollo-server-express[apollo-server-express] |>=2.0.4 <4|Will name all transactions by the GraphQL query name. Versions before 2.9.6 are no longer tested.
130130
|=======================================================================
131131

docs/upgrade-to-v3.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The following deprecated API's has been removed:
5050
[[v3-changes-in-collected-data]]
5151
==== Changes in collected data
5252

53-
When instrumenting a GraphQL server that is run by either https://www.npmjs.com/package/apollo-server-express[`apollo-server-express`] or https://www.npmjs.com/package/express-graphql[`express-graphql`],
53+
When instrumenting a GraphQL server that is run by https://www.npmjs.com/package/apollo-server-express[`apollo-server-express`]
5454
the Transaction type is now `graphql` instead of `request`.
5555

5656
All Spans whose type was previously `ext` is now `external`.

examples/trace-apollo-server-express.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// export ELASTIC_APM_SERVER_URL=...
1616
// export ELASTIC_APM_SECRET_TOKEN=...
1717
// - Start the small GraphQL server:
18-
// node examples/trace-express-graphql.js
18+
// node examples/trace-apollo-server-express.js
1919
// - Make a GraphQL client request. E.g.:
2020
// curl -i localhost:3000/graphql -X POST -H content-type:application/json -d'{"query":"query HelloQuery { hello }"}'
2121
//

examples/trace-express-graphql.js

-40
This file was deleted.

lib/instrumentation/modules/graphql.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ module.exports = function (graphql, agent, { version, enabled }) {
140140
span.name = 'GraphQL: ' + (operationName ? operationName + ' ' : '') + queries.join(', ')
141141
}
142142

143-
// `_graphqlRoute` is a boolean set in instrumentations of other modules
144-
// that specify 'graphql' in peerDependencies (e.g. 'express-graphql') to
143+
// `_graphqlRoute` is a boolean, set in instrumentations of other modules
144+
// that specify 'graphql' in peerDependencies (e.g. '@apollo/server') to
145145
// indicate that this transaction is for a GraphQL request.
146146
const trans = span.transaction
147147
if (trans._graphqlRoute) {

package-lock.json

-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@
158158
"eslint-plugin-promise": "^4.3.1",
159159
"eslint-plugin-standard": "^4.1.0",
160160
"express": "^4.17.1",
161-
"express-graphql": "^0.12.0",
162161
"express-queue": "^0.0.13",
163162
"fastify": "^4.16.3",
164163
"finalhandler": "^1.1.2",

test/config.test.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,6 @@ usePathAsTransactionNameTests.forEach(function (usePathAsTransactionNameTest) {
989989
})
990990

991991
test('disableInstrumentations', function (t) {
992-
var expressGraphqlVersion = require('express-graphql/package.json').version
993992
var esVersion = safeGetPackageVersion('@elastic/elasticsearch')
994993

995994
// require('apollo-server-core') is a hard crash on nodes < 12.0.0
@@ -1002,9 +1001,7 @@ test('disableInstrumentations', function (t) {
10021001
if (isHapiIncompat('@hapi/hapi')) {
10031002
modules.delete('@hapi/hapi')
10041003
}
1005-
if (semver.lt(process.version, '7.6.0') && semver.gte(expressGraphqlVersion, '0.9.0')) {
1006-
modules.delete('express-graphql')
1007-
}
1004+
modules.delete('express-graphql')
10081005
if (semver.lt(process.version, '10.0.0') && semver.gte(esVersion, '7.12.0')) {
10091006
modules.delete('@elastic/elasticsearch') // - Version 7.12.0 dropped support for node v8.
10101007
}

0 commit comments

Comments
 (0)