Metrics models
provide.foundation.integrations.openobserve.metrics_models
¶
OpenObserve metrics data models.
These models represent metrics data from OpenObserve's Prometheus-compatible API.
Classes¶
MetricLabels
¶
Label names and values for a metric.
Attributes:
| Name | Type | Description |
|---|---|---|
label_names |
list[str]
|
List of label names |
label_values |
dict[str, list[str]]
|
Dictionary mapping label names to list of values |
Functions¶
from_dict
classmethod
¶
Create from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Dictionary with label information |
required |
Returns:
| Type | Description |
|---|---|
MetricLabels
|
MetricLabels instance |
Source code in provide/foundation/integrations/openobserve/metrics_models.py
MetricMetadata
¶
Metadata for a metric.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Metric name |
type |
str
|
Metric type (counter, gauge, histogram, summary, etc.) |
help |
str
|
Help text describing the metric |
unit |
str
|
Unit of measurement |
Functions¶
from_dict
classmethod
¶
Create from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Dictionary with metric metadata |
required |
Returns:
| Type | Description |
|---|---|
MetricMetadata
|
MetricMetadata instance |
Source code in provide/foundation/integrations/openobserve/metrics_models.py
MetricQueryResult
¶
Result from a Prometheus query.
Attributes:
| Name | Type | Description |
|---|---|---|
result_type |
str
|
Type of result (vector, matrix, scalar, string) |
result |
list[MetricSample]
|
List of metric samples |
status |
str
|
Query status (success, error) |
error_type |
str
|
Error type if query failed |
error |
str
|
Error message if query failed |
warnings |
list[str]
|
List of warnings |
Attributes¶
is_success
property
¶
sample_count
property
¶
Functions¶
from_dict
classmethod
¶
Create from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Dictionary with query result from Prometheus API |
required |
Returns:
| Type | Description |
|---|---|
MetricQueryResult
|
MetricQueryResult instance |
Source code in provide/foundation/integrations/openobserve/metrics_models.py
to_dict
¶
Convert to dictionary.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary representation |
Source code in provide/foundation/integrations/openobserve/metrics_models.py
MetricSample
¶
A single metric sample with labels and value.
Attributes:
| Name | Type | Description |
|---|---|---|
metric |
dict[str, str]
|
Label name-value pairs |
value |
tuple[float, str] | None
|
Metric value (single value for instant queries) |
values |
list[tuple[float, str]]
|
List of [timestamp, value] pairs for range queries |
Functions¶
from_dict
classmethod
¶
Create from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Dictionary with sample data from Prometheus API |
required |
Returns:
| Type | Description |
|---|---|
MetricSample
|
MetricSample instance |