1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-23 14:40:34 +01:00

Expose scraping endpoint for prometheus metrics (#2321)

Allow eclair to expose a metrics scraping endpoint for Prometheus
for users who don't want to rely on Kamon's hosted infrastructure. 

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
This commit is contained in:
Goutam Verma 2022-06-16 21:22:57 +05:30 committed by GitHub
parent 26741fabca
commit 6b2e415ecb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 3 deletions

View file

@ -33,6 +33,7 @@ kamon {
} }
``` ```
When starting eclair, you should enable the Kanela agent: When starting eclair, you should enable the Kanela agent:
```sh ```sh
@ -42,13 +43,48 @@ eclair.sh -with-kanela
Your eclair node will start exporting monitoring data to Kamon. Your eclair node will start exporting monitoring data to Kamon.
You can then start creating dashboards, graphs and alerts directly on Kamon's website. You can then start creating dashboards, graphs and alerts directly on Kamon's website.
## Enabling monitoring with a different backend ## Enabling monitoring with Prometheus
Kamon supports many other monitoring [backends](https://kamon.io/docs/latest/reporters/). Kamon supports many other monitoring [backends](https://kamon.io/docs/latest/reporters/).
This can be useful for nodes that don't want to export any data to third-party servers. This can be useful for nodes that don't want to export any data to third-party servers.
No specific work has been done yet in eclair to support these backends. If you'd like to use them, Eclair currently supports exporting metrics to [Prometheus](https://kamon.io/docs/latest/reporters/prometheus/).
don't hesitate to ask around or send a PR. To enable monitoring with Prometheus, add the following to your `eclair.conf`:
```config
eclair.enable-kamon=true
// The Kamon APM reporter is enabled by default, but it won't work with Prometheus, so we disable it.
kamon.modules {
apm-reporter {
enabled = false
}
}
kamon {
prometheus {
start-embedded-http-server = yes
embedded-server {
hostname = 0.0.0.0
port = <port to expose to prometheus>
}
}
}
```
You should then configure your Prometheus process to scrape metrics from the exposed http server.
* Download Prometheus [here](https://prometheus.io/download/).
* Add the following configuration to the `prometheus.yml` file (see the [Prometheus documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) for more details)
```prometheus.yml
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
scrape_configs:
- job_name: 'eclair'
static_configs:
- targets: ['<url of the eclair http embedded server>']
```
## Example metrics ## Example metrics
@ -60,3 +96,4 @@ metrics are just a small sample of all the metrics we provide:
* Number of connected peers * Number of connected peers
* Bitcoin wallet balance * Bitcoin wallet balance
* Various metrics about the public graph (nodes, channels, updates, etc) * Various metrics about the public graph (nodes, channels, updates, etc)

View file

@ -270,6 +270,11 @@
<version>1.5.0</version> <version>1.5.0</version>
</dependency> </dependency>
<!-- MONITORING --> <!-- MONITORING -->
<dependency>
<groupId>io.kamon</groupId>
<artifactId>kamon-prometheus_${scala.version.short}</artifactId>
<version>2.5.4</version>
</dependency>
<dependency> <dependency>
<groupId>io.kamon</groupId> <groupId>io.kamon</groupId>
<artifactId>kamon-core_${scala.version.short}</artifactId> <artifactId>kamon-core_${scala.version.short}</artifactId>

View file

@ -43,6 +43,15 @@ kamon.instrumentation.akka {
} }
} }
} }
// See documentation here: https://kamon.io/docs/latest/reporters/prometheus/
kamon.prometheus {
// If you want to expose a scraping endpoint for Prometheus metrics, set this to true.
start-embedded-http-server = no
embedded-server {
hostname = 0.0.0.0
port = 9095
}
}
kanela.modules { kanela.modules {
jdbc { jdbc {