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

Refs #28506 - fixed telemetry boot require #7271

Merged
merged 1 commit into from
Dec 19, 2019

Conversation

lzap
Copy link
Member

@lzap lzap commented Dec 18, 2019

When bundler group is not active, this would fail.

@theforeman-bot
Copy link
Member

Issues: #28506

def initialize(opts = {})
require 'prometheus/client'
require 'prometheus/client/data_stores/direct_file_store'
# Set multiprocess-friendly data store
FileUtils.mkdir_p(PROMETHEUS_STORE_DIR)
Copy link
Member

Choose a reason for hiding this comment

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

Instead of a global, should this be store_dir = opts[:store_dir] || File.join(Rails.root, 'tmp', 'prometheus')?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't like introducing new option, then setting, then installer. Let's be opinionated here - these files will rarely be larger than few MBs so Rails cache is an ideal place. You can lost them and it gets regenerated on restart, no big deal too.

Copy link
Member

Choose a reason for hiding this comment

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

So this is a parameter to the method, which also allows unit testing. I wasn't calling for it to be configurable at the setting/installer level.

Copy link
Member

Choose a reason for hiding this comment

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

I agree the constant is not necessary as it doesn't need to be this exact dir, it's only a sane default, so why not to have the method more robust. I'm ok with this as well though.

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

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

I'm for getting it in, though the @ekohl's suggestion makes sense. @lzap if you're against though, I'm for merging - not worth a long discussion I guess.

def initialize(opts = {})
require 'prometheus/client'
require 'prometheus/client/data_stores/direct_file_store'
# Set multiprocess-friendly data store
FileUtils.mkdir_p(PROMETHEUS_STORE_DIR)
Copy link
Member

Choose a reason for hiding this comment

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

I agree the constant is not necessary as it doesn't need to be this exact dir, it's only a sane default, so why not to have the method more robust. I'm ok with this as well though.

@tbrisker
Copy link
Member

Thanks @lzap and everyone. I'll merge this now, if any of you feel like modifying the function feel free to open a follow up PR.

@tbrisker tbrisker merged commit 6ecab45 into theforeman:develop Dec 19, 2019
@tbrisker
Copy link
Member

1.24 - e68fc9e

@lzap lzap deleted the telemetry-boot-fix-28506 branch January 6, 2020 11:58
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.

5 participants