The changes made in #4142 (released in v2.24) have broke the data reporting needed by Apollo Studio. Downgrading our app to use v2.23 of apollo-server-core, apollo-server-express and apollo-server-micro restored the correct behaviour.
I suspect only the Studio free tier is affected but haven't access to a paid account to confirm.
Expected Behaviour
Stats on operations performed against the GraphQL endpoint are sent to Apollo Studio.
Observed Behaviour
The behaviour we're seeing on 2.24 is, when the app starts up, we get an initial burst of data sent though then nothing until the next restart. The initial "burst" updates the schema (stored by Studio) and includes stats for several requests. It leave us with graphs that look like this...

Speculation
If I'm understanding the code here, when the app starts up Server waits up to initialDelayMaxMs before reporting to Studio. In addition to the data sent, this initial report also returns data to the app which is used to configure future reports. Specifically, the tracesIgnored flag informs the app whether trace data is worth sending, based on the subscription level of the Studio org. in v2.24 this flag is used to set the internal graphMightSupportTraces var. However, somewhere in the reporting code, the meaning of this var is flipped. When graphMightSupportTraces is false, only trace data is sent.
At least that's what I think is happening. It certainly explains the behaviour we're observing – we get the first batch of stats data, included in that initial request, then only trace data which is ignored by Studio when the org is on the free tier.
Reproduction
You can seemingly reproduce this with any Apollo Server app. I've used the "Getting Started" example:
# Clone a super-simple app
git clone git@github.com:molomby/apollo-studio-issue-reproduction.git
# Export your env vars to enable studio data reporting
export APOLLO_KEY=service:Debugging-data-reporting:12345fake12345fake
export APOLLO_GRAPH_VARIANT=current
export APOLLO_SCHEMA_REPORTING=true
# Start the app
# Note "libraryVersion": "apollo-server-core@2.24.0" in the output
node index.js
# Apollo usage reporting starting! See your graph at https://studio.apollographql.com/graph/Debugging-data-reporting/?variant=current
# Apollo schema reporting starting! See your graph at https://studio.apollographql.com/graph/Debugging-data-reporting/?variant=current with server info {"bootId":"68a8c0f6-f4d2-489a-af71-174ebbb0c308","graphVariant":"current","platform":"local","runtimeVersion":"node v12.22.1","executableSchemaId":"4290076ab12ba8e295d7d7110e086e5f98757ff05d0b64b59bafc94ec5ecf1e0","serverId":"fake.local","libraryVersion":"apollo-server-core@2.24.0"}
# 🚀 Server ready at http://localhost:4000/
Generate some traffic:
for i in {1..1000}; do
curl -s 'http://localhost:4000/' -H 'accept: */*' -H 'content-type: application/json' --data-raw '{"query":"{ books { title } }"}'
sleep 0.2
done
Let it run for a few minutes. Studio will report the initial burst of traffic followed by silence:

The fix, revert to apollo-server-core@2.23.0:
# Get the working version
git checkout fixed
yarn
# Restart the app
# Note "libraryVersion": "apollo-server-core@2.23.0" in the output
node index.js
# Apollo usage reporting starting! See your graph at https://studio.apollographql.com/graph/Debugging-data-reporting/?variant=current
# Apollo schema reporting starting! See your graph at https://studio.apollographql.com/graph/Debugging-data-reporting/?variant=current with server info {"bootId":"19f14b66-30fd-4f26-bf25-5a873d9229df","graphVariant":"current","platform":"local","runtimeVersion":"node v12.22.1","executableSchemaId":"4290076ab12ba8e295d7d7110e086e5f98757ff05d0b64b59bafc94ec5ecf1e0","serverId":"fake.local","libraryVersion":"apollo-server-core@2.23.0"}
# 🚀 Server ready at http://localhost:4000/
Then generate some traffic again, as above, let it run for a few minutes and you'll get a much healthier graph:

The changes made in #4142 (released in v2.24) have broke the data reporting needed by Apollo Studio. Downgrading our app to use v2.23 of
apollo-server-core,apollo-server-expressandapollo-server-microrestored the correct behaviour.I suspect only the Studio free tier is affected but haven't access to a paid account to confirm.
Expected Behaviour
Stats on operations performed against the GraphQL endpoint are sent to Apollo Studio.
Observed Behaviour
The behaviour we're seeing on 2.24 is, when the app starts up, we get an initial burst of data sent though then nothing until the next restart. The initial "burst" updates the schema (stored by Studio) and includes stats for several requests. It leave us with graphs that look like this...
Speculation
If I'm understanding the code here, when the app starts up Server waits up to
initialDelayMaxMsbefore reporting to Studio. In addition to the data sent, this initial report also returns data to the app which is used to configure future reports. Specifically, thetracesIgnoredflag informs the app whether trace data is worth sending, based on the subscription level of the Studio org. in v2.24 this flag is used to set the internalgraphMightSupportTracesvar. However, somewhere in the reporting code, the meaning of this var is flipped. WhengraphMightSupportTracesis false, only trace data is sent.At least that's what I think is happening. It certainly explains the behaviour we're observing – we get the first batch of stats data, included in that initial request, then only trace data which is ignored by Studio when the org is on the free tier.
Reproduction
You can seemingly reproduce this with any Apollo Server app. I've used the "Getting Started" example:
Generate some traffic:
Let it run for a few minutes. Studio will report the initial burst of traffic followed by silence:
The fix, revert to
apollo-server-core@2.23.0:Then generate some traffic again, as above, let it run for a few minutes and you'll get a much healthier graph: