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

feat: log finch pool health stats periodically #191

Merged
merged 3 commits into from
Sep 16, 2024
Merged

Conversation

KaylaBrady
Copy link
Collaborator

Summary

No ticket, but identified as an observability improvement while working on
Predictions Scalability: new channel that publishes predictions updates in chunks.

What is this PR for?
We suspect there are some issues with request pooling based on unexpectedly slow req response logs under load testing. This will help us identify if that is the case (slack thread)

@KaylaBrady KaylaBrady requested a review from a team as a code owner September 13, 2024 20:50
@KaylaBrady KaylaBrady requested review from boringcactus and removed request for a team September 13, 2024 20:50
@@ -131,7 +131,7 @@ defmodule MBTAV3API.Stream.Instance do

consumer_subscribers =
if consumer_dest do
Registry.count_match(MBTAV3API.Stream.PubSub, consumer_dest, :_)
Registry.lookup(MBTAV3API.Stream.PubSub, consumer_dest)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tiny add in while looking at the existing health logs. I've noticed some timeouts while reporting these health logs:

62db153750ed 21:18:03.911 [error] GenServer #PID<0.2135.0> terminating
62db153750ed ** (stop) exited in: :sys.get_state(#PID<0.3383.0>)
62db153750ed ** (EXIT) time out
62db153750ed (stdlib 5.1.1) sys.erl:340: :sys.send_system_msg/2
62db153750ed (stdlib 5.1.1) sys.erl:139: :sys.get_state/1
62db153750ed (mobile_app_backend 0.1.0) lib/mbta_v3_api/stream/instance.ex:104: MBTAV3API.Stream.Instance.stage_health/1
62db153750ed (mobile_app_backend 0.1.0) lib/mbta_v3_api/stream/instance.ex:85: MBTAV3API.Stream.Instance.check_health/1
62db153750ed (mobile_app_backend 0.1.0) lib/mbta_v3_api/stream/supervisor.ex:34: anonymous fn/2 in MBTAV3API.Stream.Supervisor.log_health/0
62db153750ed (elixir 1.15.7) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
62db153750ed (mobile_app_backend 0.1.0) lib/mbta_v3_api/stream/supervisor.ex:33: MBTAV3API.Stream.Supervisor.log_health/0
62db153750ed (mobile_app_backend 0.1.0) lib/mbta_v3_api/stream/health.ex:19: MBTAV3API.Stream.Health.handle_info/2

Since we only care about the registry key, lookup should be faster than scanning to match the full registry.

Copy link

Coverage of commit 93f0f7f

Summary coverage rate:
  lines......: 78.6% (1199 of 1526 lines)
  functions..: 76.5% (524 of 685 functions)
  branches...: no data found

Files changed coverage rate:
                                                                         |Lines       |Functions  |Branches    
  Filename                                                               |Rate     Num|Rate    Num|Rate     Num
  =============================================================================================================
  lib/mbta_v3_api/stream/instance.ex                                     |82.6%     46|75.0%     8|    -      0
  lib/mobile_app_backend/application.ex                                  |83.3%      6|50.0%     2|    -      0
  lib/mobile_app_backend/finch_pool_health.ex                            | 100%     12| 100%     3|    -      0

Download coverage report

Copy link

Coverage of commit 8e33185

Summary coverage rate:
  lines......: 78.6% (1199 of 1526 lines)
  functions..: 76.5% (524 of 685 functions)
  branches...: no data found

Files changed coverage rate:
                                                                         |Lines       |Functions  |Branches    
  Filename                                                               |Rate     Num|Rate    Num|Rate     Num
  =============================================================================================================
  lib/mbta_v3_api/stream/instance.ex                                     |82.6%     46|75.0%     8|    -      0
  lib/mobile_app_backend/application.ex                                  |83.3%      6|50.0%     2|    -      0
  lib/mobile_app_backend/finch_pool_health.ex                            | 100%     12| 100%     3|    -      0

Download coverage report

@KaylaBrady KaylaBrady merged commit a627608 into main Sep 16, 2024
5 checks passed
@KaylaBrady KaylaBrady deleted the kb-pool-logs branch September 16, 2024 17:52
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