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

separate shortpoll and longpoll metrics #6

Merged
merged 1 commit into from
Jan 16, 2020

Conversation

zengmin-wish
Copy link
Contributor

This is for https://phab.wish.com/T162969
I suspect some clients are using short polls to poll message which is not efficient. This PR Use a separate apiName to separate shortpolls from long polls (I've thought of using an additional label but this shortpoll/longpoll is specific to the GetMessages api, so this seems better).

defer func() {
s.m.APILatency.WithLabelValues("GetMessages", in.QueueId.Namespace, in.QueueId.Name).Observe(float64(time.Now().Sub(start)))
s.m.APILatency.WithLabelValues(apiName, in.QueueId.Namespace, in.QueueId.Name).Observe(float64(time.Now().Sub(start)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of replacing apiName it seems that it'd be better to add a label saying it was a short poll? My main concern is that previously the apiName matches the actual gRPC api name -- now it doesn't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it's not ideal, but adding a label has its problem too: it means adding the label to all other apis e.g. ‘PublishMessage’, which doesn’t has the poll length parameter. It can be confusing too. My feeling is that the apiName just serves as a label to differential different api calls, so an additional name isn't going to cause true problem. It also means we don't need to change current grafana metrics, the new metric will shows up naturally in existing graphs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that being said, I don't have a strong preference here, so if you do believe adding a label is better, I can do it

@zengmin-wish zengmin-wish merged commit bfe9c7d into master Jan 16, 2020
@tvi tvi deleted the mzeng-shortpoll-metric branch September 25, 2020 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants