-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
System.Net.Sockets telemetry counters #39708
System.Net.Sockets telemetry counters #39708
Conversation
Tagging subscribers to this area: @dotnet/ncl |
/azp run runtime-libraries outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Looks good, but I see the bytes received/sent telemetry is not done at SocketPal.(ReceiveAsync/ReceiveMessageFromAsync/SendAsync/SendToAsync)
call-sites. Are those handeled elsewhere?
src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketsTelemetry.cs
Outdated
Show resolved
Hide resolved
@MihaZupan Bytes and datagrams are counted in the Socket.cs because SocketsPal is platform dependent so I would have to duplicate code. |
I think it's good to do it in shared Sockets code. |
Async operations are tracked in the respective |
Afaik, datagrams can also be sent/received with |
|
- Socket's Send/Recieve methods log datagram transfer
@MihaZupan You were right on the above two concerns. They are resolved now. Please, check again. |
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.
Change LGTM
src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs
Outdated
Show resolved
Hide resolved
@@ -687,6 +692,7 @@ internal void FinishOperationSyncSuccess(int bytesTransferred, SocketFlags flags | |||
LogBuffer(bytesTransferred); | |||
} |
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.
This is good example of why the split across event sources is problematic. We're tracking bytes transferred with one event source but logging the contents with another.
src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketsTelemetry.cs
Outdated
Show resolved
Hide resolved
{ | ||
SocketsTelemetry.Log.BytesReceived(bytesTransferred); | ||
if (SocketType == SocketType.Dgram) SocketsTelemetry.Log.DatagramReceived(); | ||
} |
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.
What about methods like Socket.SendFile?
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.
It doesn't report the number of transferred bytes and the existing NetEventSource logs only source / destination addresses and file name, but not the size. Do you know how I can retrieve the transferred byte count here?
src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketsTelemetry.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs
Outdated
Show resolved
Hide resolved
- _currentSocket?.SocketType call moved under IsEnabled() guarding check
/azp run runtime-libraries outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
Accept telemetry added. Please, check. |
Counters in SocketsTelemetry measuring `bytes-received` (Bytes Received) The cumulative total number of bytes received by all Socket objects since the process started. `bytes-sent` (Bytes Sent) The cumulative number of bytes sent by all Socket objects since the process started. `outgoing-connections-established` (Outgoing Connections Established) The cumulative total number of outgoing connections established by Socket objects for stream sockets since the process started. `incoming-connections-established` (Incoming Connections Established) The cumulative total number of incoming connections established by Socket objects for stream sockets since the process started. `datagrams-received` (Datagrams Received) The cumulative total number of datagram packets received by all Socket objects since the process started. `datagrams-sent` (Datagrams Sent) The cumulative total number of datagram packets sent by all Socket objects since the process started. Contributes to dotnet#37428
Counters in SocketsTelemetry measuring
bytes-received
(Bytes Received)The cumulative total number of bytes received by all Socket objects since the process started.
bytes-sent
(Bytes Sent)The cumulative number of bytes sent by all Socket objects since the process started.
outgoing-connections-established
(Outgoing Connections Established)The cumulative total number of outgoing connections established by Socket objects for stream sockets since the process started.
incoming-connections-established
(Incoming Connections Established)The cumulative total number of incoming connections established by Socket objects for stream sockets since the process started.
datagrams-received
(Datagrams Received)The cumulative total number of datagram packets received by all Socket objects since the process started.
datagrams-sent
(Datagrams Sent)The cumulative total number of datagram packets sent by all Socket objects since the process started.
Contributes to #37428