Description
Proposal
Use case
Zalando's postgres-operator supports configuring sidecar containers, e.g. postgres_exporter
, to enable observability. After the instantiation of a Postgresql
resource, the operator injects the sidecar into the Pod spec, both containers start simultaneously.
When looking into the metrics endpoint provided by the exporter (http://localhost:9187/metrics
), we've seen, that (in some cases) metrics are missing: In our setup the pg_stat_database_xact_commit
was affected (along with many other pg_stat_database_*
metrics).
After playing around and trying to narrow down the root case we've seen, that a simple restart of the exporter (by issuing)
/ $ kill 1
in the sidecar container's shell fixed the problem. All metrics are now visible.
This leads to the assumption, that the exporter has started sometime in between the postgres instance was in the start up process and could not prepare/return all metrics.
We'd appreciate a feature by which it is possible to enforce the start of the postgres_exporter
only, until the postgres instance is ready. Most likely this could be provided by setting an environment variable DATA_SOURCE_WAIT_UNTIL_READY
and, additionally, configuring a timeout flag, if the database won't come up in time: DATA_SOURCE_WAIT_UNTIL_READY_TIMEOUT
.
Thanks for comments/help/criticism :)
Cheers!