-
Notifications
You must be signed in to change notification settings - Fork 3
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
Client function for new metrics endpoint #268
Conversation
Pull Request Test Coverage Report for Build 397513533
💛 - Coveralls |
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.
Looks good! My only comment is something we've chatted about elsewhere, that changing fixture files will result in these tests failing, but as long as they are pretty stable then this looks great!
@@ -41,6 +41,13 @@ app.get("/api/:tenantId/race", api.race); | |||
app.get("/api/:tenantId/sentencing", api.sentencing); | |||
app.post("/api/:tenantId/public", express.json(), api.metricsByName); | |||
|
|||
// uptime check endpoint | |||
app.get("/health", (req, res) => { |
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.
Are you going to point Sentry at this to receive notifications if it goes down?
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.
i don't know ... at the moment it was just needed for the tests to be able to determine when the test server is ready to receive requests. But yeah I guess we could use it for any normal uptime monitoring scenario also. Are we doing that with Sentry on pulse-dashboard?
@jovergaag I expect them to remain pretty stable in this application, yes, so I think this is a safe trade-off. I don't expect we'll be in the habit of, e.g., refreshing them with new values periodically, so they should really only change if the schema changes. |
Description of the change
Encapsulates metric fetching from the Spotlight API
/public
endpoint in a fairly straightforward function. (It doesn't look terribly different from the proof of concept in #257.)Somewhat less straightforward, but maybe kind of fun, is the testing strategy: rather than creating a potentially brittle mock, I just integrated a real server from the
spotlight-api
package into the client tests. This runs on a designated port and serves up the "demo" fixtures. Jest is able to provision and destroy this server programmatically as part of its global setup and teardown configuration, so we don't actually have to do anything special to run this integration test beyond making sure the test environment is properly configured in.env.test
. (This is a new requirement for development so I have added it to the README as well.)(This works fine locally but the test process has a mysterious tendency to hang after it's finished in the CI job. I am just forcing the process to exit, which is a little dubious but seems fine in this context? It's pretty hard to debug environment issues in Github CI so I am not inclined to spend time figuring this out unless someone is very offended by this solution.)
Type of change
Related issues
Checklists
Development
These boxes should be checked by the submitter prior to merging:
Code review
These boxes should be checked by reviewers prior to merging: