-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Enable engine reporting in Lambda #1313
Conversation
docs/source/api/apollo-server.md
Outdated
@@ -316,3 +316,7 @@ addMockFunctionsToSchema({ | |||
itself. Set this to false to disable. You can manually invoke 'stop()' and | |||
'sendReport()' on other signals if you'd like. Note that 'sendReport()' | |||
does not run synchronously so it cannot work usefully in an 'exit' handler. | |||
|
|||
* `disableInterval`: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to expose this on ApolloServer
? I would expect it to be a setting that particular integrations (like the Lambda one) can turn on.
@@ -79,6 +79,8 @@ export interface EngineReportingOptions { | |||
// 'sendReport()' on other signals if you'd like. Note that 'sendReport()' | |||
// does not run synchronously so it cannot work usefully in an 'exit' handler. | |||
handleSignals?: boolean; | |||
// Disables reporting on an interval for stateless environments | |||
disableInterval?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems clearer to me to turn this around, so instead of disableInterval
maybe something like sendReportsImmediately
.
this.options.reportIntervalMs || 10 * 1000, | ||
); | ||
this.sendReportsImmediately = options.sendReportsImmediately; | ||
if (this.sendReportsImmediately) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks backwards to me. Should it be if (!this.sendReportsImmediately)
?
I don't see this in the documentation here https://www.apollographql.com/docs/apollo-server/api/apollo-server/ , am I missing something? |
This PR adds the ability to report from a stateless environment by adding the option to disable the interval that the engine reporting agent uses.
Ideally there would be a way to determine when the lambda is spinning down and gracefully send a report, however a quick skim of the documentation does not illicit any nice hook. @adnsio if you have any advice, I'd love to hear your thoughts.