Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature/app 183 add logging to search endpoint #287

Merged

Conversation

odrakes-cpr
Copy link
Contributor

@odrakes-cpr odrakes-cpr commented Jan 30, 2025

Description

Add logging to the search endpoint, we want to not only measure the time it takes to run a query but use this metric to determine if a fix has made a viable improvement for our users.

Proposed version

Please select the option below that is most relevant from the list below. This
will be used to generate the next tag version name during auto-tagging.

  • Skip auto-tagging
  • Patch
  • Minor version
  • Major version

Visit the Semver website to understand the
difference between MAJOR, MINOR, and PATCH versions.

Notes:

  • If none of these options are selected, auto-tagging will fail
  • Where multiple options are selected, the most senior option ticked will be
    used -- e.g. Major > Minor > Patch
  • If you are selecting the version in the list above using the textbox, make
    sure your selected option is marked [x] with no spaces in between the
    brackets and the x

Type of change

Please select the option(s) below that are most relevant:

  • Bug fix
  • New feature
  • Breaking change
  • GitHub workflow update
  • Documentation update
  • Remove legacy code
  • Dependency update

How Has This Been Tested?

Please describe the tests that you added to verify your changes.

Reviewer Checklist

  • DB_CLIENT DEPENDENCY IS ON THE LATEST VERSION
  • The PR represents a single feature (small drive-by fixes are also ok)
  • The PR includes tests that are sufficient for the level of risk
  • The code is sufficiently commented, particularly in hard-to-understand areas
  • Any required documentation updates have been made
  • Any TODOs added are captured in future tickets
  • No FIXMEs remain

Osneil Drakes and others added 5 commits January 13, 2025 17:10
- our search endpoint is running pretty slow, adding some logging to see
  the time it takes to run the query. We suspect this is related to the
joins added for multi geos.
@odrakes-cpr odrakes-cpr requested a review from a team as a code owner January 30, 2025 13:22
Copy link

linear bot commented Jan 30, 2025

@odrakes-cpr odrakes-cpr changed the title Feature/app 183 fix slow family endpoint in the admin service Feature/app 183 add logging to search endpoint Jan 30, 2025
Copy link
Contributor

@jamesgorrie jamesgorrie left a comment

Choose a reason for hiding this comment

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

Note on logging - also wondered as a secondary step we might just add a middleware that does this?

app/repository/family.py Outdated Show resolved Hide resolved
print may get swallowed up and not come through in the logs
@odrakes-cpr
Copy link
Contributor Author

Note on logging - also wondered as a secondary step we might just add a middleware that does this?

Updated accordingly.

It adds response_time_ms

{"written_at": "2025-02-03T10:35:16.587Z", "written_ts": 1738578916587310000, "type": "request", "correlation_id": "8ee06d94-e21a-11ef-b24c-0242ac120003", "remote_user": "-", "request": "/api/v1/families/", "referer": "-", "x_forwarded_for": "-", "protocol": "HTTP/1.1", "method": "GET", "remote_ip": "172.18.0.1", "request_size_b": -1, "remote_host": "172.18.0.1", "remote_port": 58306, "request_received_at": "2025-02-03T10:35:14.574Z", "response_time_ms": 2012, "response_status": 200, "response_size_b": "835470", "response_content_type": "application/json", "response_sent_at": "2025-02-03T10:35:16.587Z"}

Osneil Drakes added 6 commits February 3, 2025 10:40
this adds a timing function to the middleware which will record response time on our requests, had to update some dependencies
- this is handled by the middle ware and makes no sense to duplicate
app/main.py Outdated Show resolved Hide resolved
Copy link
Contributor

@katybaulch katybaulch left a comment

Choose a reason for hiding this comment

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

great find - love the middleware!

@odrakes-cpr odrakes-cpr merged commit 6a11388 into main Feb 3, 2025
10 checks passed
@odrakes-cpr odrakes-cpr deleted the feature/app-183-fix-slow-family-endpoint-in-the-admin-service branch February 3, 2025 11:27
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants