Skip to content

Commit c46abdd

Browse files
committed
Updates docs
1 parent 6bc2f2f commit c46abdd

1 file changed

Lines changed: 14 additions & 78 deletions

File tree

docs/metrics.md

Lines changed: 14 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,26 @@
11
# Metrics
22

3+
A simple metrics system is available to export/retrieve metrics to/from Prometheus.
4+
35
The metrics system must be enabled via `metrics.enabled`.
4-
If enabled, metrics are exposed at `http://localhost:2112/metrics`.
6+
If enabled, metrics can be scraped by any Prometheus server through the `/metrics`
7+
API of every Serverledge node.
58

6-
You can check that the metrics system is working without starting a Prometheus
7-
server:
9+
If you have a local Serverledge node, you can check that the metrics system is
10+
working without starting a Prometheus server:
811

9-
$ curl 127.0.0.1:2112/metrics
12+
$ curl 127.0.0.1:1323/metrics
1013

14+
If you start a local Prometheus server, you can browse `http://127.0.0.1:9090`.
1115

1216
## Available metrics
1317

14-
A few metrics are currently exposed (just for demonstration purposes):
15-
16-
- `sedge_completed_total`: number of completed invocations (Counter, per function)
17-
- `sedge_exectime`: execution time for each function (Histogram, per function)
18-
19-
20-
## Prometheus Integration
21-
22-
Various Prometheus configurations can be considered to scrape Serverledge
23-
metrics:
24-
25-
- A centralized Prometheus server in the Cloud (likely not scalable...)
26-
- A Prometheus server in each Edge zone
27-
- A Prometheus server in the Cloud with a Prometheus Agent on each Serverledge
28-
node (details below)
29-
30-
### Example: Prometheus Agent + Cloud
31-
32-
As regards the last option, it requires Prometheus instances to use the
33-
following (minimal) configuration.
34-
35-
In the Serverledge node,
36-
Prometheus must be started with `--enable-feature=agent` and the following
37-
lines in the configuration:
38-
39-
remote_write:
40-
- url: "http://<prometheus_cloud_host>:9091/api/v1/write"
41-
42-
Example configuration:
43-
44-
global:
45-
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
46-
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
47-
# scrape_timeout is set to the global default (10s).
48-
49-
# A scrape configuration containing exactly one endpoint to scrape:
50-
scrape_configs:
51-
- job_name: "serverledge"
52-
# metrics_path defaults to '/metrics'
53-
# scheme defaults to 'http'.
54-
static_configs:
55-
- targets: ["<serverledge_host>:2112"]
56-
57-
remote_write:
58-
- url: "http://<prometheus_cloud_host>:9091/api/v1/write"
59-
60-
In the Cloud, Prometheus must be started with `--web.enable-remote-write-receiver`.
61-
Example configuration:
62-
63-
global:
64-
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
65-
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
66-
67-
Example script to launch both Prometheus instances on the same host (for
68-
testing):
69-
70-
docker run \
71-
--name prom \
72-
-d \
73-
-p 9090:9090 \
74-
-v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
75-
prom/prometheus --enable-feature=agent \
76-
--config.file=/etc/prometheus/prometheus.yml
18+
A few metrics are currently updated (see `internal/metrics/metrics.go`).
7719

78-
docker run \
79-
--name promRemote \
80-
-d\
81-
\
82-
-p 9091:9090 \
83-
-v $(pwd)/prometheus_remote.yml:/etc/prometheus/prometheus.yml \
84-
prom/prometheus --web.enable-remote-write-receiver \
85-
--config.file=/etc/prometheus/prometheus.yml
20+
## Configuration
8621

87-
### References
22+
Relevant configuration options:
8823

89-
- [Prometheus Agent Mode](https://prometheus.io/blog/2021/11/16/agent/)
90-
- [Prometheus + Go](https://prometheus.io/docs/guides/go-application/)
24+
- `metrics.prometheus.host`: Prometheus server IP/hostname (for queries)
25+
- `metrics.prometheus.port`: Prometheus server port (for queries)
26+
- `metrics.retriever.interval`: Interval (in seconds) for metrics retrieval from Prometheus

0 commit comments

Comments
 (0)