GetLatestWatcherMetrics: 15m requests never fall back to the 5m window

Open Beginner friendly
#86 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
observability

Research direction

Start in pkg/watcher/watcher.go at GetLatestWatcherMetrics, around lines 188–207, and compare the doc comment with the fallback conditions. Verify the 15m request behavior when the 15m and 10m buffers are empty but the 5m buffer has data. Done means the documented fallback behavior and implementation agree, with an error only when no applicable buffer contains data.

Written by the indexing model from the issue text.

Description

The doc comment on GetLatestWatcherMetrics describes a 15m → 10m → 5m fallback, but a request for the 15 minute window can only fall back to the 10 minute window. If both the 15m and 10m buffers are empty, the call returns an error even when the 5m buffer holds data.

https://github.com/paypal/load-watcher/blob/bc53c7ca906ea8d0b41f630e4e9e414edb5ef3c9/pkg/watcher/watcher.go#L188-L207

For duration == FifteenMinutes, the third case condition (duration == TenMinutes || duration == FiveMinutes) never evaluates to true, so the 5 minute buffer is unreachable regardless of its contents.

Is the current behaviour intentional, or should the third case also accept FifteenMinutes?

I'm happy to send a PR for whichever you prefer — adjusting the condition, or the comment.

Dominant language
Go
Stars
78
Forks
38
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from paypal/load-watcher

All issues in paypal/load-watcher

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.