open-vault/helper/metricsutil
Christopher Swenson c57d053d28
Add database plugin metrics around connections (#16048)
Add database plugin metrics around connections

This is a replacement for #15923 that takes into account recent lock
cleanup.

I went ahead and added back in the hanging plugin test, which I meant to
add in #15944 but forgot.

I tested this by spinning up a statsd sink in the tests and verifying I
got a stream of metrics:

```
$ nc -u -l 8125 | grep backend
test.swenson-Q9Q0L72D39.secrets.database.backend.connections.count.pgx.5.:1.000000|g
test.swenson-Q9Q0L72D39.secrets.database.backend.connections.count.pgx.5.:0.000000|g
test.swenson-Q9Q0L72D39.secrets.database.backend.connections.count.pgx.5.:1.000000|g
test.swenson-Q9Q0L72D39.secrets.database.backend.connections.count.pgx.5.:0.000000|g
```

We have to rework the shared gauge code to work without a full
`ClusterMetricSink`, since we don't have access to the core metrics from
within a plugin.

This only reports metrics every 10 minutes by default, but it solves
some problems we would have had with the gauge values becoming stale and
needing to be re-sent.

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2022-06-27 09:34:45 -07:00
..
bucket.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
bucket_test.go Revert "Migrate internalshared out (#9727)" (#10141) 2020-10-13 16:38:21 -07:00
gauge_process.go Add database plugin metrics around connections (#16048) 2022-06-27 09:34:45 -07:00
gauge_process_test.go Add database plugin metrics around connections (#16048) 2022-06-27 09:34:45 -07:00
metricsutil.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00
metricsutil_test.go Revert "Migrate internalshared out (#9727)" (#10141) 2020-10-13 16:38:21 -07:00
wrapped_metrics.go Add database plugin metrics around connections (#16048) 2022-06-27 09:34:45 -07:00
wrapped_metrics_test.go Run a more strict formatter over the code (#11312) 2021-04-08 09:43:39 -07:00