-
Notifications
You must be signed in to change notification settings - Fork 814
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fluentd] add type tag support to fluentd check
Now we can use either fluentd plugin_id or type as a tag. [yann@datadoghq.com] rebase current work to solve merge conflicts
- Loading branch information
1 parent
837d926
commit 1496556
Showing
4 changed files
with
134 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# stdlib | ||
import unittest | ||
|
||
# project | ||
from tests.checks.common import AgentCheckTest | ||
|
||
|
||
class TestEtcd(AgentCheckTest): | ||
CHECK_NAME = "etcd" | ||
|
||
def __init__(self, *args, **kwargs): | ||
AgentCheckTest.__init__(self, *args, **kwargs) | ||
self.config = {"instances": [{"url": "http://localhost:4001"}]} | ||
|
||
# FIXME: not really an integration test, should be pretty easy | ||
# to spin up a cluster to test that. | ||
def test_followers(self): | ||
mock = { | ||
"followers": { | ||
"etcd-node1": { | ||
"counts": { | ||
"fail": 1212, | ||
"success": 4163176 | ||
}, | ||
"latency": { | ||
"average": 2.7206299430775007, | ||
"current": 1.486487, | ||
"maximum": 2018.410279, | ||
"minimum": 1.011763, | ||
"standardDeviation": 6.246990702203536 | ||
} | ||
}, | ||
"etcd-node3": { | ||
"counts": { | ||
"fail": 1378, | ||
"success": 4164598 | ||
}, | ||
"latency": { | ||
"average": 2.707100125761001, | ||
"current": 1.666258, | ||
"maximum": 1409.054765, | ||
"minimum": 0.998415, | ||
"standardDeviation": 5.910089773061448 | ||
} | ||
} | ||
}, | ||
"leader": "etcd-node2" | ||
} | ||
|
||
mocks = { | ||
'_get_leader_metrics': lambda u, t: mock | ||
} | ||
|
||
self.run_check_twice(self.config, mocks=mocks) | ||
|
||
common_leader_tags = ['url:http://localhost:4001', 'etcd_state:leader'] | ||
follower_tags = [ | ||
common_leader_tags[:] + ['follower:etcd-node1'], | ||
common_leader_tags[:] + ['follower:etcd-node3'], | ||
] | ||
|
||
for fol_tags in follower_tags: | ||
self.assertMetric('etcd.leader.counts.fail', count=1, tags=fol_tags) | ||
self.assertMetric('etcd.leader.counts.success', count=1, tags=fol_tags) | ||
self.assertMetric('etcd.leader.latency.avg', count=1, tags=fol_tags) | ||
self.assertMetric('etcd.leader.latency.min', count=1, tags=fol_tags) | ||
self.assertMetric('etcd.leader.latency.max', count=1, tags=fol_tags) | ||
self.assertMetric('etcd.leader.latency.stddev', count=1, tags=fol_tags) | ||
self.assertMetric('etcd.leader.latency.current', count=1, tags=fol_tags) |