-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement aliasQuery #148
Implement aliasQuery #148
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e53d31a
to
212c3db
Compare
This comment has been minimized.
This comment has been minimized.
for i, series := range seriesList { | ||
v, err := f.getLastValueOfSeries(ctx, fetchTargets[i], from, until, targetValues) | ||
if err != nil { | ||
return nil, merry.WithHTTPCode(err, 400) |
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.
The error handling is not very consistent across the repo, but the trend seems to be to use pre-defined errors like this
err = merry.WithMessagef(parser.ErrInvalidArg, "unsupported "+target+" callback function") |
or this
err = parser.ErrBadType |
and then let it be mapped to a status code here:
Lines 216 to 228 in b518c04
if merry.Is( | |
err, | |
parser.ErrMissingExpr, | |
parser.ErrMissingComma, | |
parser.ErrMissingQuote, | |
parser.ErrUnexpectedCharacter, | |
parser.ErrBadType, | |
parser.ErrMissingArgument, | |
parser.ErrMissingTimeseries, | |
parser.ErrUnknownTimeUnits, | |
parser.ErrInvalidArg, | |
) { | |
err = merry.WithHTTPCode(err, 400) |
We have an issue to revisit all the error handling here #115 , but in the meantime I think it's better if we stay as consistent as we can. Wdyt?
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.
Yea I like that better--I'll make the change!
This comment has been minimized.
This comment has been minimized.
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.
lgtm!
Co-authored-by: Nicolás Pazos <32206519+npazosmendez@users.noreply.github.com>
Go coverage report: Click to expand.
Go lint report: No issues found. 😎 |
This PR adds an implementation for the
aliasQuery
function.Graphite doc: https://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.aliasQuery
Graphite-web implementation: https://github.com/graphite-project/graphite-web/blob/02bc0c836269e07b38175fbfe3b5689afc87b4fa/webapp/graphite/render/functions.py#L2587-L2610