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

[etcd] service check & test #1379

Merged
merged 4 commits into from
Feb 19, 2015
Merged

[etcd] service check & test #1379

merged 4 commits into from
Feb 19, 2015

Conversation

degemer
Copy link
Member

@degemer degemer commented Feb 18, 2015

  • send a service check on success and on failure (previously only on failure)
  • add a basic test copied from fluentd one

@@ -112,4 +112,5 @@ def get_json(self, url, timeout):
tags = ["url:{}".format(url)])
return None

self.service_check(self.SERVICE_CHECK_NAME, AgentCheck.OK, tags=["url:{}".format(url)])
Copy link

Choose a reason for hiding this comment

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

Watchout, you'll end up sending two statuses per iteration, one for get_self_metrics and one for get_store_metrics.

Can you ensure to only send one status per iteration per instance ?

Copy link
Member

Choose a reason for hiding this comment

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

You need to use {0} otherwise this is not python 2.6 comptible

Copy link
Member Author

Choose a reason for hiding this comment

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

@remh: indeed, fixed now.
@LeoCavaille: also fixed. (and thanks for the explanation)

@degemer degemer force-pushed the quentin/etcd-service_check branch 2 times, most recently from eaccce4 to 929d73b Compare February 18, 2015 23:48
@degemer
Copy link
Member Author

degemer commented Feb 18, 2015

Finally send one and only one service_checks, thanks to @remh .
@LeoCavaille I tried to use AgentCheckTest, not sure it's correct. At least it's working locally!

And not only CRITICAL when unable to get metrics.
This is needed as the service check won't appear on the monitor screen
otherwise.
Fix python2.6 compatibility issue: "{}".format()
@degemer degemer force-pushed the quentin/etcd-service_check branch from 929d73b to 546668b Compare February 19, 2015 00:01
end

task :cleanup => ['ci:common:cleanup'] do
sh %(rm -rf $VOLATILE_DIR/etcd* || echo 'etcd not running')
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to clean up VOLATILE_DIR it's already taken care of by the common cleanup task.
However, you might want to kill the etcd daemon you launched in the before_script stage, either by using a pidfile if you can have one or by using an appropriate kill command.

Copied from the apache/riackcs tests, using the AgentCheckTest.
@degemer degemer force-pushed the quentin/etcd-service_check branch from 546668b to 3f537dc Compare February 19, 2015 16:49
Add assertServiceCheck (same principle than assertMetrics) in
AgentCheckTest. If service_checks does not exist, retrieve latest data
from AgentCheckTest.check.
@degemer degemer force-pushed the quentin/etcd-service_check branch from 9f6fa62 to ad405a2 Compare February 19, 2015 18:55
Because of the changes in AgentCheckTest, old test was failing (because
of the new error catch and reraise in run_check).
It now uses assertServiceCheck.
@LeoCavaille
Copy link
Member

LGTM 👍

@LeoCavaille LeoCavaille added this to the 5.2.1 milestone Feb 19, 2015
LeoCavaille added a commit that referenced this pull request Feb 19, 2015
@LeoCavaille LeoCavaille merged commit 34ccae0 into master Feb 19, 2015
@LeoCavaille LeoCavaille deleted the quentin/etcd-service_check branch February 19, 2015 20:42
@coveralls
Copy link

coveralls commented Sep 22, 2016

Coverage Status

Changes Unknown when pulling af75929 on quentin/etcd-service_check into * on master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling af75929 on quentin/etcd-service_check into * on master*.

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.

4 participants