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

Client metrics counter is not updated in the Web API end-point #773

Open
dmacvicar opened this issue May 19, 2021 · 0 comments
Open

Client metrics counter is not updated in the Web API end-point #773

dmacvicar opened this issue May 19, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@dmacvicar
Copy link
Contributor

The client metrics are updated with a server interceptor.

	auth.UpdateMetrics = func(ctx context.Context) { Metrics.UpdateClientMetrics(ctx) }

Which calls the function in metrics.go to update the metrics based on the context peer data:

// UpdateClientMetrics ...
func (mc *MetricsCollection) UpdateClientMetrics(ctx context.Context) {
	p, ok := peer.FromContext(ctx)
	if ok && p != nil {
		ipAndPort := strings.Split(p.Addr.String(), ":")
		if len(ipAndPort) > 0 {
			mc.RPCsPerClientCounters.WithLabelValues(ipAndPort[0]).Inc()
			mc.LastMessageAtPerClientGauges.WithLabelValues(ipAndPort[0]).SetToCurrentTime()
		}
	}
}

We need to add a similar middleware to the Web API handler, so that these metrics get updated here as well.

At the moment it is not significant as people won't add much data from the console, but once we make the embedded REST API more visible, it will.

@dmacvicar dmacvicar added the bug Something isn't working label May 19, 2021
@dmacvicar dmacvicar added this to the v1.0.1 milestone May 19, 2021
@zaza81 zaza81 modified the milestones: v1.0.1, v1.3 Dec 16, 2021
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