Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpcserver+monitoring/config: enable Prometheus monitoring.
Start the Prometheus exporter in rpcserver.go if monitoring is enabled through the build tag. Also allow users to specify what address they want the Prometheus exporter to be listening on.
- Loading branch information
1 parent
27c38c8
commit 9b44375
Showing
5 changed files
with
89 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// +build !monitoring | ||
|
||
package lncfg | ||
|
||
// Prometheus configures the Prometheus exporter when monitoring is enabled. | ||
// Monitoring is currently disabled. | ||
type Prometheus struct{} | ||
|
||
// DefaultPrometheus is the default configuration for the Prometheus metrics | ||
// exporter when monitoring is enabled. Monitoring is currently disabled. | ||
func DefaultPrometheus() Prometheus { | ||
return Prometheus{} | ||
} | ||
|
||
// Enabled returns whether or not Prometheus monitoring is enabled. Monitoring | ||
// is currently disabled, so Enabled will always return false. | ||
func (p *Prometheus) Enabled() bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// +build monitoring | ||
|
||
package lncfg | ||
|
||
// Prometheus is the set of configuration data that specifies the listening | ||
// address of the Prometheus exporter. | ||
type Prometheus struct { | ||
// Listen is the listening address that we should use to allow the main | ||
// Prometheus server to scrape our metrics. | ||
Listen string `long:"listen" description:"the interface we should listen on for Prometheus"` | ||
Enable bool `long:"enable" description:"enable Prometheus exporting of lnd gRPC performance metrics."` | ||
} | ||
|
||
// DefaultPrometheus is the default configuration for the Prometheus metrics | ||
// exporter. | ||
func DefaultPrometheus() Prometheus { | ||
return Prometheus{ | ||
Listen: "127.0.0.1:8989", | ||
Enable: false, | ||
} | ||
} | ||
|
||
// Enabled returns whether or not Prometheus monitoring is enabled. Monitoring | ||
// is enabled by default, but may be disabled by the user. | ||
func (p *Prometheus) Enabled() bool { | ||
return p.Enable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters