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(assets-controllers): token price service degraded metrics #3691

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Dec 20, 2023

Explanation

The option onDegraded has been added to the CodefiTokenPricesServiceV2 service, which lets us react to situations where the service is still presumed to be available (i.e. there is no outage, the circuit has not broken) but a request failed, or succeeded too slowly. We can use this option to track instances of degraded service in production.

The option degradedThreshold has also been added. This acts as a definition of "degraded service"; if requests are slower than this duration, we consider the service to be degraded.

References

Closes #3689

Changelog

@metamask/assets-controllers

  • Added: Add support to CodefiTokenPricesServiceV2 for tracking degraded service
    • The constructor has two new options: onDegraded and degradedThreshold. onDegraded is an event handler for instances of degraded service (i.e. failed or slow requests), and degradedThreshold determines how slow a request has to be before we consider service to be degraded.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@Gudahtt Gudahtt marked this pull request as ready for review December 20, 2023 16:59
@Gudahtt Gudahtt requested a review from a team as a code owner December 20, 2023 16:59
@Gudahtt Gudahtt force-pushed the track-token-prices-degraded-service branch 2 times, most recently from 17372f3 to 885a731 Compare December 22, 2023 19:19
The option `onDegraded` has been added to the
`CodefiTokenPricesServiceV2` service, which lets us react to situations
where the service is still presumed to be available (i.e. there is no
outage, the circuit has not broken) but a request failed, or succeeded
too slowly. We can use this option to track instances of degraded
service in production.

The option `degradedThreshold` has also been added. This acts as a
definition of "degraded service"; if requests are slower than this
duration, we consider the service to be degraded.

Closes #3689
@Gudahtt Gudahtt force-pushed the track-token-prices-degraded-service branch from 885a731 to a52e340 Compare December 22, 2023 20:28
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Nice! Seems very useful.

@Gudahtt Gudahtt merged commit 896e95c into main Jan 3, 2024
136 checks passed
@Gudahtt Gudahtt deleted the track-token-prices-degraded-service branch January 3, 2024 18:22
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.

[assets-controllers] Allow capturing metrics on degrated token price service
2 participants