Metrics¤
Define and track training metrics.
See Also¤
- Monitoring Overview - All monitoring tools
- Reporters - Output metrics
- Callbacks - Training callbacks
datarax.monitoring.metrics ¤
Metrics collection and tracking utilities for Datarax.
This module provides classes for collecting, tracking, and aggregating metrics during pipeline operation. These utilities enable monitoring of pipeline performance, throughput, and resource usage.
MetricRecord
dataclass
¤
MetricRecord(name: str, value: float, timestamp: float, component: str, metadata: dict[str, Any] | None = None)
MetricsCollector ¤
MetricsCollector(enabled: bool = True)
Collects and aggregates metrics during pipeline operations.
This class provides methods for tracking time-based metrics and recording arbitrary metrics during pipeline execution.
Attributes:
| Name | Type | Description |
|---|---|---|
enabled |
Whether metrics collection is enabled. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
Whether metrics collection is enabled. |
True
|
start_timer ¤
stop_timer ¤
record_metric ¤
get_metrics ¤
get_metrics() -> list[MetricRecord]
Get all collected metrics.
Returns:
| Type | Description |
|---|---|
list[MetricRecord]
|
List of collected metric records. |
AggregatedMetrics ¤
Aggregates metrics over time.
This class provides methods for calculating aggregate statistics over collected metrics.
add_metrics ¤
add_metrics(metrics: list[MetricRecord]) -> None
Add metrics to the aggregator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics
|
list[MetricRecord]
|
List of metric records to add. |
required |
get_average ¤
get_min ¤
get_max ¤
get_sum ¤
get_count ¤
get_rate ¤
Get the rate of a metric (count / time period).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the metric. |
required |
component
|
str
|
Component that generated the metric. |
'pipeline'
|
Returns:
| Type | Description |
|---|---|
float | None
|
Rate (occurrences per second), or None if less than two measurements |
float | None
|
exist. |