pi_dashboard.db.metrics_database_manager¶
Metrics database manager.
Classes
|
Manager class for metrics database operations. |
|
System metrics table. |
- class pi_dashboard.db.metrics_database_manager.SystemMetricsDB(*, id=None, cpu_usage, memory_usage, disk_usage, uptime, temperature, timestamp)[source]¶
System metrics table.
- classmethod from_system_metrics(system_metrics)[source]¶
Create a SystemMetricsDB instance from a SystemMetrics.
- Return type:
- __init__(**data)¶
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- class pi_dashboard.db.metrics_database_manager.MetricsDatabaseManager(db_config)[source]¶
Manager class for metrics database operations.
- __init__(db_config)[source]¶
Initialize the MetricsDatabaseManager with the given database configuration.
- db_config: DashboardDatabaseConfig¶
- is_stale(entry)[source]¶
Return True if the metrics entry is older than the specified metrics lifetime.
- Parameters:
entry (
SystemMetrics) – The metrics entry to check- Return bool:
True if the entry is stale
- Return type:
- get_all_system_metrics_entries()[source]¶
Public method to retrieve all metrics entries.
- Return type:
- get_system_metrics_entries_since(last_n_seconds, max_data_points)[source]¶
Get metrics entries from the last N seconds with adaptive downsampling.
- Return type: