Module Import alias TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body Assign NameStore NameLoad ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam defaults body TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Assign NameStore Lambda arguments args defaults CompareIsNot NameLoad NameLoad Return Call NameLoad NameLoad NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Str Dict Str Num Assign AttributeStore NameLoad attr Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list NameLoad Call NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr NameLoad decorator_list NameLoad Call NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr NameLoad decorator_list NameLoad Call NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Call NameLoad ListLoad Str Str Str Str Str Str Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list NameLoad Call AttributeLoad NameLoad attr NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list NameLoad Call AttributeLoad NameLoad attr NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Dict Str Str Str Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list NameLoad Call AttributeLoad NameLoad attr NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Assign NameStore Dict Str Str Str Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Call NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list NameLoad Call AttributeLoad NameLoad attr NameLoad Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list NameLoad Call AttributeLoad NameLoad attr NameLoad Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr ListLoad Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Str Num Num Num Num Num Num Num Num Num Num Num Num Num Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list NameLoad Call NameLoad Str Call AttributeLoad NameLoad attr NameLoad Str decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr
N/A N/A urllib2 N/A N/A xml.etree ElementTree N/A N/A N/A ImportError N/A N/A ElementTree None test CollectorTestCase test get_collector_config test run_only test unittest mock patch diamond.collector Collector kafkastat KafkaCollector run_only_if_ElementTree_is_available N/A N/A func N/A N/A N/A N/A xml.etree ElementTree N/A N/A N/A ImportError N/A N/A ElementTree None N/A pred N/A N/A N/A N/A N/A ElementTree None N/A N/A run_only func pred N/A TestKafkaCollector N/A CollectorTestCase N/A setUp N/A N/A self N/A N/A N/A config N/A get_collector_config KafkaCollector N/A interval 10 N/A N/A self collector N/A KafkaCollector config None N/A _get_xml_fixture N/A N/A self name N/A N/A N/A fixture N/A N/A self getFixture name N/A N/A N/A ElementTree fromstring N/A N/A fixture getvalue N/A test_import N/A N/A self N/A N/A N/A N/A N/A self assertTrue KafkaCollector N/A test_get N/A N/A self urlopen_mock N/A N/A N/A N/A urlopen_mock return_value N/A N/A self getFixture empty.xml N/A result N/A N/A N/A self collector _get /path N/A result_string N/A N/A ElementTree tostring result N/A N/A N/A self assertEqual result_string <Server /> N/A run_only_if_ElementTree_is_available N/A patch urllib2.urlopen test_get_httperror N/A N/A self urlopen_mock N/A N/A N/A N/A urlopen_mock side_effect N/A N/A urllib2 URLError BOOM N/A result N/A N/A N/A self collector _get /path N/A N/A N/A self assertFalse result N/A run_only_if_ElementTree_is_available N/A patch urllib2.urlopen test_get_bad_xml N/A N/A self urlopen_mock N/A N/A N/A N/A urlopen_mock return_value N/A N/A self getFixture bad.xml N/A result N/A N/A N/A self collector _get /path N/A N/A N/A self assertFalse result N/A run_only_if_ElementTree_is_available N/A patch urllib2.urlopen test_get_mbeans N/A N/A self get_mock N/A N/A N/A N/A get_mock return_value N/A N/A self _get_xml_fixture serverbydomain.xml N/A expected_names N/A set N/A kafka:type=kafka.BrokerAllTopicStat kafka:type=kafka.BrokerTopicStat.mytopic kafka:type=kafka.LogFlushStats kafka:type=kafka.SocketServerStats kafka:type=kafka.logs.mytopic-0 kafka:type=kafka.logs.mytopic-1 kafka:type=kafka.Log4jController N/A found_beans N/A N/A N/A self collector get_mbeans * N/A N/A N/A self assertEqual found_beans expected_names N/A run_only_if_ElementTree_is_available N/A N/A patch object KafkaCollector _get test_get_mbeans_get_fail N/A N/A self get_mock N/A N/A N/A N/A get_mock return_value None N/A found_beans N/A N/A N/A self collector get_mbeans * N/A N/A N/A self assertEqual found_beans None N/A run_only_if_ElementTree_is_available N/A N/A patch object KafkaCollector _get test_query_mbean N/A N/A self get_mock N/A N/A N/A N/A get_mock return_value N/A N/A self _get_xml_fixture mbean.xml N/A expected_metrics N/A kafka.logs.mytopic-1.CurrentOffset kafka.logs.mytopic-1.NumAppendedMessages kafka.logs.mytopic-1.NumberOfSegments kafka.logs.mytopic-1.Size N/A long 213500615 N/A long 224634137 N/A int 94 N/A long 50143615339 N/A metrics N/A N/A N/A self collector query_mbean kafka:type=kafka.logs.mytopic-1 N/A N/A N/A self assertEqual metrics expected_metrics N/A run_only_if_ElementTree_is_available N/A N/A patch object KafkaCollector _get test_query_mbean_with_prefix N/A N/A self get_mock N/A N/A N/A N/A get_mock return_value N/A N/A self _get_xml_fixture mbean.xml N/A expected_metrics N/A some.prefix.CurrentOffset some.prefix.NumAppendedMessages some.prefix.NumberOfSegments some.prefix.Size N/A long 213500615 N/A long 224634137 N/A int 94 N/A long 50143615339 N/A metrics N/A N/A N/A self collector query_mbean kafka:type=kafka.logs.mytopic-0 some.prefix N/A N/A N/A self assertEqual metrics expected_metrics N/A run_only_if_ElementTree_is_available N/A N/A patch object KafkaCollector _get test_query_mbean_fail N/A N/A self get_mock N/A N/A N/A N/A get_mock return_value None N/A metrics N/A N/A N/A self collector query_mbean kafka:type=kafka.logs.mytopic-0 N/A N/A N/A self assertEqual metrics None N/A run_only_if_ElementTree_is_available N/A N/A patch object KafkaCollector _get test N/A N/A self publish_mock urlopen_mock N/A N/A N/A N/A urlopen_mock side_effect N/A N/A N/A self getFixture serverbydomain_logs_only.xml N/A N/A self getFixture serverbydomain_gc.xml N/A N/A self getFixture serverbydomain_threading.xml N/A N/A self getFixture gc_scavenge.xml N/A N/A self getFixture gc_marksweep.xml N/A N/A self getFixture mbean.xml N/A N/A self getFixture threading.xml N/A N/A N/A N/A self collector collect N/A expected_metrics N/A kafka.logs.mytopic-1.CurrentOffset kafka.logs.mytopic-1.NumAppendedMessages kafka.logs.mytopic-1.NumberOfSegments kafka.logs.mytopic-1.Size Threading.CurrentThreadCpuTime Threading.CurrentThreadUserTime Threading.DaemonThreadCount Threading.PeakThreadCount Threading.ThreadCount Threading.TotalStartedThreadCount GarbageCollector.PSScavenge.CollectionCount GarbageCollector.PSScavenge.CollectionTime GarbageCollector.PSMarkSweep.CollectionCount GarbageCollector.PSMarkSweep.CollectionTime 213500615 224634137 94 50143615339 0 0 58 90 89 228 37577 112293 2 160 N/A N/A N/A self assertPublishedMany publish_mock expected_metrics N/A run_only_if_ElementTree_is_available N/A patch urllib2.urlopen N/A N/A patch object Collector publish N/A N/A N/A __name__ __main__ N/A N/A N/A N/A unittest main