Skip to content
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

Merged
merged 5 commits into from
Jan 18, 2022
Merged

Conversation

rahulguptajss
Copy link
Contributor

No description provided.

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 {
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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 {
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@cla-bot cla-bot bot added the cla-signed label Jan 18, 2022
Msg("NewMetricFloat64")
}
}
f := instanceData.Get(metric.name)
Copy link
Collaborator

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)
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@rahulguptajss rahulguptajss merged commit 7bd1f0c into main Jan 18, 2022
@rahulguptajss rahulguptajss deleted the rg2-rest-infra-code-enhance branch January 18, 2022 15:56
@rahulguptajss rahulguptajss linked an issue Jan 20, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add REST support to Harvest
3 participants