Skip to content

add metrics to every route in queries, search, and trending#798

Merged
vicky-g merged 3 commits into
masterfrom
vg-add-metrics-queries
Sep 3, 2020
Merged

add metrics to every route in queries, search, and trending#798
vicky-g merged 3 commits into
masterfrom
vg-add-metrics-queries

Conversation

@vicky-g
Copy link
Copy Markdown
Contributor

@vicky-g vicky-g commented Sep 3, 2020

Trello Card Link

https://trello.com/c/0OifTiUk/1527-api-add-route-metrics-logging-to-each-endpoint

Description

Add metrics logging for every route in queries.py

Services

  • Discovery Provider
  • Creator Node
  • Identity Service
  • Libs
  • Contracts

Does it touch a critical flow like Discovery indexing, Creator Node track upload, Creator Node gateway, or Creator Node file system?

  • ✅ Nope

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.
Include log analysis if applicable.

  1. setup local services
  2. add @record_metrics annotations
  3. hit any routes with new annotation
  4. check redis keys that each of my disc prov visits is recorded

Note my previous visits to /users, /tracks:

127.0.0.1:6379> HGETALL API_METRICS:routes:172.21.0.1:2020/09/02:23
1) "/v1/tracks/search"
2) "1"
3) "/v1/tracks/trending"
4) "2"
5) "/users"
6) "2"
7) "/tracks"
8) "1"

After refreshing the page at /tracks:

127.0.0.1:6379> HGETALL API_METRICS:routes:172.21.0.1:2020/09/02:23
1) "/v1/tracks/search"
2) "1"
3) "/v1/tracks/trending"
4) "2"
5) "/users"
6) "2"
7) "/tracks"
8) "2"           // this incremented by 1!

@raymondjacobson
Copy link
Copy Markdown
Member

Awesome! Looks good. I think there are a couple more spots in search & trending, but if you follow the same pattern LGTM! thank you :)

@vicky-g vicky-g changed the title add metrics to every route in queries.py add metrics to every route in queries, search, and trending Sep 3, 2020
@vicky-g vicky-g merged commit 78c56ab into master Sep 3, 2020
@vicky-g vicky-g deleted the vg-add-metrics-queries branch September 3, 2020 00:17
@vicky-g vicky-g mentioned this pull request Sep 9, 2020
5 tasks
raymondjacobson added a commit that referenced this pull request Jun 1, 2026
## Summary
- advance Latest feed pagination by the number of mixed feed items
returned, not only tracks
- align the client offset with the API contract for /v1/users/{id}/feed,
which applies OFFSET over tracks + collections
- prevents overlapping/repeated pages when collections are present in
the feed

## Context
Past commits introduced mixed feed rendering and then changed Latest
feed pagination to count only track entries. That makes the client
request page 2 with an offset that is too small whenever page 1 includes
collections. Example: 6 tracks + 4 collections with limit 10 requests
offset 6 instead of 10, so the next API page overlaps already-rendered
items and can make pagination feel stuck.

The API history also shows separate server-side feed perf fixes (#798
for Latest feed planner cliffs, #805/#806/#817 for For You timeouts).
This PR addresses the current client-side mixed-item offset mismatch.

## Testing
- git diff --check

Could not run TypeScript locally because this worktree has no
node_modules and the shell has node but no npm/npx installed.
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