#include <userver/alerts/handler.hpp>
Handler that returns the list of active fired alerts.
Definition at line 16 of file handler.hpp.
|
| Handler (const components::ComponentConfig &config, const components::ComponentContext &context) |
|
formats::json::Value | HandleRequestJsonThrow (const server::http::HttpRequest &request, const formats::json::Value &request_json, server::request::RequestContext &context) const override |
|
std::string | HandleRequestThrow (const http::HttpRequest &request, request::RequestContext &context) const final |
|
void | HandleRequest (request::RequestBase &request, request::RequestContext &context) const override |
|
void | ReportMalformedRequest (request::RequestBase &request) const final |
|
virtual const std::string & | HandlerName () const |
|
const std::vector< http::HttpMethod > & | GetAllowedMethods () const |
|
virtual logging::Level | GetLogLevelForResponseStatus (http::HttpStatus status) const |
|
std::string | GetResponseDataForLoggingChecked (const http::HttpRequest &request, request::RequestContext &context, const std::string &response_data) const |
|
void | HandleCustomHandlerException (const http::HttpRequest &request, const CustomHandlerException &ex) const |
|
void | HandleUnknownException (const http::HttpRequest &request, const std::exception &ex) const |
|
void | LogUnknownException (const std::exception &ex, std::optional< logging::Level > log_level_override={}) const |
| Helper function to log an unknown exception.
|
|
const std::optional< logging::Level > & | GetLogLevel () const |
| Returns the default log level for the handler.
|
|
bool | IsMonitor () const |
| Returns whether this is a monitoring handler.
|
|
const HandlerConfig & | GetConfig () const |
| Returns handler config.
|
|
ComponentHealth | GetComponentHealth () const override |
|
void | OnLoadingCancelled () override |
|
void | OnAllComponentsLoaded () override |
|
void | OnAllComponentsAreStopping () override |
|
|
static constexpr std::string_view | kName = "handler-fired-alerts" |
| The default name of alerts::Handler.
|
|
◆ ClientError
◆ ExternalBody
◆ HandlerErrorCode
◆ InternalMessage
◆ InternalServerError
◆ LoggableComponentBase
◆ GetComponentHealth()
ComponentHealth components::ComponentBase::GetComponentHealth |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ GetLogLevelForResponseStatus()
Override it if you need a custom logging level for messages about finish of request handling for some http statuses.
◆ GetRequestBodyForLogging()
|
protectedvirtualinherited |
◆ GetRequestJson()
- Returns
- A pointer to json request if it was parsed successfully or nullptr otherwise.
◆ GetResponseDataForLogging()
|
protectedvirtualinherited |
◆ GetResponseJson()
- Returns
- a pointer to json response if it was returned successfully by
HandleRequestJsonThrow()
or nullptr otherwise.
◆ HandleCustomHandlerException()
Takes the exception and formats it into response, as specified by exception.
◆ HandleRequest()
◆ HandleRequestJsonThrow()
◆ HandleRequestThrow()
The core method for HTTP request handling. request
arg contains HTTP headers, full body, etc. The method should return response body.
- Note
- It is used only if IsStreamed() returned
false
.
Reimplemented from server::handlers::HttpHandlerBase.
◆ HandleStreamRequest()
|
protectedvirtualinherited |
The core method for HTTP request handling. request
arg contains HTTP headers, full body, etc. The response body is passed in parts to ResponseBodyStream
. Stream transmission is useful when: 1) The body size is unknown beforehand. 2) The client may take advantage of early body transmission (e.g. a Web Browser may start rendering the HTML page or downloading dependant resources). 3) The body size is huge and we want to have only a part of it in memory.
- Note
- It is used only if IsStreamed() returned
true
.
◆ HandleUnknownException()
void server::handlers::HttpHandlerBase::HandleUnknownException |
( |
const http::HttpRequest & | request, |
|
|
const std::exception & | ex ) const |
|
inherited |
Takes the exception and formats it into response as an internal server error.
◆ IsMethodStatisticIncluded()
virtual bool server::handlers::HttpHandlerBase::IsMethodStatisticIncluded |
( |
| ) |
const |
|
inlineprotectedvirtualinherited |
Override it to show per HTTP-method statistics besides statistics for all methods
Definition at line 154 of file http_handler_base.hpp.
◆ IsMonitor()
bool server::handlers::HandlerBase::IsMonitor |
( |
| ) |
const |
|
inlineinherited |
Returns whether this is a monitoring handler.
Definition at line 67 of file handler_base.hpp.
◆ IsStreamed()
virtual bool server::handlers::HttpHandlerBase::IsStreamed |
( |
| ) |
const |
|
inlineprotectedvirtualinherited |
◆ NeedCheckAuth()
virtual bool server::handlers::HttpHandlerBase::NeedCheckAuth |
( |
| ) |
const |
|
inlineprotectedvirtualinherited |
Override it if you want to disable auth checks in handler by some condition
Definition at line 158 of file http_handler_base.hpp.
◆ OnAllComponentsAreStopping()
void components::ComponentBase::OnAllComponentsAreStopping |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ OnAllComponentsLoaded()
void components::ComponentBase::OnAllComponentsLoaded |
( |
| ) |
|
|
inlineoverridevirtualinherited |
◆ OnLoadingCancelled()
void components::ComponentBase::OnLoadingCancelled |
( |
| ) |
|
|
inlineoverridevirtualinherited |
Called once if the creation of any other component failed. If the current component expects some other component to take any action with the current component, this call is a signal that such action may never happen due to components loading was cancelled. Application components might not want to override it.
Reimplemented from components::RawComponentBase.
Definition at line 42 of file component_base.hpp.
◆ ParseRequestData()
|
overrideprotectedvirtualinherited |
◆ ReportMalformedRequest()
Produces response to a request unrecognized by the protocol based on provided generic response. Does not throw.
Reimplemented from server::handlers::HandlerBase.
The documentation for this class was generated from the following file: