-
Notifications
You must be signed in to change notification settings - Fork 844
Add metrics for H2/3 frames and a way to access them from plugins #10627
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
Conversation
|
[approve ci freebsd] |
|
The changes look good. It would be great to have metrics on the outgoing frames too. |
e803cf6 to
a6972cf
Compare
be63670 to
47c10b2
Compare
The addition is considered. This PR only has code to count incoming frames but the API itself is capable for outgoing frames as well (we'd need to add |
| bool cur_frame_from_early_data = false; | ||
|
|
||
| // Counter for received frames | ||
| std::atomic<uint64_t> _frame_counts_in[HTTP2_FRAME_TYPE_MAX + 1] = { |
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.
Why doesd this need to be atomic? h2 connections shouldn't be handled on multiple threads.
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.
I think that is true, but we have a lot of SCOPED_MUTEX_LOCK in http2 code and other counters for H2 use atomic too. I don't want any surprise from this PR.
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.
Is there an index enum for these values?
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.
There is Http2FrameType, and HTTP2_FRAME_TYPE_MAX is the last item. We need one extra space for unknown type.
|
[approve ci clang-format] |
1 similar comment
|
[approve ci clang-format] |
6ab3bbf to
1d6b2bc
Compare
|
[approve ci format] |
9d9fe82 to
70297d8
Compare
|
@bryancall This passes all CI now. Is the use of atomic a blocker? |
|
[approve ci format] |
92f6072 to
2b23f14
Compare
include/proxy/ProxySession.h
Outdated
|
|
||
| virtual PoolableSession *get_server_session() const; | ||
|
|
||
| virtual uint64_t is_protocol_framed() const; |
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.
Why does this return uintr64_t instead of bool, or alternatively why is it named "is_..." when that should indicate a boolean return?
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.
Changed it to bool.
| }; | ||
|
|
||
| #define TS_SSN_INFO_RECEIVED_FRAME_COUNT_H2_UNKNOWN 999 | ||
| #define TS_SSN_INFO_RECEIVED_FRAME_COUNT_H3_UNKNOWN 0x21 |
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.
Why is this 0x21 when the index enum value is 0x0e?
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.
Because 0x0e is just an unassigned number (it could be used later for something). 0x21 is reserved for exercising and will never be used.
https://datatracker.ietf.org/doc/html/rfc9114#name-reserved-frame-types
| Metrics::Counter::createPtr("proxy.process.http2.max_concurrent_streams_exceeded_in"); | ||
| http2_rsb.max_concurrent_streams_exceeded_out = | ||
| Metrics::Counter::createPtr("proxy.process.http2.max_concurrent_streams_exceeded_out"); | ||
| http2_rsb.data_frames_in = Metrics::Counter::createPtr("proxy.process.http2.data_frames_in"), |
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.
Why use these intermediares? Could this be done using a Metric span and indexing?
Or, alternatively,
http2_frame_metrics_in[0] = Metrics::Counter::createPtr("proxy.process.http2.headers_frames_in");
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.
Don't we need to have them in http2_rsb?
| uint64_t | ||
| Http2ClientSession::get_received_frame_count(uint64_t type) const | ||
| { | ||
| if (type == 999) { // TS_SSN_INFO_RECEIVED_FRAME_COUNT_H2_UNKNOWN in apidefs.h.in |
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.
Then why not use that definition?
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.
Because the definition is for plugins.
a559a4f to
7dc281b
Compare
|
@maskit I am seeing this on the failed rockylinux 8 build: |
|
[approve ci autest] |
|
@bryancall I fixed the compile error. PTAL. |
f603883 to
6b83aa8
Compare
|
[approve ci autest] |
|
@bryancall Resolved merge conflicts. |
This is for apache#10627 and apache#10306.
This PR adds below to enable us to implement/improve gate keeping plugins:
TSHttpSsnInfoIntGet, which enables plugins to access the counters