def test_stores_node_level_metrics_on_attach(self, cpu_model, physical_cpu_cores, logical_cpu_cores, os_version, os_name, metrics_store_add_meta_info): cpu_model.return_value = "Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz" physical_cpu_cores.return_value = 4 logical_cpu_cores.return_value = 8 os_version.return_value = "4.2.0-18-generic" os_name.return_value = "Linux" cfg = self.create_config() metrics_store = metrics.EsMetricsStore(cfg) node = cluster.Node(None, "io", "rally0", None) env_device = telemetry.EnvironmentInfo(cfg, metrics_store) env_device.attach_to_node(node) calls = [ mock.call(metrics.MetaInfoScope.node, "rally0", "os_name", "Linux"), mock.call(metrics.MetaInfoScope.node, "rally0", "os_version", "4.2.0-18-generic"), mock.call(metrics.MetaInfoScope.node, "rally0", "cpu_logical_cores", 8), mock.call(metrics.MetaInfoScope.node, "rally0", "cpu_physical_cores", 4), mock.call(metrics.MetaInfoScope.node, "rally0", "cpu_model", "Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz"), mock.call(metrics.MetaInfoScope.node, "rally0", "node_name", "rally0"), mock.call(metrics.MetaInfoScope.node, "rally0", "host_name", "io"), ] metrics_store_add_meta_info.assert_has_calls(calls)
def test_stores_cluster_level_metrics_on_attach( self, cluster_info, metrics_store_add_meta_info): cluster_info.return_value = {"version": {"build_hash": "abc123"}} cfg = self.create_config() metrics_store = metrics.EsMetricsStore(cfg) env_device = telemetry.EnvironmentInfo(cfg, metrics_store) t = telemetry.Telemetry(cfg, metrics_store, devices=[env_device]) t.attach_to_cluster( cluster.Cluster([{ "host": "::1:9200" }], [], metrics_store, t, client_factory_class=MockClientFactory)) metrics_store_add_meta_info.assert_called_with( metrics.MetaInfoScope.cluster, None, "source_revision", "abc123")
def test_stores_cluster_level_metrics_on_attach( self, nodes_info, cluster_info, metrics_store_add_meta_info): nodes_info.return_value = { "nodes": { "FCFjozkeTiOpN-SI88YEcg": { "name": "rally0", "host": "127.0.0.1", "os": { "name": "Mac OS X", "version": "10.11.4", "available_processors": 8 }, "jvm": { "version": "1.8.0_74", "vm_vendor": "Oracle Corporation" } } } } cluster_info.return_value = {"version": {"build_hash": "abc123"}} cfg = self.create_config() metrics_store = metrics.EsMetricsStore(cfg) env_device = telemetry.EnvironmentInfo(cfg, metrics_store) t = telemetry.Telemetry(cfg, metrics_store, devices=[env_device]) t.attach_to_cluster( cluster.Cluster([{ "host": "::1:9200" }], [], {}, metrics_store, t, client_factory_class=MockClientFactory)) calls = [ mock.call(metrics.MetaInfoScope.cluster, None, "source_revision", "abc123"), mock.call(metrics.MetaInfoScope.node, "rally0", "jvm_vendor", "Oracle Corporation"), mock.call(metrics.MetaInfoScope.node, "rally0", "jvm_version", "1.8.0_74") ] metrics_store_add_meta_info.assert_has_calls(calls)