ESPHome 2025.5.0
|
#include <prometheus_handler.h>
Public Member Functions | |
PrometheusHandler (web_server_base::WebServerBase *base) | |
void | set_include_internal (bool include_internal) |
Determine whether internal components should be exported as metrics. | |
void | add_label_id (EntityBase *obj, const std::string &value) |
Add the value for an entity's "id" label. | |
void | add_label_name (EntityBase *obj, const std::string &value) |
Add the value for an entity's "name" label. | |
bool | canHandle (AsyncWebServerRequest *request) override |
void | handleRequest (AsyncWebServerRequest *req) override |
void | setup () override |
float | get_setup_priority () const override |
![]() | |
virtual void | loop () |
This method will be called repeatedly. | |
virtual void | dump_config () |
float | get_actual_setup_priority () const |
void | set_setup_priority (float priority) |
virtual float | get_loop_priority () const |
priority of loop(). | |
void | call () |
virtual void | on_shutdown () |
virtual void | on_safe_shutdown () |
uint32_t | get_component_state () const |
virtual void | mark_failed () |
Mark this component as failed. | |
void | mark_failed (const char *message) |
bool | is_failed () const |
bool | is_ready () const |
virtual bool | can_proceed () |
bool | status_has_warning () const |
bool | status_has_error () const |
void | status_set_warning (const char *message="unspecified") |
void | status_set_error (const char *message="unspecified") |
void | status_clear_warning () |
void | status_clear_error () |
void | status_momentary_warning (const std::string &name, uint32_t length=5000) |
void | status_momentary_error (const std::string &name, uint32_t length=5000) |
bool | has_overridden_loop () const |
void | set_component_source (const char *source) |
Set where this component was loaded from for some debug messages. | |
const char * | get_component_source () const |
Get the integration where this component was declared as a string. | |
bool | should_warn_of_blocking (uint32_t blocking_time) |
Protected Member Functions | |
std::string | relabel_id_ (EntityBase *obj) |
std::string | relabel_name_ (EntityBase *obj) |
void | add_area_label_ (AsyncResponseStream *stream, std::string &area) |
void | add_node_label_ (AsyncResponseStream *stream, std::string &node) |
void | add_friendly_name_label_ (AsyncResponseStream *stream, std::string &friendly_name) |
void | sensor_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | sensor_row_ (AsyncResponseStream *stream, sensor::Sensor *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the sensor state as prometheus data point. | |
void | binary_sensor_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | binary_sensor_row_ (AsyncResponseStream *stream, binary_sensor::BinarySensor *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the binary sensor state as prometheus data point. | |
void | fan_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | fan_row_ (AsyncResponseStream *stream, fan::Fan *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the fan state as prometheus data point. | |
void | light_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | light_row_ (AsyncResponseStream *stream, light::LightState *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the light values state as prometheus data point. | |
void | cover_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | cover_row_ (AsyncResponseStream *stream, cover::Cover *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the cover values state as prometheus data point. | |
void | switch_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | switch_row_ (AsyncResponseStream *stream, switch_::Switch *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the switch values state as prometheus data point. | |
void | lock_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | lock_row_ (AsyncResponseStream *stream, lock::Lock *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the lock values state as prometheus data point. | |
void | text_sensor_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | text_sensor_row_ (AsyncResponseStream *stream, text_sensor::TextSensor *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the text sensor values state as prometheus data point. | |
void | number_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | number_row_ (AsyncResponseStream *stream, number::Number *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the number state as prometheus data point. | |
void | select_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | select_row_ (AsyncResponseStream *stream, select::Select *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the select state as prometheus data point. | |
void | media_player_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | media_player_row_ (AsyncResponseStream *stream, media_player::MediaPlayer *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the media player state as prometheus data point. | |
void | update_entity_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | update_entity_row_ (AsyncResponseStream *stream, update::UpdateEntity *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the update state and info as prometheus data point. | |
void | handle_update_state_ (AsyncResponseStream *stream, update::UpdateState state) |
void | valve_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | valve_row_ (AsyncResponseStream *stream, valve::Valve *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the valve state as prometheus data point. | |
void | climate_type_ (AsyncResponseStream *stream) |
Return the type for prometheus. | |
void | climate_row_ (AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node, std::string &friendly_name) |
Return the climate state as prometheus data point. | |
void | climate_failed_row_ (AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node, std::string &friendly_name, std::string &category, bool is_failed_value) |
void | climate_setting_row_ (AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node, std::string &friendly_name, std::string &setting, const LogString *setting_value) |
void | climate_value_row_ (AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node, std::string &friendly_name, std::string &category, std::string &climate_value) |
![]() | |
virtual void | call_loop () |
virtual void | call_setup () |
virtual void | call_dump_config () |
void | set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f) |
Set an interval function with a unique name. | |
void | set_interval (uint32_t interval, std::function< void()> &&f) |
bool | cancel_interval (const std::string &name) |
Cancel an interval function. | |
void | set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
Set an retry function with a unique name. | |
void | set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
bool | cancel_retry (const std::string &name) |
Cancel a retry function. | |
void | set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f) |
Set a timeout function with a unique name. | |
void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
bool | cancel_timeout (const std::string &name) |
Cancel a timeout function. | |
void | defer (const std::string &name, std::function< void()> &&f) |
Defer a callback to the next loop() call. | |
void | defer (std::function< void()> &&f) |
Defer a callback to the next loop() call. | |
bool | cancel_defer (const std::string &name) |
Cancel a defer callback using the specified name, name must not be empty. | |
Protected Attributes | |
web_server_base::WebServerBase * | base_ |
bool | include_internal_ {false} |
std::map< EntityBase *, std::string > | relabel_map_id_ |
std::map< EntityBase *, std::string > | relabel_map_name_ |
![]() | |
uint32_t | component_state_ {0x0000} |
State of this component. | |
float | setup_priority_override_ {NAN} |
const char * | component_source_ {nullptr} |
uint32_t | warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_MS} |
std::string | error_message_ {} |
Definition at line 18 of file prometheus_handler.h.
|
inline |
Definition at line 20 of file prometheus_handler.h.
|
protected |
Definition at line 111 of file prometheus_handler.cpp.
|
protected |
Definition at line 125 of file prometheus_handler.cpp.
|
inline |
Add the value for an entity's "id" label.
obj | The entity for which to set the "id" label |
value | The value for the "id" label |
Definition at line 34 of file prometheus_handler.h.
|
inline |
Add the value for an entity's "name" label.
obj | The entity for which to set the "name" label |
value | The value for the "name" label |
Definition at line 41 of file prometheus_handler.h.
|
protected |
Definition at line 118 of file prometheus_handler.cpp.
|
protected |
Return the binary sensor state as prometheus data point.
Definition at line 185 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 181 of file prometheus_handler.cpp.
|
inlineoverride |
Definition at line 43 of file prometheus_handler.h.
|
protected |
Definition at line 876 of file prometheus_handler.cpp.
|
protected |
Return the climate state as prometheus data point.
Definition at line 897 of file prometheus_handler.cpp.
|
protected |
Definition at line 840 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 834 of file prometheus_handler.cpp.
|
protected |
Definition at line 859 of file prometheus_handler.cpp.
|
protected |
Return the cover values state as prometheus data point.
Definition at line 390 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 386 of file prometheus_handler.cpp.
|
protected |
Return the fan state as prometheus data point.
Definition at line 231 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 225 of file prometheus_handler.cpp.
|
inlineoverridevirtual |
Reimplemented from esphome::Component.
Definition at line 58 of file prometheus_handler.h.
|
protected |
Definition at line 707 of file prometheus_handler.cpp.
|
override |
Definition at line 8 of file prometheus_handler.cpp.
|
protected |
Return the light values state as prometheus data point.
Definition at line 289 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 284 of file prometheus_handler.cpp.
|
protected |
Return the lock values state as prometheus data point.
Definition at line 477 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 473 of file prometheus_handler.cpp.
|
protected |
Return the media player state as prometheus data point.
Definition at line 648 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 642 of file prometheus_handler.cpp.
|
protected |
Return the number state as prometheus data point.
Definition at line 556 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 552 of file prometheus_handler.cpp.
|
protected |
Definition at line 101 of file prometheus_handler.cpp.
|
protected |
Definition at line 106 of file prometheus_handler.cpp.
|
protected |
Return the select state as prometheus data point.
Definition at line 600 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 596 of file prometheus_handler.cpp.
|
protected |
Return the sensor state as prometheus data point.
Definition at line 138 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 134 of file prometheus_handler.cpp.
|
inline |
Determine whether internal components should be exported as metrics.
Defaults to false.
include_internal | Whether internal components should be exported. |
Definition at line 27 of file prometheus_handler.h.
|
inlineoverridevirtual |
Reimplemented from esphome::Component.
Definition at line 54 of file prometheus_handler.h.
|
protected |
Return the switch values state as prometheus data point.
Definition at line 446 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 442 of file prometheus_handler.cpp.
|
protected |
Return the text sensor values state as prometheus data point.
Definition at line 509 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 505 of file prometheus_handler.cpp.
|
protected |
Return the update state and info as prometheus data point.
Definition at line 727 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 701 of file prometheus_handler.cpp.
|
protected |
Return the valve state as prometheus data point.
Definition at line 792 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 786 of file prometheus_handler.cpp.
|
protected |
Definition at line 189 of file prometheus_handler.h.
|
protected |
Definition at line 190 of file prometheus_handler.h.
|
protected |
Definition at line 191 of file prometheus_handler.h.
|
protected |
Definition at line 192 of file prometheus_handler.h.