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

api: log binned request latencies #676

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

Andrew7234
Copy link
Collaborator

@Andrew7234 Andrew7234 commented Mar 26, 2024

Task

The API layer logs requests but does not log query params:

logger.Info("ending request",

Add those, and add the duration of query, and add a field that categorizes the duration (e.g. <100ms, 100-300ms, 300-1000ms, >1000ms) so we can find expensive queries easily from the logs.

This PR

Adds query params and binned request latency to api logging. Also renames the existing time field to latency.

Copy link
Collaborator

@pro-wh pro-wh left a comment

Choose a reason for hiding this comment

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

as described

cc @lukaw3d @lubej we're going to be logging query parameters

Copy link
Contributor

@mitjat mitjat left a comment

Choose a reason for hiding this comment

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

Thank you!

api/middleware.go Show resolved Hide resolved
"request_id", requestID,
"time", time.Since(t),
Copy link
Contributor

Choose a reason for hiding this comment

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

😲 It was really unexpected to me that GCP just swallows the "time" field. Nice find. Just leaving a comment for posterity :)

api/middleware.go Outdated Show resolved Hide resolved
@Andrew7234 Andrew7234 force-pushed the andrew7234/api-request-timings branch from 01dda2c to 134cfc6 Compare March 27, 2024 19:19
@Andrew7234 Andrew7234 force-pushed the andrew7234/api-request-timings branch from 134cfc6 to d2bd309 Compare March 27, 2024 19:26
@Andrew7234 Andrew7234 merged commit a0fc07e into main Mar 27, 2024
14 checks passed
@Andrew7234 Andrew7234 deleted the andrew7234/api-request-timings branch March 27, 2024 19:43
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.

3 participants