-
Notifications
You must be signed in to change notification settings - Fork 313
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
Pick up data streams in disk-usage-stats telemetry #1455
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -4150,24 +4150,31 @@ def test_logs_warning_on_missing_stats(self, metrics_put_value_cluster_level, me | |
|
||
class TestDiskUsageStats: | ||
@mock.patch("elasticsearch.Elasticsearch") | ||
def test_uses_indices_param_by_default(self, es): | ||
def test_uses_indices_and_data_streams_by_default(self, es): | ||
cfg = create_config() | ||
metrics_store = metrics.EsMetricsStore(cfg) | ||
tc = TransportClient(response={"_shards": {"failed": 0}}) | ||
es = Client(transport_client=tc) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo", "bar"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo", "bar"], data_stream_names=["baz", "bork"]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
assert tc.args == [("POST", "/foo/_disk_usage"), ("POST", "/bar/_disk_usage")] | ||
assert tc.args == [ | ||
("POST", "/foo/_disk_usage"), | ||
("POST", "/bar/_disk_usage"), | ||
("POST", "/baz/_disk_usage"), | ||
("POST", "/bork/_disk_usage"), | ||
] | ||
|
||
@mock.patch("elasticsearch.Elasticsearch") | ||
def test_uses_indices_param_if_specified(self, es): | ||
cfg = create_config() | ||
metrics_store = metrics.EsMetricsStore(cfg) | ||
tc = TransportClient(response={"_shards": {"failed": 0}}) | ||
es = Client(transport_client=tc) | ||
device = telemetry.DiskUsageStats({"disk-usage-stats-indices": "foo,bar"}, es, metrics_store, ["baz"]) | ||
device = telemetry.DiskUsageStats( | ||
{"disk-usage-stats-indices": "foo,bar"}, es, metrics_store, index_names=["baz"], data_stream_names=["not_this"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise would be good here to only use index_names or data_stream_names |
||
) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
|
@@ -4183,13 +4190,29 @@ def test_error_on_retrieval_does_not_store_metrics(self, metrics_store_cluster_l | |
error=elasticsearch.RequestError, | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
with pytest.raises(exceptions.RallyError): | ||
t.on_benchmark_stop() | ||
assert metrics_store_cluster_level.call_count == 0 | ||
|
||
@mock.patch("esrally.metrics.EsMetricsStore.put_value_cluster_level") | ||
def test_no_indices_fails(self, metrics_store_cluster_level): | ||
cfg = create_config() | ||
metrics_store = metrics.EsMetricsStore(cfg) | ||
es = Client( | ||
transport_client=TransportClient( | ||
force_error=True, | ||
error=elasticsearch.RequestError, | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=[], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
with pytest.raises(exceptions.RallyError): | ||
t.on_benchmark_start() | ||
assert metrics_store_cluster_level.call_count == 0 | ||
|
||
@mock.patch("esrally.metrics.EsMetricsStore.put_value_cluster_level") | ||
def test_missing_all_fails(self, metrics_store_cluster_level): | ||
cfg = create_config() | ||
|
@@ -4200,7 +4223,7 @@ def test_missing_all_fails(self, metrics_store_cluster_level): | |
error=elasticsearch.RequestError, | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo", "bar"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo", "bar"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
with pytest.raises(exceptions.RallyError): | ||
|
@@ -4245,7 +4268,7 @@ def perform_request(self, *args, **kwargs): | |
) | ||
|
||
es = Client(transport_client=TwoTransportClients(not_found_transport_client, successful_client)) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo", "bar"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo", "bar"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
|
@@ -4262,7 +4285,7 @@ def test_successful_shards(self, metrics_store_cluster_level): | |
} | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
|
@@ -4279,7 +4302,7 @@ def test_unsuccessful_shards(self, metrics_store_cluster_level): | |
} | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
with pytest.raises(exceptions.RallyError): | ||
|
@@ -4305,7 +4328,7 @@ def test_source(self, metrics_store_cluster_level): | |
} | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
|
@@ -4334,7 +4357,7 @@ def test_id(self, metrics_store_cluster_level): | |
} | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
|
@@ -4371,7 +4394,7 @@ def test_empty_field(self, metrics_store_cluster_level): | |
} | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({"disk-usage-stats-indices": "foo"}, es, metrics_store, ["foo"]) | ||
device = telemetry.DiskUsageStats({"disk-usage-stats-indices": "foo"}, es, metrics_store, index_names=["foo"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
|
@@ -4399,7 +4422,7 @@ def test_number(self, metrics_store_cluster_level): | |
} | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
|
@@ -4429,7 +4452,7 @@ def test_keyword(self, metrics_store_cluster_level): | |
} | ||
) | ||
) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, ["foo"]) | ||
device = telemetry.DiskUsageStats({}, es, metrics_store, index_names=["foo"], data_stream_names=[]) | ||
t = telemetry.Telemetry(enabled_devices=[device.command], devices=[device]) | ||
t.on_benchmark_start() | ||
t.on_benchmark_stop() | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you split this case, please? Per the docs, we can only use one or the other