Skip to content

Commit

Permalink
monitoring: add config for collector timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeTsagk committed Jan 22, 2025
1 parent 78db2a6 commit bed6fc5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 12 additions & 2 deletions monitoring/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package monitoring

import (
"time"

"github.com/lightninglabs/taproot-assets/tapdb"
"github.com/lightninglabs/taproot-assets/tapgarden"
"github.com/lightninglabs/taproot-assets/universe"
Expand All @@ -10,6 +12,8 @@ import (
// PrometheusConfig is the set of configuration data that specifies if
// Prometheus metric exporting is activated, and if so the listening address of
// the Prometheus server.
//
// nolint: lll
type PrometheusConfig struct {
// Active, if true, then Prometheus metrics will be exported.
Active bool `long:"active" description:"if true prometheus metrics will be exported"`
Expand All @@ -18,6 +22,11 @@ type PrometheusConfig struct {
// main Prometheus server to scrape our metrics.
ListenAddr string `long:"listenaddr" description:"the interface we should listen on for prometheus"`

// CollectorRPCTimeout is the context timeout to be used by the RPC
// calls performed during metrics collection. This should not be greater
// than the scrape interval of prometheus.
CollectorRPCTimeout time.Duration `long:"collector-rpc-timeout" description:"the default timeout to be used in the RPC calls performed during metric collection"`

// RPCServer is a pointer to the main RPC server. We use this to export
// generic RPC metrics to monitor the health of the service.
RPCServer *grpc.Server
Expand Down Expand Up @@ -45,7 +54,8 @@ type PrometheusConfig struct {
// metrics exporter.
func DefaultPrometheusConfig() PrometheusConfig {
return PrometheusConfig{
ListenAddr: "127.0.0.1:8989",
Active: false,
ListenAddr: "127.0.0.1:8989",
Active: false,
CollectorRPCTimeout: defaultTimeout,
}
}
3 changes: 3 additions & 0 deletions sample-tapd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@
; The interface we should listen on for prometheus
; prometheus.listenaddr=127.0.0.1:8989

; The default timeout used in prometheus collectors.
; prometheus.collector-rpc-timeout=25s

; Enable additional histogram to track gRPC call processing performance
; (latency, etc)
; prometheus.perfhistograms=false
Expand Down

0 comments on commit bed6fc5

Please sign in to comment.