Unleash / unleash-edge

MIT License
48 stars 8 forks source link

Edge metrics POST interval grows unexpectedly. #436

Closed chriswk closed 7 months ago

chriswk commented 7 months ago

Describe the bug

After running edge for a while I spotted that it was suddenly sleeping for 62 seconds, and then 64 seconds. Double checking I see that we add jitter to previous interval instead of resetting back to initial configured duration before adding jitter.

Steps to reproduce the bug

  1. Start edge with RUST_LOG=warn,unleash_edge=trace
  2. Observe
    2024-02-29T12:09:33.846888Z TRACE unleash_edge::http::background_send_metrics: Done posting traces. Sleeping for 62 seconds and then going again
    2024-02-29T12:09:33.846888Z TRACE unleash_edge::http::background_send_metrics: Done posting traces. Sleeping for 70 seconds and then going again
  3. ?
  4. Profit?

Expected behavior

Interval should never exceed initial configured interval + max_jitter unless we're erroring. Since all posts succeeded, we probably shouldn't add jitter at all. the normal interval due to random startup times should be enough

Logs, error output, etc.

2024-02-29T12:09:33.846888Z TRACE unleash_edge::http::background_send_metrics: Done posting traces. Sleeping for 70 seconds and then going again

Screenshots

No response

Additional context

No response

Unleash version

Edge 17.1.0

Subscription type

None

Hosting type

None

SDK information (language and version)

No response