sensu-plugins / sensu-plugins-docker

This plugin provides native Docker instrumentation for monitoring and metrics collection, including: container status, container number, and container metrics via `docker ps`.
http://sensu-plugins.io
MIT License
35 stars 57 forks source link

New class to call docker api, check-container-logs.rb features added #58

Closed rockandska closed 6 years ago

rockandska commented 6 years ago

Pull Request Checklist

General

Purpose

Known Compatibility Issues

Personal comments

First ruby dev First pull request Sorry if it is not done the way it should be, feel free to guide me if i need to correct some things.

Best regards

majormoses commented 6 years ago

Thanks for your contribution to Sensu plugins! Without people like you submitting PRs we couldn't run the project. I will review it shortly.

majormoses commented 6 years ago

It looks like some of your changes were made for a newer version of rubocop than what we are testing with. You should either update the gemspec for the dependency or revert those changes to fix CI.

majormoses commented 6 years ago

Hmm I wonder about the performance implications of analyzing all containers I do not think this is a good idea, if we do we should minimally warn the user to be careful to avoid not bricking sensu.

majormoses commented 6 years ago

for something this we definitely need a test a testing artifact

eheydrick commented 6 years ago

Can you rebase to resolve the conflict with sensu-plugins-docker.gemspec. Thanks again for contributing to the project @rockandska!

rockandska commented 6 years ago

Hi,

majormoses commented 6 years ago

The default docker host is not 127.0.0.1:2375 anymore this makes it a breaking change. Any time you modify the default options like this it will be a breaking change as it no longer did what it was supposed to do before upgrading. If the user wants to keep the old behavior they need to update their check definition. If it breaks less than 1% of users it is still a breaking change.

Regarding testing artifacts:

rockandska commented 6 years ago

I rebase my branch , and made some cleanup too. Not sure to have done all the things you would like to see implemented like the warning message ( @majormoses : didn't really understand if you would like juste a warning message show up or trigger the sensu warning)

I tried to write a little artifact test script too, i think it is clear and add more test is easy. You could find it here

The default docker uri was revert to don't introduce breaking changes at this point.

PS: someone already complain about it in issue, but it is really sad than the options / default are not the same for all scripts and will be great if in the next major version it will be standardized.

Feel free to ask me to undo or update this PR if there is some changes that need to be done.

Regards,

majormoses commented 6 years ago

I was fine with there being a breaking change as long as it is called out in changelog appropriately and versioned (by maintainers after accepting contribution prior to release) to ensure it does not break responsible users who pin to at least the major and read the changelog before upgrading. Also it looks like there is an unreleased breaking change. I do think there is a lot of value in making all the checks/metrics the same and this seems like a reasonable time to do it. Up to you I can either accept it as is or we can modify the defaults.

rockandska commented 6 years ago

Ok for the breaking changes. So, if it is a perfect moment to do it, let me a few days more please and i will try to push new commits to :

If you have some comments about the options to be standardized or default docker host, feel free.

Thanks

majormoses commented 6 years ago

I will review this when I have some time(hopefully tonight), looks like you need to rebase.

rockandska commented 6 years ago

Rebase done. :smile: Thanks

rockandska commented 6 years ago

I've updated my test_artifact to reflect the changes in options and test 3 type of container ( running, offline, non_exist ). I didn't pay attention earlier, but it seems that bin/check-container-logs.rb was previously returning an 'OK' even if the container didn't exist, now it return a critical.

PS: sorry for this chaotic PR...

majormoses commented 6 years ago

@rockandska no worries, you are what makes the open source world go round. Can you call that out in the CHANGELOG as a Breaking Change?

majormoses commented 6 years ago

Sorry this fell off my radar, let look at the comments and see if we are ready to rebase and merge.

majormoses commented 6 years ago

@rockandska if I can get you to rebase one more time and get something in the readme about the docker host precedence I am :+1: on merging and releasing this.

Apologies again for letting this fall off my radar I had some medical complications around that time and I am still playing catch up on all the old PRs I reviewed.

rockandska commented 6 years ago

Apologies again for letting this fall off my radar I had some medical complications around that time and I am still playing catch up on all the old PRs I reviewed.

Please, don't apologize @majormoses , your health before everything else and i wish you than everything is back to normal :)

I've done the rebase and add a description to the README, hope i've done everything that was necessary.

Regards,

majormoses commented 6 years ago

released: https://rubygems.org/gems/sensu-plugins-docker/versions/3.0.0

majormoses commented 6 years ago

Thanks for all your great work