Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies in host name for Prometheus metrics #1936

Open
centercirclesolutions opened this issue Nov 1, 2023 · 1 comment
Open

Inconsistencies in host name for Prometheus metrics #1936

centercirclesolutions opened this issue Nov 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@centercirclesolutions
Copy link
Contributor

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
image

Expected behavior
a consistent host name

Environment information:

  • HORNET version: 2.0.1 latest
@centercirclesolutions centercirclesolutions added the bug Something isn't working label Nov 1, 2023
@muXxer
Copy link
Collaborator

muXxer commented Nov 1, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants