-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: rest framework enhancements #783
Conversation
cmd/collectors/rest/rest.go
Outdated
r.Logger.Error().Err(err).Str("key", key).Str("metric", metric.GetName()). | ||
Msg("Unable to set float key on metric") | ||
if metr, ok := r.Matrix.GetMetrics()[metric.name]; !ok { | ||
if metr, _ = r.Matrix.NewMetricFloat64(metric.name); err != nil { |
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.
would be slightly clearer to 1) create the metric by name and 2) update the map in this block and then remove the else and use it for both cases
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.
done
cmd/collectors/rest/rest.go
Outdated
if f.Exists() { | ||
if metr, ok := data.GetMetrics()[metric]; !ok { | ||
if metr, _ = data.NewMetricFloat64(metric); err != nil { | ||
if metr, ok := data.GetMetrics()[metric.name]; !ok { |
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.
similar comment as above about minor refactoring
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.
done
cmd/collectors/rest/rest.go
Outdated
r.Logger.Error().Err(err).Str("key", key).Str("metric", metric.GetName()). | ||
Msg("Unable to set float key on metric") | ||
if metr, ok := r.Matrix.GetMetrics()[metric.name]; !ok { | ||
if metr, _ = r.Matrix.NewMetricFloat64(metric.name); err != nil { |
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.
err not used
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.
done
Msg("NewMetricFloat64") | ||
} | ||
} | ||
f := instanceData.Get(metric.name) |
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.
when err != nil is metr valid to use below?
Msg("NewMetricFloat64") | ||
} | ||
} | ||
f := instanceData.Get(metric.name) |
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.
when err != nil, is metr valid?
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.
metr is not added to matrix if there is an error. In current case, we check for duplicates.
No description provided.