dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
34.81k stars 9.84k forks source link

General feedback on kestrel connection metrics #52437

Open lmolkova opened 7 months ago

lmolkova commented 7 months ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe the problem.

Not related to any functional problem.

Describe the solution you'd like

Several kestrel connection metrics could be grouped together to better align with otel recommendations.

See the original discussion in https://github.com/open-telemetry/semantic-conventions/pull/283#discussion_r1400552625

TL;DR:

kestrel.active_connections, kestrel.queued_connections could be measured with something like kestrel.current.connections or kestrel.connections and additional attribute like kestrel.connection.state = active | queued.

kestrel.upgraded_connections might also be measured with the same counter using an attribute that captures original protocol version (e.g. http.protocol.initial_version).

Additional context

No response

amcasey commented 7 months ago

@JamesNK Please let me know if you're not the right person to look at this.

JamesNK commented 7 months ago

kestrel.active_connections, kestrel.queued_connections could be measured with something like kestrel.current.connections or kestrel.connections and additional attribute like kestrel.connection.state = active | queued.

How would a connection go from queued to active? Would you need to subtract it and then add it again?

e.g. Connection is queued: kestrel.connections state=queued + 1 Connection is ready: kestrel.connections state=queued - 1 AND kestrel.connections state=active + 1 Connection is finished: kestrel.connections state=active - 1

lmolkova commented 7 months ago

kestrel.active_connections, kestrel.queued_connections could be measured with something like kestrel.current.connections or kestrel.connections and additional attribute like kestrel.connection.state = active | queued.

How would a connection go from queued to active? Would you need to subtract it and then add it again?

e.g. Connection is queued: kestrel.connections state=queued + 1 Connection is ready: kestrel.connections state=queued - 1 AND kestrel.connections state=active + 1 Connection is finished: kestrel.connections state=active - 1

yes, that'd be the way.

Still, the cost (breaking change) may be much higher than the benefit, so I've created this issue only for bookkeeping reasons.