-
Notifications
You must be signed in to change notification settings - Fork 528
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
Increase Prometheus not found metric on tempo-vulture #301
Increase Prometheus not found metric on tempo-vulture #301
Conversation
cmd/tempo-vulture/main.go
Outdated
@@ -115,6 +115,11 @@ func queryTempoAndAnalyze(baseURL string, backoff time.Duration, traceIDs []stri | |||
glog.Error("tempo url ", baseURL+"/api/traces/"+id) | |||
trace, err := util.QueryTrace(baseURL, id, tempoOrgID) | |||
if err != nil { | |||
if strings.Contains(err.Error(), "not found") { |
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 would be preferred to define and export an error from the util package like:
var ErrTraceNotFound = errors.New("trace not found")
The calling code can then compare using simple equality instead of a string.Contains
method
if err == util.ErrTraceNotFound {
}
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.
+1
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.
Thanks for the review! Yep, that way it's cleaner. I'll update the PR :)
Signed-off-by: Daniel González Lopes <[email protected]>
Signed-off-by: Daniel González Lopes <[email protected]>
Signed-off-by: Daniel González Lopes <[email protected]>
Signed-off-by: Daniel González Lopes <[email protected]>
ba559c4
to
d6b8440
Compare
cmd/tempo-vulture/main.go
Outdated
@@ -115,6 +115,11 @@ func queryTempoAndAnalyze(baseURL string, backoff time.Duration, traceIDs []stri | |||
glog.Error("tempo url ", baseURL+"/api/traces/"+id) | |||
trace, err := util.QueryTrace(baseURL, id, tempoOrgID) | |||
if err != nil { | |||
if err == util.ErrTraceNotFound { |
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.
one final nit. let's reduce nesting here:
if err == util.ErrTraceNotFound {
...
}
if err != nil {
...
}
Signed-off-by: Daniel González Lopes <[email protected]>
Thanks again! |
What this PR does:
This PR adds some things:
not found error
in case we don't find the traceID.I'm not a Go expert, but this approach seemed "reasonable" 😄
Which issue(s) this PR fixes:
Fixes #286
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]