#include <userver/alerts/source.hpp>
Alert source instance which is used to fire alerts via metrics for a specified amount of time.
To declare an alert:
Tu fire or to stop an alert:
For non alert-metrics consider using utils::statistics::MetricTag.
Definition at line 36 of file source.hpp.
Public Member Functions | |
Source (std::string_view name) | |
void | FireAlert (utils::statistics::MetricsStorage &storage, std::chrono::seconds duration=kDefaultDuration) const |
Fire alert for duration seconds. | |
void | StopAlertNow (utils::statistics::MetricsStorage &storage) const |
Stop fired alert. | |
Static Public Attributes | |
static constexpr std::chrono::seconds | kDefaultDuration {120} |
static constexpr std::chrono::hours | kInfiniteDuration {24 * 365 * 10} |
|
explicit |
Constructs an alert source instance that will be reported as non-zero "alerts." + std::string{name} metric in case of error
|
staticconstexpr |
Definition at line 38 of file source.hpp.
|
staticconstexpr |
Definition at line 39 of file source.hpp.