Skip to content

Commit e34c28d

Browse files
hsanjuanlidel
andauthored
fix: expose routing_http_client* metrics (#262)
* Expose routing_http_client* metrics These metrics are using opencensus, so the part that plugs opencensus to prometheus was missing. Setup inspired by what Kubo does. With this, the metrics will appear in the form `ipfs_routing_http_client_*`. Verified that it works by hand. Fixes #261 --------- Co-authored-by: Marcin Rataj <[email protected]>
1 parent 0e505f1 commit e34c28d

File tree

5 files changed

+374
-0
lines changed

5 files changed

+374
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ The following emojis are used to highlight certain changes:
1919

2020
### Fixed
2121

22+
* Fix exporting of routing http client metrics: the endpoint will now include `ipfs_routing_http_client_*` metrics routing clients are used. See [docs/metrics.md](https://github.com/ipfs/rainbow/blob/main/docs/metrics.md) for more details.
23+
2224
### Removed
2325

2426
### Security

docs/metrics.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## rainbow metrics
2+
3+
By default, a prometheus endpoint is exposed by Rainbow at `http://127.0.0.1:8091/debug/metrics/prometheus`.
4+
5+
It includes default [Prometheus Glient metrics](https://prometheus.io/docs/guides/go-application/) + rainbow-specific listed below.
6+
7+
### Delegated HTTP Routing (`/routing/v1`) client
8+
9+
Metrics from `boxo/routing/http/client` are exposed with `ipfs_` prefix:
10+
11+
- Histogram: the latency of operations by the routing HTTP client:
12+
- `ipfs_routing_http_client_latency_bucket{code,error,host,operation,le}`
13+
- `ipfs_routing_http_client_latency_sum{code,error,host,operation}`
14+
- `ipfs_routing_http_client_latency_count{code,error,host,operation}`
15+
- Histogram: the number of elements in a response collection
16+
- `ipfs_routing_http_client_length_bucket{host,operation,le}`
17+
- `ipfs_routing_http_client_length_sum{host,operation}`
18+
- `ipfs_routing_http_client_length_count{host,operation}`
19+

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/ipfs/rainbow
33
go 1.24
44

55
require (
6+
contrib.go.opencensus.io/exporter/prometheus v0.4.2
67
github.com/cockroachdb/pebble v1.1.4
78
github.com/coreos/go-systemd/v22 v22.5.0
89
github.com/dgraph-io/badger/v4 v4.5.1
@@ -83,6 +84,8 @@ require (
8384
github.com/gammazero/chanqueue v1.1.0 // indirect
8485
github.com/gammazero/deque v1.0.0 // indirect
8586
github.com/getsentry/sentry-go v0.27.0 // indirect
87+
github.com/go-kit/log v0.2.1 // indirect
88+
github.com/go-logfmt/logfmt v0.5.1 // indirect
8689
github.com/go-logr/logr v1.4.2 // indirect
8790
github.com/go-logr/stdr v1.2.2 // indirect
8891
github.com/go-ole/go-ole v1.3.0 // indirect
@@ -183,6 +186,7 @@ require (
183186
github.com/prometheus/client_model v0.6.1 // indirect
184187
github.com/prometheus/common v0.62.0 // indirect
185188
github.com/prometheus/procfs v0.15.1 // indirect
189+
github.com/prometheus/statsd_exporter v0.22.7 // indirect
186190
github.com/quic-go/qpack v0.5.1 // indirect
187191
github.com/quic-go/quic-go v0.50.1 // indirect
188192
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66 // indirect
@@ -231,6 +235,7 @@ require (
231235
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
232236
google.golang.org/grpc v1.67.1 // indirect
233237
google.golang.org/protobuf v1.36.5 // indirect
238+
gopkg.in/yaml.v2 v2.4.0 // indirect
234239
gopkg.in/yaml.v3 v3.0.1 // indirect
235240
lukechampine.com/blake3 v1.4.0 // indirect
236241
)

0 commit comments

Comments
 (0)