Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Check error before wrapping #644

Merged
merged 1 commit into from Jul 2, 2019

Conversation

codesome
Copy link
Contributor

@codesome codesome commented Jul 2, 2019

This is a broken down piece of #627

During compaction, Postings() and Series() functions are called a lot of times. Checking error before wrapping saves a lot of allocs apparently.

@codesome
Copy link
Contributor Author

codesome commented Jul 2, 2019

I would not like any PRs linked with #627 to go in the next release (want them all to go in together in a release, just a personal preferance). So don't merge this yet though it's trivial!

Copy link
Contributor

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

I would remove those comments. Non nil err wrapping is a good practice overall and I would rather mention it in README in some small "Style guide" section or even on Prometheus side. We should do that everywhere - never wrap a nil error.

Can we add this to README then as a start?

"Wrap errors only on error as they increase cost some performance...."

@bwplotka
Copy link
Contributor

bwplotka commented Jul 2, 2019

Otherwise we will need to add this comment on every error TBH for consistency (:

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Copy link
Contributor

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks @codesome 👍

@codesome
Copy link
Contributor Author

codesome commented Jul 2, 2019

I have removed the comment. And I think Style Guide would go in prometheus/prometheus, specifically this file https://github.com/prometheus/prometheus/blob/master/CONTRIBUTING.md. Some sections needs to start there to add specific stuff, I will make a point to add it there.

@bwplotka bwplotka merged commit dc657df into prometheus-junkyard:master Jul 2, 2019
@codesome
Copy link
Contributor Author

codesome commented Jul 2, 2019

Oops #644 (comment) , but I guess it's fine 😅

@bwplotka
Copy link
Contributor

bwplotka commented Jul 2, 2019

🤦‍♂️

This one is trival though. Let's wait with others. ;p

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants