hornet
hornet copied to clipboard
Inconsistencies in host name for Prometheus metrics
Describe the bug This affects several Hornet components so I am putting this issue here. inx-indexer and hornet sometimes report the host differently which could cause issues in aggregation.
To Reproduce
Expected behavior a consistent host name
Environment information:
- HORNET version: 2.0.1 latest
This function here can be used to overwrite the "host mapping":
RequestCounterHostLabelMappingFunc: func(c echo.Context) string {
return c.Request().Host
},
So for example in inx-indexer
in components/prometheus/component.go
you have to modify this part:
p := echoprometheus.NewPrometheus("iota_restapi", nil)
+ p.RequestCounterHostLabelMappingFunc = func(c echo.Context) string {
+ // add you own mapping logic here
+ return c.Request().Host
+ }
for _, m := range p.MetricsList {
registry.MustRegister(m.MetricCollector)
}
deps.Echo.Use(p.HandlerFunc)
If you find something generic that makes sense in this context, we can have a look if we change that everywhere.