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

track response time for http endpoints #1412

Merged
merged 5 commits into from
Oct 23, 2024

Conversation

SimoneDutto
Copy link
Contributor

Description

Add middleware to track response time for HTTP requests.
This can help us understand our performance bottlenecks and improve our observability.

with some work we can use the juju calls' metrics to calculate jimm's overhead

Fixes JIRA/GitHub issue number

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

Test instructions

Notes for code reviewers

@SimoneDutto SimoneDutto requested a review from a team as a code owner October 22, 2024 15:30
Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

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

Thanks for this. The issue is the route label should be populated with a low-cardinality value. This is a limitation with Prometheus, warned against in here. I've explained the workaround in the comments.

internal/servermon/monitoring.go Outdated Show resolved Hide resolved
internal/middleware/responsetime.go Outdated Show resolved Hide resolved
babakks
babakks previously approved these changes Oct 23, 2024
ale8k
ale8k previously approved these changes Oct 23, 2024
Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

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

one small comment but lgtm

}

// MeasureResponseTime tracks response time of requests.
func MeasureResponseTime(next http.Handler) http.Handler {
Copy link
Contributor

Choose a reason for hiding this comment

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

MeasureHTTPResponseTime & explain in godoc it doens't track websockets

@SimoneDutto SimoneDutto dismissed stale reviews from ale8k and babakks via 736b850 October 23, 2024 10:21
Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

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

tyty

}

// MeasureHTTPResponseTime tracks response time of HTTP requests.
// We don't track websocket requests.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks

@SimoneDutto SimoneDutto merged commit 1ef9fb8 into canonical:v3 Oct 23, 2024
4 checks passed
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.

4 participants