Handler that returns HTTP 200 if the service is OK and able to process requests.
Uses components::State::IsAnyComponentInFatalState() to detect fatal state (can not process requests).
Static options:
Inherits all the options from server::handlers::HttpHandlerBase HTTP Handlers and adds the following ones:
Name | Description | Default value |
warmup-time-secs | how much time it needs to warmup the server | 0 |
- Examples
- samples/production_service/production_service.cpp.
Definition at line 29 of file ping.hpp.
|
| Ping (const components::ComponentConfig &config, const components::ComponentContext &component_context) |
|
std::string | HandleRequestThrow (const http::HttpRequest &request, request::RequestContext &context) const override |
|
void | OnAllComponentsLoaded () override |
|
Public Member Functions inherited from server::handlers::HttpHandlerBase |
| HttpHandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) |
|
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 |
|
virtual FormattedErrorData | GetFormattedExternalErrorBody (const CustomHandlerException &exc) 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) const |
| Helper function to log an unknown exception.
|
|
const std::optional< logging::Level > & | GetLogLevel () const |
| Returns the default log level for the handler.
|
|
Public Member Functions inherited from server::handlers::HandlerBase |
| HandlerBase (const components::ComponentConfig &config, const components::ComponentContext &component_context, bool is_monitor=false) |
|
bool | IsMonitor () const |
| Returns whether this is a monitoring handler.
|
|
const HandlerConfig & | GetConfig () const |
| Returns handler config.
|
|
| LoggableComponentBase (const ComponentConfig &, const ComponentContext &) |
|
| LoggableComponentBase (LoggableComponentBase &&)=delete |
|
| LoggableComponentBase (const LoggableComponentBase &)=delete |
|
| ~LoggableComponentBase () override=default |
|
ComponentHealth | GetComponentHealth () const override |
|
void | OnLoadingCancelled () override |
|
void | OnAllComponentsLoaded () override |
|
void | OnAllComponentsAreStopping () override |
|