Skip to content
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

Moved HTTP request telemetry to HttpClient.SendAsync #41022

Merged
merged 12 commits into from
Aug 31, 2020

Conversation

ManickaP
Copy link
Member

@ManickaP ManickaP commented Aug 19, 2020

Moved HTTP request telemetry to HttpClient.SendAsync
Added events for ResponseContent
Added helper methods events

Contributes to #40776

@ManickaP ManickaP requested a review from a team August 19, 2020 10:18
@ghost
Copy link

ghost commented Aug 19, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

{
throw CreateTimeoutException(operationException);
HttpTelemetry.Log.RequestStart(
Copy link
Member

Choose a reason for hiding this comment

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

So now you only get the telemetry if you use HtrpClient, but not if you use HttpMessageInvoker?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Though in the previous state of things, you got the telemetry only with SocketsHandler and not with any custom handler...

However, we can introduce child events to cover HttpMessageInvoker etc. This event pair should be the main, all encompassing one. And in case a user wants to use the invoker directly, we should provide them with examples how to plug in their own telemetry to achieve the same.

I've some thoughts about this and I'm trying to put it all in writing in #40776 (not yet finished though).

@ManickaP ManickaP force-pushed the mapichov/40776_activity_id branch 2 times, most recently from 150322e to 508b24e Compare August 19, 2020 11:30
@ManickaP ManickaP force-pushed the mapichov/40776_activity_id branch from 508b24e to ec189d4 Compare August 24, 2020 12:39
@MihaZupan
Copy link
Member

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MihaZupan
Copy link
Member

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@karelz karelz added this to the 6.0.0 milestone Aug 27, 2020
@MihaZupan
Copy link
Member

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ManickaP
Copy link
Member Author

This also fixes: #40896

Copy link
Member Author

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

Two things in HttpMessageInvoker otherwise LGTM. However, I cannot approve since it's my PR originally. @dotnet/ncl could anyone approve once all is addressed?

And thank you for taking this over and finishing ❤️

Copy link
Contributor

@alnikola alnikola left a comment

Choose a reason for hiding this comment

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

Please, resolve all the Marie's comments.
Otherwise, LGTM

@MihaZupan
Copy link
Member

MihaZupan commented Aug 28, 2020

I pushed more changes here:

  • Changing the RequestStart signature (versionMajor, Minor from int to byte), adding the version policy field
  • Changing ResponseContentBegin to Start/Stop
  • Renaming RequestAborted to RequestFailed
  • Adding Telemetry tests for non-async Sends

@ManickaP @alnikola Please re-review (should be simple to review on a commit-by-commit basis)

@MihaZupan
Copy link
Member

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@alnikola alnikola left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member Author

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

Single comment, otherwise LGTM.
:shipit:

@MihaZupan
Copy link
Member

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ManickaP
Copy link
Member Author

Runtime CI failure: #41511

@ManickaP
Copy link
Member Author

ManickaP commented Aug 28, 2020

Outerloop CI Failures:
3x #40798
5x SyncHttpHandler_HttpClientHandler_Cancellation_Test.Expect100Continue_WaitsExpectedPeriodOfTimeBeforeSendingContent --> #41530
4x SocketsHttpHandler_HttpClientHandler_Cancellation_Test_Http2.PostAsync_Cancel_CancellationTokenPassedToContent(content: StreamContent { Headers = [] }, cancellationTokenSource: CancellationTokenSource { IsCancellationRequested = False, Token = System.Threading.CancellationToken }) --> #41531
1x SocketsHttpHandler_HttpClientHandler_ClientCertificates_Test.Manual_CertificateSentMatchesCertificateReceived_Success(numberOfRequests: 6, reuseClient: False)
1x SocketsHttpHandlerTest_Http2.SocketSendQueueFull_RequestCanceled_ThrowsOperationCanceled

All of them are timout related and do not seem to be related to the changes made in this PR.

@MihaZupan
Copy link
Member

/azp run runtime-libraries outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MihaZupan MihaZupan merged commit 05efa9b into dotnet:master Aug 31, 2020
@ManickaP ManickaP deleted the mapichov/40776_activity_id branch August 31, 2020 09:33
MihaZupan added a commit to MihaZupan/runtime that referenced this pull request Aug 31, 2020
* Moved HTTP request telemetry to HttpClient.SendAsync

* Added ResponseContent and helper methods events.

* Rework helper method activity nesting

* Expand Telemetry tests

* Also log RequestStart/Stop in HttpMessageInvoker

* Update RequestStart signature

* RequestAborted => RequestFailed rename

* ResponseContent Begin => Start/Stop

* Fix HttpMessageInvoker implementation

* Add Synchronous request Telemetry tests

* Check telemetryStarted before ResponseContentStart

Co-authored-by: MihaZupan <mihazupan.zupan1@gmail.com>
MihaZupan added a commit that referenced this pull request Aug 31, 2020
* System.Net Telemetry style changes (#41527)

* Change HandshakeStop SslProtocols parameter to enum

* Parameterize Http11/Http20 events

* Add dummy request to ensure Http2 settings are received

* Moved HTTP request telemetry to HttpClient.SendAsync (#41022)

* Moved HTTP request telemetry to HttpClient.SendAsync

* Added ResponseContent and helper methods events.

* Rework helper method activity nesting

* Expand Telemetry tests

* Also log RequestStart/Stop in HttpMessageInvoker

* Update RequestStart signature

* RequestAborted => RequestFailed rename

* ResponseContent Begin => Start/Stop

* Fix HttpMessageInvoker implementation

* Add Synchronous request Telemetry tests

* Check telemetryStarted before ResponseContentStart

Co-authored-by: MihaZupan <mihazupan.zupan1@gmail.com>

* Add Request/Response Headers/Content Start/Stop events (#41590)

Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants