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

frontend: refactor metrics #1413

Merged
merged 1 commit into from
Feb 27, 2025
Merged

frontend: refactor metrics #1413

merged 1 commit into from
Feb 27, 2025

Conversation

simonpasquier
Copy link
Collaborator

What this PR does

This commit refactors the frontend service to report more sensible and useful metrics.

The visible changes are:

  • The endpoint label of the frontend_health gauge metric is dropped.
  • The frontend_requests_total gauge metric is renamed to frontend_http_requests_total (counter).
  • The frontend_duration gauge metric is renamed to frontend_http_requests_duration_seconds (histogram).

The histogram buckets have been chosen to match the MSFT requirements in terms of latency: [0.25s, 0.5s, 1s, 2.5s, 5s, 10s].

Jira:
Link to demo recording:

Special notes for your reviewer

@simonpasquier simonpasquier force-pushed the refactor-frontend-http-metrics branch from 39d876d to 7966ad8 Compare February 26, 2025 16:11
Copy link

Please rebase pull request.

@simonpasquier
Copy link
Collaborator Author

Tested in my dev environment in conjunction with #1420

image

Copy link
Collaborator

@mbarnes mbarnes left a comment

Choose a reason for hiding this comment

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

Raised a couple stupid nits but overall love what you've done here, especially with the test code.

}

func (c *ContextError) Error() string {
return fmt.Sprintf(
"error retrieving value from context, value obtained was '%v' and type obtained was '%T'",
"error retrieving value for key %q from context, value obtained was '%v' and type obtained was '%T'",
c.key,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice.

Copy link
Collaborator

@mbarnes mbarnes Feb 27, 2025

Choose a reason for hiding this comment

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

Appreciate the refactoring of the context API. I won't ask for it this time but in the future it would be good to split refactoring into one or more focused commits for easier review. There's a lot packed into this one commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, I got a bit too enthusiastic here.

This commit refactors the frontend service to report more sensible and
useful metrics.

The visible changes are:
* The `endpoint` label of the `frontend_health` gauge metric is dropped.
* The `frontend_requests_total` gauge metric is renamed to
  `frontend_http_requests_total` (counter).
* The `frontend_duration` gauge metric is renamed to
  `frontend_http_requests_duration_seconds` (histogram).

The histogram buckets have been chosen to match the MSFT requirements in
terms of latency: [0.25s, 0.5s, 1s, 2.5s, 5s, 10s].

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@simonpasquier simonpasquier force-pushed the refactor-frontend-http-metrics branch from f991ced to 4e0f4c2 Compare February 27, 2025 16:45
@mbarnes mbarnes merged commit 1e49660 into main Feb 27, 2025
22 checks passed
@mbarnes mbarnes deleted the refactor-frontend-http-metrics branch February 27, 2025 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants