Skip to content

Conversation

@olix0r
Copy link
Member

@olix0r olix0r commented Mar 9, 2025

This change updates the DetectHttp middleware to record metrics about HTTP
protocol detection. Specfically, it records the the counts of results and a very
coarse histogram of the time taken to detect the protocol.

The inbound, outbound, and admin (via inbound) stacks are updated to record
metrics against the main registry.

Example metrics

# HELP inbound_tcp_detect_http_duration_seconds Time taken for protocol detection.
# TYPE inbound_tcp_detect_http_duration_seconds histogram
# UNIT inbound_tcp_detect_http_duration_seconds seconds
inbound_tcp_detect_http_duration_seconds_sum{srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 0.0019456109999999997
inbound_tcp_detect_http_duration_seconds_count{srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 52
inbound_tcp_detect_http_duration_seconds_bucket{le="0.001",srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 52
inbound_tcp_detect_http_duration_seconds_bucket{le="0.1",srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 52
inbound_tcp_detect_http_duration_seconds_bucket{le="+Inf",srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 52
# HELP inbound_tcp_detect_http_results Protocol detection results.
# TYPE inbound_tcp_detect_http_results counter
inbound_tcp_detect_http_results_total{result="read_timeout",srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 0
inbound_tcp_detect_http_results_total{result="not_http",srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 0
inbound_tcp_detect_http_results_total{result="http/1",srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 52
inbound_tcp_detect_http_results_total{result="h2",srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 0
inbound_tcp_detect_http_results_total{result="error",srv_group="",srv_kind="default",srv_name="all-unauthenticated",srv_port="4191"} 0
# HELP outbound_tcp_detect_http_duration_seconds Time taken for protocol detection.
# TYPE outbound_tcp_detect_http_duration_seconds histogram
# UNIT outbound_tcp_detect_http_duration_seconds seconds
outbound_tcp_detect_http_duration_seconds_sum{parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 0.000010969
outbound_tcp_detect_http_duration_seconds_count{parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_duration_seconds_bucket{le="0.001",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_duration_seconds_bucket{le="0.1",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_duration_seconds_bucket{le="+Inf",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_duration_seconds_sum{parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 0.000008034
outbound_tcp_detect_http_duration_seconds_count{parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_duration_seconds_bucket{le="0.001",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_duration_seconds_bucket{le="0.1",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_duration_seconds_bucket{le="+Inf",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 1
# HELP outbound_tcp_detect_http_results Protocol detection results.
# TYPE outbound_tcp_detect_http_results counter
outbound_tcp_detect_http_results_total{result="http/1",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 0
outbound_tcp_detect_http_results_total{result="not_http",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 0
outbound_tcp_detect_http_results_total{result="not_http",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 0
outbound_tcp_detect_http_results_total{result="read_timeout",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 0
outbound_tcp_detect_http_results_total{result="h2",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_results_total{result="error",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="voting-svc",parent_port="8080",parent_section_name=""} 0
outbound_tcp_detect_http_results_total{result="http/1",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 0
outbound_tcp_detect_http_results_total{result="h2",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 1
outbound_tcp_detect_http_results_total{result="error",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 0
outbound_tcp_detect_http_results_total{result="read_timeout",parent_group="core",parent_kind="Service",parent_namespace="emojivoto",parent_name="emoji-svc",parent_port="8080",parent_section_name=""} 0

@olix0r olix0r changed the title Ver/detect refactory mx feat: instrument HTTP protocol detection metrics Mar 9, 2025
@olix0r olix0r force-pushed the ver/detect-refactory-mx branch 4 times, most recently from 154ef43 to 8d304d3 Compare March 9, 2025 18:11
Base automatically changed from ver/detect-refactory-empty to main March 10, 2025 15:31
@olix0r olix0r marked this pull request as ready for review March 10, 2025 15:34
@olix0r olix0r requested a review from a team as a code owner March 10, 2025 15:34
@olix0r olix0r force-pushed the ver/detect-refactory-mx branch from 7c3303d to 7958e33 Compare March 10, 2025 15:43
@olix0r olix0r enabled auto-merge (squash) March 10, 2025 15:43
@olix0r olix0r force-pushed the ver/detect-refactory-mx branch from 7958e33 to 52b23d3 Compare March 10, 2025 15:46
This change updates the DetectHttp middleware to record metrics about HTTP
protocol detection. Specfically, it records the the counts of results and a very
coarse histogram of the time taken to detect the protocol.

The inbound, outbound, and admin (via inbound) stacks are updated to record
metrics against the main registry.
@olix0r olix0r force-pushed the ver/detect-refactory-mx branch from 52b23d3 to 05c1850 Compare March 10, 2025 15:59
@olix0r olix0r disabled auto-merge March 10, 2025 17:12
Copy link
Member

@cratelyn cratelyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💐 ✨ nice! i am very excited for how helpful these new metrics will be in debugging various issues related to protocol detection. this will be a great step forward in our observability story, on that front.

@olix0r olix0r merged commit 25bc973 into main Mar 10, 2025
15 checks passed
@olix0r olix0r deleted the ver/detect-refactory-mx branch March 10, 2025 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants