envoy icon indicating copy to clipboard operation
envoy copied to clipboard

stream_info: add downstream handshake completion timing

Open pksohn opened this issue 3 years ago • 7 comments

Signed-off-by: Paul Sohn [email protected]

Commit Message: Adds a downstreamTiming field to the connection-level streamInfo for when the TLS handshake completed for HTTP 1/2/3, for monitoring handshake latency. Additional Description: Note that for HTTP/3 zero-RTT, the handshake may complete well into the life of the request, which is why this field is not copied into the stream-level streamInfo when a stream is created. Risk Level: Low Testing: Integration tests included in the PR. Docs Changes: None Release Notes: Added

pksohn avatar Jul 22 '22 15:07 pksohn

As a reminder, PRs marked as draft will not be automatically assigned reviewers, or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

:cat:

Caused by: https://github.com/envoyproxy/envoy/pull/22367 was opened by pksohn.

see: more, trace.

@pksohn this needs some formatting fixes

you can use the diff/artefacts here to fix

https://dev.azure.com/cncf/envoy/_build/results?buildId=113538&view=results

phlax avatar Jul 22 '22 17:07 phlax

@ggreenway the checks are finally passing for this PR. Any chance you might be able to take a look? Thanks!

pksohn avatar Jul 29 '22 01:07 pksohn

@ggreenway @alyssawilk One thing I meant to ask about:

I removed the assertion that the handshake timestamp can only be written once, in this commit: https://github.com/envoyproxy/envoy/pull/22367/commits/61a8618bc246063886be9eba6ecbd4e19521b57e, upon discovering that the SslSocketTest::ClientSessionResumption... tests were failing due to SslSocket::onSuccess being called multiple times.

In practice do we actually expect SslSocket::onSuccess to be called multiple times for the same connection (e.g. on resumption)? If so, would we want the handshake-complete timestamp to be overwritten?

pksohn avatar Aug 02 '22 19:08 pksohn

@ggreenway @alyssawilk One thing I meant to ask about:

I removed the assertion that the handshake timestamp can only be written once, in this commit: 61a8618, upon discovering that the SslSocketTest::ClientSessionResumption... tests were failing due to SslSocket::onSuccess being called multiple times.

In practice do we actually expect SslSocket::onSuccess to be called multiple times for the same connection (e.g. on resumption)? If so, would we want the handshake-complete timestamp to be overwritten?

Offline with @alyssawilk: we don't expect this to happen in production; likely just an artifact of the SslSocketTest::ClientSessionResumption... tests, removing the assertion is fine.

pksohn avatar Aug 03 '22 17:08 pksohn

@ggreenway ping!

alyssawilk avatar Aug 08 '22 18:08 alyssawilk

Would you be willing to add an access log formatter in source/common/formatter/substitutions_formatter.cc, at least for tcp-proxy access logs? I think this new field is generally useful so I'd like to make it more easily available.

Thanks -- I think I've added what you were suggesting.

pksohn avatar Aug 09 '22 19:08 pksohn

@pksohn can you fix CI? Then I'll ping the reviewers again to try to make some progress.

/wait

jmarantz avatar Aug 18 '22 12:08 jmarantz

/wait on coverage

alyssawilk avatar Aug 22 '22 13:08 alyssawilk

/retest

pksohn avatar Aug 22 '22 14:08 pksohn

Retrying Azure Pipelines: Retried failed jobs in: envoy-presubmit

:cat:

Caused by: a https://github.com/envoyproxy/envoy/pull/22367#issuecomment-1222405506 was created by @pksohn.

see: more, trace.

also @ggreenway can you take a look? I think I signed off on this one but not sure if your concerns are all resolved

alyssawilk avatar Aug 22 '22 14:08 alyssawilk

@alyssawilk: there was a question above that we were hoping you could weigh in on (namely whether to move this metric into the SSL connection or leave it in downstream timing): https://github.com/envoyproxy/envoy/pull/22367#discussion_r941792000

pksohn avatar Aug 22 '22 14:08 pksohn

I think you need to merge main to pick up #22792

alyssawilk avatar Aug 22 '22 16:08 alyssawilk