prysm-pulse/shared/prometheus
Nishant Das a9e3ea3ccc
Add Host Flags for All Servers running in Prysm (#6202)
* Merge branch 'master' of https://github.com/prysmaticlabs/geth-sharding into removeHardLimit

# Conflicts:
add flags for all hosts
* lint
* Merge refs/heads/master into addFlagsForHosts
* Merge refs/heads/master into addFlagsForHosts
* Merge refs/heads/master into addFlagsForHosts
* use single flag
2020-06-10 16:04:32 +00:00
..
BUILD.bazel libfuzz based tests (#5095) 2020-05-05 07:22:26 +00:00
content_negotiation.go /healthz endpoint accepts JSON now (#5558) 2020-04-21 20:58:53 +00:00
logrus_collector_test.go proper error checking and type assertions (#5424) 2020-04-14 16:41:09 +00:00
logrus_collector.go Enforce error handling and checking type assertions (#5403) 2020-04-13 04:11:09 +00:00
README.md Added Prometheus Client and p2p Metrics (#673) 2018-11-15 07:54:45 -05:00
service_test.go /healthz endpoint accepts JSON now (#5558) 2020-04-21 20:58:53 +00:00
service.go Add Host Flags for All Servers running in Prysm (#6202) 2020-06-10 16:04:32 +00:00
simple_server.go Properly log and handle HTTP server error (#2685) 2019-06-12 19:58:49 -04:00

How to monitor with prometheus

Prerequisites:

Start scrapping services

To start scrapping with prometheus you must create or edit the prometheus config file and add all the services you want to scrap, like these:

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
      - targets: ['localhost:9090']
+  - job_name: 'beacon-chain'
+    static_configs:
+      - targets: ['localhost:8080']

After creating/updating the prometheus file run it:

$ prometheus --config.file=your-prometheus-file.yml

Now, you can add the prometheus server as a data source on grafana and start building your dashboards.

How to add additional metrics

The prometheus service export the metrics from the DefaultRegisterer so just need to register your metrics with the prometheus or promauto libraries. To know more Go application guide