Skip to content

Commit b578718

Browse files
authored
chore: change metrics default port from 9000 to 9001 (#3295)
1 parent 4dd9c9b commit b578718

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ WORKDIR app
3333
# Copy reth over from the build stage
3434
COPY --from=builder /app/target/release/reth /usr/local/bin
3535

36-
EXPOSE 30303 30303/udp 9000 8545 8546
36+
EXPOSE 30303 30303/udp 9001 8545 8546
3737
ENTRYPOINT ["/usr/local/bin/reth"]

Dockerfile.cross

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ ARG TARGETARCH
1111

1212
COPY ./dist/bin/$TARGETARCH/reth /usr/local/bin/reth
1313

14-
EXPOSE 30303 30303/udp 9000 8545 8546
14+
EXPOSE 30303 30303/udp 9001 8545 8546
1515
ENTRYPOINT ["/usr/local/bin/reth"]

bin/reth/src/node/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -781,14 +781,14 @@ mod tests {
781781

782782
#[test]
783783
fn parse_metrics_port() {
784-
let cmd = Command::try_parse_from(["reth", "--metrics", "9000"]).unwrap();
785-
assert_eq!(cmd.metrics, Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9000)));
784+
let cmd = Command::try_parse_from(["reth", "--metrics", "9001"]).unwrap();
785+
assert_eq!(cmd.metrics, Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9001)));
786786

787-
let cmd = Command::try_parse_from(["reth", "--metrics", ":9000"]).unwrap();
788-
assert_eq!(cmd.metrics, Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9000)));
787+
let cmd = Command::try_parse_from(["reth", "--metrics", ":9001"]).unwrap();
788+
assert_eq!(cmd.metrics, Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9001)));
789789

790-
let cmd = Command::try_parse_from(["reth", "--metrics", "localhost:9000"]).unwrap();
791-
assert_eq!(cmd.metrics, Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9000)));
790+
let cmd = Command::try_parse_from(["reth", "--metrics", "localhost:9001"]).unwrap();
791+
assert_eq!(cmd.metrics, Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9001)));
792792
}
793793

794794
#[test]

book/run/observability.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
Reth exposes a number of metrics, which are listed [here][metrics]. We can serve them from an HTTP endpoint by adding the `--metrics` flag:
44

55
```bash
6-
RUST_LOG=info reth node --metrics 127.0.0.1:9000
6+
RUST_LOG=info reth node --metrics 127.0.0.1:9001
77
```
88

99
Now, as the node is running, you can `curl` the endpoint you provided to the `--metrics` flag to get a text dump of the metrics at that time:
1010

1111
```bash
12-
curl 127.0.0.1:9000
12+
curl 127.0.0.1:9001
1313
```
1414

1515
The response from this is quite descriptive, but it can be a bit verbose. Plus, it's just a snapshot of the metrics at the time that you `curl`ed the endpoint.
1616

1717
You can run the following command in a separate terminal to periodically poll the endpoint, and just print the values (without the header text) to the terminal:
1818

1919
```bash
20-
while true; do date; curl -s localhost:9000 | grep -Ev '^(#|$)' | sort; echo; sleep 10; done
20+
while true; do date; curl -s localhost:9001 | grep -Ev '^(#|$)' | sort; echo; sleep 10; done
2121
```
2222

2323
We're finally getting somewhere! As a final step, though, wouldn't it be great to see how these metrics progress over time (and generally, in a GUI)?
@@ -43,13 +43,13 @@ brew services start prometheus
4343
brew services start grafana
4444
```
4545

46-
This will start a Prometheus service which by default scrapes the metrics exposed at `localhost:9000`. If you launched reth with a different `--metrics` endpoint, you can change the Prometheus config file at `/usr/local/etc/prometheus/prometheus.yml` to point to the correct endpoint, and then restart the Prometheus service. You can also stop the service and launch Prometheus with a custom `prometheus.yml` like the one provided under [`etc/prometheus/prometheus.yml`](https://github.com/paradigmxyz/reth/blob/main/etc/prometheus/prometheus.yml) in this repo.
46+
This will start a Prometheus service which by default scrapes the metrics exposed at `localhost:9001`. If you launched reth with a different `--metrics` endpoint, you can change the Prometheus config file at `/usr/local/etc/prometheus/prometheus.yml` to point to the correct endpoint, and then restart the Prometheus service. You can also stop the service and launch Prometheus with a custom `prometheus.yml` like the one provided under [`etc/prometheus/prometheus.yml`](https://github.com/paradigmxyz/reth/blob/main/etc/prometheus/prometheus.yml) in this repo.
4747

4848
Next, open up "localhost:3000" in your browser, which is the default URL for Grafana. Here, "admin" is the default for both the username and password.
4949

5050
Once you've logged in, click on the gear icon in the lower left, and select "Data Sources". Click on "Add data source", and select "Prometheus" as the type. In the HTTP URL field, enter `http://localhost:9090`, this is the default endpoint for the Prometheus scrape endpoint. Finally, click "Save & Test".
5151

52-
As this might be a point of confusion, `localhost:9000`, which we supplied to `--metrics`, is the endpoint that Reth exposes, from which Prometheus collects metrics. Prometheus then exposes `localhost:9090` (by default) for other services (such as Grafana) to consume Prometheus metrics.
52+
As this might be a point of confusion, `localhost:9001`, which we supplied to `--metrics`, is the endpoint that Reth exposes, from which Prometheus collects metrics. Prometheus then exposes `localhost:9090` (by default) for other services (such as Grafana) to consume Prometheus metrics.
5353

5454
To configure the dashboard in Grafana, click on the squares icon in the upper left, and click on "New", then "Import". From there, click on "Upload JSON file", and select the example file in `reth/etc/grafana/overview.json`. Finally, select the Prometheus data source you just created, and click "Import".
5555

etc/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The files in this directory may undergo a lot of changes while reth is unstable,
1212
### Docker Compose
1313

1414
To run Grafana dashboard with example dashboard and pre-configured Prometheus data source pointing at
15-
the locally running Reth instance with metrics exposed on `localhost:9000`:
15+
the locally running Reth instance with metrics exposed on `localhost:9001`:
1616
```sh
1717
docker compose -p reth -f ./etc/docker-monitoring.yml up
1818
```

etc/prometheus/prometheus.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ scrape_configs:
33
metrics_path: "/"
44
scrape_interval: 5s
55
static_configs:
6-
- targets: ['localhost:9000', 'host.docker.internal:9000']
6+
- targets: ['localhost:9001', 'host.docker.internal:9001']

0 commit comments

Comments
 (0)