Skip to content

Conversation

@ywkaras
Copy link
Contributor

@ywkaras ywkaras commented Feb 13, 2023

Add current and total metrics for TCP connetions towards clients for blind TCP tunnels, and TLS tunnel, forward, and partial blind tunnel SNI-based tunnels.

Add current and total metrics for TCP connetions towards servers, for blind TCP tunnels and TLS tunnels. Only partial blind tunnel SNI-based tunnels are counted as TLS tunnels on the outgoing side, because they are only SNI-based tunnels where ATS termitates the TLS connection form the client and originates a new one towards the server.

@ywkaras ywkaras self-assigned this Feb 13, 2023
@ywkaras ywkaras added this to the 10.0.0 milestone Feb 13, 2023
Copy link
Contributor

@zwoop zwoop left a comment

Choose a reason for hiding this comment

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

There's a number of refactoring / class changes as well here. Even if that is necessary for the new metrics, can we maybe break that out into two separate PRs?

@ywkaras
Copy link
Contributor Author

ywkaras commented Feb 14, 2023

Fine, this is why we can't have nice class hierarchies.

@ywkaras
Copy link
Contributor Author

ywkaras commented Feb 18, 2023

Need to describes these in documentation before this will be ready to merge.

@ywkaras ywkaras force-pushed the tunnel_stats branch 3 times, most recently from 907de5f to e559370 Compare February 26, 2023 02:33
c_os = tunnel.add_consumer(server_entry->vc, ua_entry->vc, &HttpSM::tunnel_handler_ssl_consumer, HT_HTTP_SERVER,
"http server - tunnel");

ua_entry->vc->make_tunnel_endpoint();
Copy link
Contributor Author

@ywkaras ywkaras Feb 26, 2023

Choose a reason for hiding this comment

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

ua_entry->vc is a VConnection pointer, which is why make_tunnel_endpoint() has to be virtual member function of VConnection.

"http server - tunnel");

ua_entry->vc->make_tunnel_endpoint();
server_entry->vc->make_tunnel_endpoint();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

server_entry->vc is a VConnection pointer, which is why make_tunnel_endpoint() has to be virtual member function of VConnection.

@ywkaras ywkaras force-pushed the tunnel_stats branch 2 times, most recently from b9540ac to 597e442 Compare February 26, 2023 22:31
@ywkaras ywkaras changed the title Add 16 metrics for TCP connections created for tunnels. Add 20 metrics for TCP connections created for tunnels. Feb 26, 2023
@ywkaras ywkaras changed the title Add 20 metrics for TCP connections created for tunnels. Add 14 metrics for TCP connections created for tunnels. Mar 1, 2023
@ywkaras
Copy link
Contributor Author

ywkaras commented Mar 2, 2023

It turns out that SSL connections to servers made for tunnels are not marked with an SNI tunnel type. I decided not to add this, unless someone feels there's a need for it. This is why the number of new metrics dropped from 20 to 14. 8 metrics for SSL connections to servers for tunnels collaped to 2 (current and total).

@ywkaras ywkaras force-pushed the tunnel_stats branch 4 times, most recently from 600ce3a to b4db5f2 Compare March 13, 2023 00:39
@ywkaras ywkaras force-pushed the tunnel_stats branch 2 times, most recently from e5a1505 to e0f71fd Compare May 29, 2023 03:39
@ywkaras ywkaras marked this pull request as ready for review May 29, 2023 15:23
@ywkaras
Copy link
Contributor Author

ywkaras commented May 29, 2023

This change has been running in Yahoo prod for over a month.

@ywkaras
Copy link
Contributor Author

ywkaras commented Jun 26, 2023

Use "mark as" when more appropriate than "make".

@ywkaras ywkaras marked this pull request as draft June 27, 2023 14:42
@ywkaras ywkaras marked this pull request as ready for review June 27, 2023 19:13
@ywkaras
Copy link
Contributor Author

ywkaras commented Jun 27, 2023

@masaori335 ready for review.

// This function should be called when the VConnection is a tunnel endpoint. By default, a VConnection does not care if it
// is a tunnel endpoint.
virtual void
mark_as_tunnel_endpoint()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this virtual function in the VConnection class? As you commented, VConnection doesn't care about it's tunnel or something else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it's called through a VConnection pointer at certain places.

Copy link
Contributor

@masaori335 masaori335 Jun 29, 2023

Choose a reason for hiding this comment

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

This one?

HttpSM::setup_blind_tunnel(bool send_response_hdr, IOBufferReader *initial) {
...
   ua_entry->vc->mark_as_tunnel_endpoint();
   server_entry->vc->mark_as_tunnel_endpoint();

Can we use ua_txn->get_netvc() and server_txn->get_netvc() instead of ua_entry->vc and server_entry->vc here? If possible, I prefer NetVConnection to have this virtual function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I just tried that. server_txn is null at that point in the code, so it doesn't work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough, thanks for checking.

:type: counter

Total number of TLS connections for tunnels where the far end is the client
initiated with an HTTP request.
Copy link
Contributor

Choose a reason for hiding this comment

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

This covers "HTTP CONNECT" over TLS connection?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Member

Choose a reason for hiding this comment

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

Does that include QUIC connection once we support it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not currently. QUICNetVConnection would have to override _in_context_tunnel(). It could use the same metrics or different metrics.

:type: counter

Total number of TCP connections for TLS tunnels where the far end is the server
created based on a ``partial_blind_route`` key in a table in the :file:`sni.yaml` file.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need similar server-side metrics for forward_route?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A partial blind tunnel is the only one for which the outgoing connection corresponds to an SSLNetVConnection object rather than a UnixNetVConnection object. It's not straight forward how to implement separate counters for outgoing/server connections for the other TLS tunnel types, but it may be possible if they're needed.

@ywkaras
Copy link
Contributor Author

ywkaras commented Aug 17, 2023

@masaori335 this has been waiting more than a month for review.

@ywkaras
Copy link
Contributor Author

ywkaras commented Aug 17, 2023

[approve ci]

@ywkaras
Copy link
Contributor Author

ywkaras commented Sep 14, 2023

Rebased to remove merge conflicts.

@ywkaras ywkaras marked this pull request as draft October 9, 2023 22:31
Add current and total metrics for TCP connetions towards clients for blind TCP tunnels, and TLS tunnel, forward,
and partial blind tunnel SNI-based tunnels.

Add current and total metrics for TCP connetions towards servers, for blind TCP tunnels and TLS tunnels.  Only
partial blind tunnel SNI-based tunnels are counted as TLS tunnels on the outgoing side, because they are only
SNI-based tunnels where ATS termitates the TLS connection form the client and originates a new one towards the
server.
Due to change in usage of HttpTransact::State::method.
iocore/net/Net.cc
iocore/net/SSLNetVConnection.cc
iocore/net/UnixNetVConnection.cc
proxy/http/HttpTransact.cc
@ywkaras ywkaras marked this pull request as ready for review October 14, 2023 01:19
@ywkaras
Copy link
Contributor Author

ywkaras commented Oct 14, 2023

Rebased, ready for review.

Copy link
Contributor

@masaori335 masaori335 left a comment

Choose a reason for hiding this comment

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

Let's ship this. At least this gives us more clue of what's going on with tunnel.

@ywkaras ywkaras merged commit 124fd70 into apache:master Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants