-
Notifications
You must be signed in to change notification settings - Fork 92
Finalize emission and tracking of latencies in response headers #500
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
Changes from 41 commits
c226497
c6697de
28e0d34
94ad984
933c589
a1691ec
740d0ca
1afe2f1
ae0c08e
3487e19
1d1f03a
a9d99eb
0aa8630
db01e40
5e48513
d9569cb
cf1170c
421feb8
af148ea
e813e75
505495c
5405dc9
d858b55
3cf32b8
35aee47
027c00f
70502e1
a55bbe7
d199313
a16d8dd
f3008d9
7774e2d
937fd88
8152829
64cb19c
af60b8d
3996c65
228934a
00b6861
68ed58a
74f9717
594bbbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Envoy configuration template for testing the time-tracking http filter extension. | ||
| # Sets up the time-tracking extension plus the test-server extension for generating | ||
| # responses. | ||
| admin: | ||
|
Contributor
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. Can we add a comment at the top of this, explaining its purpose in just a sentence, and draw attention to the relevant/unique part of the configuration (which I think is the time-tracking filter) |
||
| access_log_path: $tmpdir/nighthawk-test-server-admin-access.log | ||
| profile_path: $tmpdir/nighthawk-test-server.prof | ||
| address: | ||
| socket_address: { address: $server_ip, port_value: 0 } | ||
| static_resources: | ||
| listeners: | ||
| - address: | ||
| socket_address: | ||
| address: $server_ip | ||
| port_value: 0 | ||
| filter_chains: | ||
| - filters: | ||
| - name: envoy.http_connection_manager | ||
| config: | ||
| generate_request_id: false | ||
| codec_type: auto | ||
| stat_prefix: ingress_http | ||
| route_config: | ||
| name: local_route | ||
| virtual_hosts: | ||
| - name: service | ||
| domains: | ||
| - "*" | ||
| http_filters: | ||
| # Here we set up the time-tracking extension to emit request-arrival delta timings in a response header. | ||
| - name: time-tracking | ||
| config: | ||
| emit_previous_request_delta_in_response_header: x-origin-request-receipt-delta | ||
| - name: test-server | ||
| config: | ||
| response_body_size: 10 | ||
| - name: envoy.router | ||
| config: | ||
| dynamic_stats: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -700,6 +700,30 @@ def test_cancellation_with_infinite_duration(http_test_server_fixture): | |
| asserts.assertCounterGreaterEqual(counters, "benchmark.http_2xx", 1) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize('server_config', [ | ||
| "nighthawk/test/integration/configurations/nighthawk_http_origin.yaml", | ||
| "nighthawk/test/integration/configurations/nighthawk_track_timings.yaml" | ||
| ]) | ||
| def test_http_h1_response_header_latency_tracking(http_test_server_fixture, server_config): | ||
| """Test emission and tracking of response header latencies. | ||
|
|
||
| Run the CLI configured to track latencies delivered by response header from the test-server. | ||
| Ensure that the origin_latency_statistic histogram receives the correct number of inputs. | ||
| """ | ||
| parsed_json, _ = http_test_server_fixture.runNighthawkClient([ | ||
| http_test_server_fixture.getTestServerRootUri(), "--connections", "1", "--rps", "100", | ||
| "--duration", "100", "--termination-predicate", "benchmark.http_2xx:99", | ||
| "--response-latency-header-name", "x-origin-request-receipt-delta" | ||
| ]) | ||
| global_histograms = http_test_server_fixture.getNighthawkGlobalHistogramsbyIdFromJson(parsed_json) | ||
| asserts.assertEqual(int(global_histograms["benchmark_http_client.latency_2xx"]["count"]), 100) | ||
| # Verify behavior is correct both with and without the timing filter enabled. | ||
|
Contributor
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. This is a very helpful comment here. Thanks |
||
| expected_histogram_count = 99 if "nighthawk_track_timings.yaml" in server_config else 0 | ||
| asserts.assertEqual( | ||
| int(global_histograms["benchmark_http_client.origin_latency_statistic"]["count"]), | ||
| expected_histogram_count) | ||
|
|
||
|
|
||
| def _run_client_with_args(args): | ||
| return utility.run_binary_with_args("nighthawk_client", args) | ||
|
|
||
|
|
||
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.
Sorry for extra churn here. Realized I gave you a misleading name (implies this would be response latency, which, while possible to do with this, is not the only usecase).
How do you feel about
--latency-response-header-name(just inverting those two words).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.
Sounds good, done in 594bbbe