Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(reporting): Add reportTiming option to EngineReportingOptions #3918

Merged
merged 41 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cca779e
Add trace reporting api
Mar 24, 2020
1315575
Fix tests
May 15, 2020
4744b37
Set captureTraces to false if we don't report
May 15, 2020
1738399
Apply suggestions from code review
jsegaran May 18, 2020
832211d
Address comments
May 18, 2020
c11f23b
Prettier
May 18, 2020
56f4d41
Revert "Prettier"
abernix May 19, 2020
d15966e
Move code around and clean
May 19, 2020
0612f9c
Set capture traces in the reporting agent.
May 20, 2020
767cde2
Clean up
May 20, 2020
5f6a606
Add documentation
May 20, 2020
f1f2aeb
Remove unnecessary check
May 20, 2020
023001f
Merge branch 'release-2.14.0' into jsegaran/should_report_api
abernix May 21, 2020
4f9669c
Update CHANGELOG.md
jsegaran May 26, 2020
4f4a835
Update packages/apollo-engine-reporting/src/__tests__/plugin.test.ts
jsegaran May 26, 2020
f686a2f
Apply suggestions from code review
jsegaran May 26, 2020
2040f54
Prettier
May 26, 2020
b1a1568
Remove shouldReportTrace
May 26, 2020
5b15a9f
Update docs/source/api/apollo-server.md
jsegaran May 26, 2020
49aa8dd
Update packages/apollo-engine-reporting/src/agent.ts
jsegaran May 26, 2020
c745361
Update packages/apollo-engine-reporting/src/agent.ts
jsegaran May 26, 2020
5d5f60f
Address comments
May 26, 2020
d6114cc
Update changelog
May 26, 2020
d834d05
Re-prettier agent.ts
May 26, 2020
4e9e603
Address comments
May 27, 2020
bbad3a6
Quick comment change
May 27, 2020
0b112f0
Rename to instrument operation
Jun 11, 2020
6852bb8
Merge branch 'master' into jsegaran/should_report_api
Jun 11, 2020
c60f0fa
Update apollo-server.md
Jun 11, 2020
a397cce
Rename to `timeOperation`
Jun 11, 2020
87b75c7
chore(deps): update dependency gatsby-theme-apollo-docs to v4.2.6 (#4…
renovate[bot] Jun 12, 2020
f7a2684
chore(deps): update dependency @types/aws-lambda to v8.10.56 (#4247)
renovate[bot] Jun 13, 2020
17acebd
chore(deps): update dependency @types/ioredis to v4.16.5 (#4248)
renovate[bot] Jun 13, 2020
1cc7ec0
chore(deps): update dependency @types/uuid to v7.0.4 (#4250)
renovate[bot] Jun 13, 2020
1ce44e9
chore(deps): update dependency gatsby to v2.23.3 (#4251)
renovate[bot] Jun 13, 2020
1434080
chore(deps): update dependency @types/supertest to v2.0.9 (#4249)
renovate[bot] Jun 13, 2020
bbed182
chore(deps): update dependency lerna to v3.22.1 (#4252)
renovate[bot] Jun 13, 2020
5ea850f
Rename to report timing
Jun 15, 2020
029c153
Merge branch 'master' into jsegaran/should_report_api
jsegaran Jun 15, 2020
7f464ab
Update changelog
Jun 15, 2020
5eb1778
Use code fences in API documentation
abernix Jun 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ The version headers in this history reflect the versions of Apollo Server itself

### vNEXT

- _Nothing yet! Stay tuned._
- `apollo-engine-reporting`: Added a `reportTiming` API to allow trace reporting to be enabled or disabled on a per request basis. The option takes either a boolean or a predicate function that takes a [`GraphQLRequestContextDidResolveOperation`](https://github.com/apollographql/apollo-server/blob/a926b7eedbb87abab2ec70fb03d71743985cb18d/packages/apollo-server-types/src/index.ts#L185-L190) or [`GraphQLRequestContextDidEncounterErrors`](https://github.com/apollographql/apollo-server/blob/a926b7eedbb87abab2ec70fb03d71743985cb18d/packages/apollo-server-types/src/index.ts#L191-L195) and returns a boolean. If the boolean is false the request will not be instrumented for tracing and no trace will be sent to Apollo Graph Manager. The default is `true` so all traces will get instrumented and sent, which is the same as the previous default behavior. [PR #3918](https://github.com/apollographql/apollo-server/pull/3918)
- `apollo-engine-reporting`: Removed `GraphQLServerOptions.reporting`. It isn't known whether a trace will be reported at the beginning of the request because of the above change. We believe this field was only used internally within Apollo Server; let us know if this is a problem and we can suggest alternatives. Additionally, the field requestContext.metrics.captureTraces is now initialized later in the request pipeline. [PR #3918](https://github.com/apollographql/apollo-server/pull/3918)

### v2.14.4

Expand Down
12,097 changes: 6,273 additions & 5,824 deletions docs/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"serve": "gatsby serve"
},
"dependencies": {
"gatsby": "2.23.1",
"gatsby-theme-apollo-docs": "4.2.3",
"gatsby": "2.23.3",
"gatsby-theme-apollo-docs": "4.2.6",
"react": "16.13.1",
"react-dom": "16.13.1"
}
Expand Down
12 changes: 12 additions & 0 deletions docs/source/api/apollo-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,18 @@ addMockFunctionsToSchema({

jsegaran marked this conversation as resolved.
Show resolved Hide resolved
A human-readable name for the variant of a schema (i.e. staging, EU). Setting this value will cause metrics to be segmented in the Apollo Graph Manager UI. Additionally schema validation with a graph variant will only check metrics associated with the same string.

* `reportTiming`: Boolean | async (GraphQLRequestContextDidResolveOperation | GraphQLRequestContextDidEncounterErrors) => Boolean

Specify whether to instrument an operation to send traces and metrics to Apollo.
This may resolve to a boolean or a async function returning a promise resolving to a boolean.
If the option resolves to false for an operation the operation will not be instrumented
and no metrics information will be sent to Apollo.

The function will receive a GraphQLRequestContextDidResolveOperation with client and operation
information or a GraphQLRequestContextDiDEncounterErrors in the case an operation failed
to resolve properly. This allows the choice of whether to include a given request in trace
and metric reporting to be made on a per-request basis. The default value is true.
abernix marked this conversation as resolved.
Show resolved Hide resolved

* `generateClientInfo`: (GraphQLRequestContext) => ClientInfo **AS 2.2**

Creates a client context(ClientInfo) based on the request pipeline's
Expand Down
139 changes: 60 additions & 79 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
},
"devDependencies": {
"@types/async-retry": "1.4.2",
"@types/aws-lambda": "8.10.53",
"@types/aws-lambda": "8.10.56",
"@types/body-parser": "1.19.0",
"@types/bunyan": "1.8.6",
"@types/connect": "3.4.33",
"@types/fast-json-stable-stringify": "2.0.0",
"@types/hapi": "17.8.8",
"@types/ioredis": "4.16.4",
"@types/ioredis": "4.16.5",
"@types/jest": "25.2.3",
"@types/koa-router": "7.4.1",
"@types/lodash": "4.14.155",
Expand All @@ -83,10 +83,10 @@
"@types/qs-middleware": "1.0.1",
"@types/request": "2.48.5",
"@types/request-promise": "4.1.46",
"@types/supertest": "2.0.8",
"@types/supertest": "2.0.9",
"@types/test-listen": "1.1.0",
"@types/type-is": "1.6.3",
"@types/uuid": "7.0.3",
"@types/uuid": "7.0.4",
"@types/ws": "7.2.5",
"apollo-fetch": "0.7.0",
"apollo-link": "1.2.14",
Expand All @@ -113,7 +113,7 @@
"js-sha256": "0.9.0",
"koa": "2.12.0",
"koa-router": "7.4.0",
"lerna": "3.22.0",
"lerna": "3.22.1",
"log4js": "4.5.1",
"memcached-mock": "0.1.0",
"mock-req": "0.2.0",
Expand Down
Loading