open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.12k stars 2.39k forks source link

Number of database connections per user #35196

Open epochstamp opened 2 months ago

epochstamp commented 2 months ago

Component(s)

receiver/postgresql

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

The number of maximum database active connections can be configured and is already tracked through the postgresql_connection_max metrics, yet there is no metrics to track the active number of connections. However this is an essential thing to monitor.

Describe the solution you'd like

Add a metrics named postgresql_connection_active with the following additional entries:

Describe alternatives you've considered

Parse Loki logs to track connections vs disconnections, but this is a very rough approximation of the actual number of active connections...

Additional context

References: Why active connections over max connections should be monitored Query to get active connections per client

github-actions[bot] commented 2 months ago

Pinging code owners:

atoulme commented 1 month ago

backend_start would create a high cardinality situation. That won't work for this metric.

epochstamp commented 1 month ago

After further thinking I do not see any use-case (in the context of observability systems, at least from my place) of this anyway.

We could then just keep the application_name attribute.