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

[jmxfetch] move status & exit files to '/run' #1679

Merged
merged 1 commit into from Jun 11, 2015

Conversation

yannmh
Copy link
Member

@yannmh yannmh commented Jun 10, 2015

Use '/run' for JMXFetch status & exit files instead of '/tmp/'. Move more functions to '/utils'.

@yannmh yannmh added this to the 5.4.0 milestone Jun 10, 2015
@yannmh yannmh force-pushed the yann/move-jmxfiles-to-utils branch 3 times, most recently from 4d82402 to ced2a19 Compare June 10, 2015 21:06
Removes JMX status files
"""
try:
os.remove(os.path.join(cls._get_dir(), cls._STATUS_FILE))
Copy link
Member

Choose a reason for hiding this comment

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

Can you guarantee that if there is no cls._STATUS_FILE there won't be cls._PYTHON_STATUS_FILE ? Otherwise cls._PYTHON_STATUS_FILE may sometimes not be deleted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, I fixed that

@degemer
Copy link
Member

degemer commented Jun 10, 2015

Just a small comment, it looks way more beauteous ! 🎉

@yannmh yannmh force-pushed the yann/move-jmxfiles-to-utils branch from ced2a19 to 4980004 Compare June 10, 2015 21:54
log = logging.getLogger(__name__)


class JMXFiles(object):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't get the point of writing a class with only class methods inside (at least not in Python :) ). Couldn't there just be static methods. Then if you import it this way : from utils import jmxfiles you could just call jmxfiles.get_status_file_path(). Wouldn't it make more sense.

Copy link
Member

Choose a reason for hiding this comment

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

The only point that could be taken here, is that bundling the methods in a class is easier for imports and there is much less risk to override an existing method from another module.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yesah but if you use from utils import jmxfiles there can't be a conflict with any other module defining a method with the same name. Am I wrong ?

Copy link
Member

Choose a reason for hiding this comment

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

Indeed but you import everything class in that module (here I agree there is only one so it's ok).

Copy link
Contributor

Choose a reason for hiding this comment

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

Under the hood, it works fine both ways anyway. I was under the influence of this video https://www.youtube.com/watch?v=o9pEzgHorH0 I watched a couple of weeks ago when I made that comment (same kind of ironic tone as the "Linux Sucks" conferences), sorry about that :)

@elafarge
Copy link
Contributor

Just a slight mistake, as soon as fixed we should bee GTM :)

Use '/run' for JMXFetch status & exit files instead of '/tmp/'. Move
more functions to '/utils'.
@elafarge elafarge force-pushed the yann/move-jmxfiles-to-utils branch from 4980004 to 11f8974 Compare June 11, 2015 15:59
elafarge pushed a commit that referenced this pull request Jun 11, 2015
[jmxfetch] move status & exit files to '/run'
@elafarge elafarge merged commit e974398 into master Jun 11, 2015
@yannmh yannmh deleted the yann/move-jmxfiles-to-utils branch June 11, 2015 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants