mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 15:11:09 +02:00
monitoring+cfg: add new option to export gRPC perf metrics
In this commit, we expose a new monitoring option to allow users to export gRPC performance metrics. These metrics can be used to see how long certain calls are taking, the total amount of time spent handling calls, broken down by service and also call. This option consumes additional memory and disk space for the Prometheus server, which is why we're opting to make it an optional flag.
This commit is contained in:
@@ -36,6 +36,14 @@ func ExportPrometheusMetrics(grpcServer *grpc.Server, cfg lncfg.Prometheus) erro
|
||||
|
||||
grpc_prometheus.Register(grpcServer)
|
||||
|
||||
// Enable the histograms which can allow plotting latency
|
||||
// distributions of inbound calls. However we guard this behind
|
||||
// another flag as this can generate a lot of additional data,
|
||||
// as its a high cardinality metric typically.
|
||||
if cfg.PerfHistograms {
|
||||
grpc_prometheus.EnableHandlingTimeHistogram()
|
||||
}
|
||||
|
||||
http.Handle("/metrics", promhttp.Handler())
|
||||
go func() {
|
||||
http.ListenAndServe(cfg.Listen, nil)
|
||||
|
Reference in New Issue
Block a user