Skip to content

Commit

Permalink
tests: fix integration instrumentation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanFM committed Nov 11, 2022
1 parent bfed8c4 commit 394a361
Showing 1 changed file with 19 additions and 42 deletions.
61 changes: 19 additions & 42 deletions tests/integration/instrumentation/test_flow_instrumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ def test_flow_metrics(
prometheus_client, 'jina_sending_request_seconds'
)
assert len(sending_requests_seconds_metrics) > 0
assert sending_requests_seconds_exported_jobs.issubset(
['gateway/rep-0', 'executor0/head']
)
assert sending_requests_seconds_exported_jobs == {'gateway/rep-0', 'executor0/head'}

(
receiving_request_seconds_metrics,
Expand All @@ -193,14 +191,12 @@ def test_flow_metrics(
prometheus_client, 'jina_receiving_request_seconds'
)
assert len(receiving_request_seconds_metrics) > 0
assert receiving_request_seconds_exported_jobs.issubset(
[
assert receiving_request_seconds_exported_jobs == {
'gateway/rep-0',
'executor0/head',
'executor0/shard-0/rep-0',
'executor0/shard-1/rep-0',
]
)
}

(
received_response_bytes_metrics,
Expand All @@ -209,9 +205,7 @@ def test_flow_metrics(
prometheus_client, 'jina_received_response_bytes'
)
assert len(received_response_bytes_metrics) > 0
assert received_response_bytes_exported_jobs.issubset(
['gateway/rep-0', 'executor0/head']
)
assert received_response_bytes_exported_jobs == {'gateway/rep-0', 'executor0/head'}

(
sent_requests_bytes_metrics,
Expand All @@ -220,9 +214,7 @@ def test_flow_metrics(
prometheus_client, 'jina_sent_request_bytes'
)
assert len(sent_requests_bytes_metrics) > 0
assert sent_requests_bytes_exported_jobs.issubset(
['gateway/rep-0', 'executor0/head']
)
assert sent_requests_bytes_exported_jobs == {'gateway/rep-0', 'executor0/head'}

(
sent_response_bytes_metrics,
Expand All @@ -231,13 +223,12 @@ def test_flow_metrics(
prometheus_client, 'jina_sent_response_bytes'
)
assert len(sent_response_bytes_metrics) > 0
assert sent_response_bytes_exported_jobs.issubset(
[
assert sent_response_bytes_exported_jobs == {
'gateway/rep-0',
'executor0/shard-0/rep-0',
'executor0/shard-1/rep-0',
]
)
'executor0/head'
}

(
number_of_pending_requests_metrics,
Expand All @@ -246,21 +237,19 @@ def test_flow_metrics(
prometheus_client, 'jina_number_of_pending_requests'
)
assert len(number_of_pending_requests_metrics) > 0
assert number_of_pending_requests_exported_jobs.issubset(['gateway/rep-0'])
assert number_of_pending_requests_exported_jobs == {'gateway/rep-0', 'executor0/head'}

(
failed_requests_metrics,
failed_requests_exported_jobs,
) = get_metrics_and_exported_jobs_by_name(prometheus_client, 'jina_failed_requests')
assert len(failed_requests_metrics) > 0
assert failed_requests_exported_jobs.issubset(
[
assert failed_requests_exported_jobs == {
'gateway/rep-0',
'executor0/head',
'executor0/shard-0/rep-0',
'executor0/shard-1/rep-0',
]
)
}

(
successful_requests_metrics,
Expand All @@ -269,9 +258,7 @@ def test_flow_metrics(
prometheus_client, 'jina_successful_requests'
)
assert len(successful_requests_metrics) > 0
assert successful_requests_exported_jobs.issubset(
['gateway/rep-0', 'executor0/shard-0/rep-0', 'executor0/shard-1/rep-0']
)
assert successful_requests_exported_jobs == {'gateway/rep-0', 'executor0/shard-0/rep-0', 'executor0/shard-1/rep-0', 'executor0/head'}

(
received_request_bytes_metrics,
Expand All @@ -280,9 +267,7 @@ def test_flow_metrics(
prometheus_client, 'jina_received_request_bytes'
)
assert len(received_request_bytes_metrics) > 0
assert received_request_bytes_exported_jobs.issubset(
['gateway/rep-0', 'executor0/shard-0/rep-0', 'executor0/shard-1/rep-0']
)
assert received_request_bytes_exported_jobs == {'gateway/rep-0', 'executor0/shard-0/rep-0', 'executor0/shard-1/rep-0', 'executor0/head'}

(
process_requests_seconds_metrics,
Expand All @@ -291,9 +276,7 @@ def test_flow_metrics(
prometheus_client, 'jina_process_request_seconds'
)
assert len(process_requests_seconds_metrics) > 0
assert process_requests_seconds_exported_jobs.issubset(
['executor0/shard-0/rep-0', 'executor0/shard-1/rep-0']
)
assert process_requests_seconds_exported_jobs == {'executor0/shard-0/rep-0', 'executor0/shard-1/rep-0'}

# filter by attributes/labels
(
Expand All @@ -305,9 +288,7 @@ def test_flow_metrics(
{'executor_endpoint': '/search'},
)
assert len(process_requests_seconds_search_endpoint) > 0
assert process_requests_seconds_search_endpoint_exported_jobs.issubset(
['executor0/shard-0/rep-0', 'executor0/shard-1/rep-0']
)
assert process_requests_seconds_search_endpoint_exported_jobs == {'executor0/shard-0/rep-0', 'executor0/shard-1/rep-0'}

(
process_requests_seconds_executor,
Expand All @@ -318,9 +299,7 @@ def test_flow_metrics(
{'executor': 'ExecutorFailureWithTracing'},
)
assert len(process_requests_seconds_executor) > 0
assert process_requests_seconds_executor_exported_jobs == set(
{'executor0/shard-0/rep-0', 'executor0/shard-1/rep-0'}
)
assert process_requests_seconds_executor_exported_jobs == {'executor0/shard-0/rep-0', 'executor0/shard-1/rep-0'}

(
process_requests_seconds_runtime,
Expand All @@ -331,9 +310,7 @@ def test_flow_metrics(
{'runtime_name': 'executor0/shard-0/rep-0'},
)
assert len(process_requests_seconds_runtime) > 0
assert process_requests_seconds_runtime_exported_jobs == set(
{'executor0/shard-0/rep-0'}
)
assert process_requests_seconds_runtime_exported_jobs == {'executor0/shard-0/rep-0'}

(
sending_request_seconds_runtime,
Expand All @@ -344,7 +321,7 @@ def test_flow_metrics(
{'runtime_name': 'gateway/rep-0'},
)
assert len(sending_request_seconds_runtime) > 0
assert sending_request_seconds_runtime_exported_jobs == set({'gateway/rep-0'})
assert sending_request_seconds_runtime_exported_jobs == {'gateway/rep-0'}

(
sending_request_seconds_runtime,
Expand All @@ -355,4 +332,4 @@ def test_flow_metrics(
{'runtime_name': 'executor0/head'},
)
assert len(sending_request_seconds_runtime) > 0
assert sending_request_seconds_runtime_exported_jobs == set({'executor0/head'})
assert sending_request_seconds_runtime_exported_jobs == {'executor0/head'}

0 comments on commit 394a361

Please sign in to comment.