NOPS-1034 added handling of summarize(sumSeries) healthchecks #164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following #158 we've had a bunch of results come up on the dashboard. One thing that we noticed is that all of the problematic health checks included
sumSeries
graphite functionality.There are three various functions that use that:
summarize (which adds the series), asPercent (which adds all of series 1, then all of series 2, then displays them as a percentage of one of the other), and divideSeries (presumably adds all of series 1, then all of series 2 and divides one by the other).
The graphite
render
API does not, in fact, return the result of the query / equation if there is more than one datapoint in the datapoints array - and we need to add handling for each of the cases in n-health. In fact even in Grafana the "single integer view" is generated from the points underneath.This PR adds handling for summarize(sumSeries).
An example response (from
next-retention
), https://graphitev2-api.ft.com/render/?format=json&from=-12hour&target=summarize(sumSeries(next.heroku.retention.*.prod.manageSubscriptionConfirmationHandler.transition-applyTransition.success),%20%221hour%22,%20%22sum%22,%20true)In the original code we have
result.datapoints.some(value => { if (value[0] === null) {...
- what happened in the example above is that for each tuple array in thedatapoints
array the code was checking forvalue[0] === null
, and tripping over eachnull
for no reason - because in the case of sumSeries, the individualnulls
don't matter - it is the sums ofvalue[0]
that does.An alternative solution which would fix
next-retention
but is likely to trip people up again int he future would be to replacehttps://graphitev2-api.ft.com/render/?format=json&from=-12hour&target=summarize(sumSeries(next.heroku.retention.*.prod.manageSubscriptionConfirmationHandler.transition-applyTransition.success),%20%221hour%22,%20%22sum%22,%20true)
with
https://graphitev2-api.ft.com/render/?format=json&from=-12hour&target=summarize(sumSeries(next.heroku.retention.*.prod.manageSubscriptionConfirmationHandler.transition-applyTransition.success),%20%2212hour%22,%20%22sum%22,%20true)
(from
1hour
to12hour
). Then we'd only get a single datapoint.