Client metrics mixin
provide.foundation.integrations.openobserve.client_metrics_mixin
¶
Metrics and Prometheus API operations for OpenObserve client.
Classes¶
MetricsOperationsMixin
¶
Mixin providing Prometheus-compatible metrics operations.
Functions¶
get_label_values
async
¶
Get values for a specific label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label_name
|
str
|
Label name to get values for |
required |
match
|
list[str] | None
|
Optional list of series selectors to filter values |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of label values |
Source code in provide/foundation/integrations/openobserve/client_metrics_mixin.py
get_metric_labels
async
¶
Get label names for metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric_name
|
str | None
|
Optional metric name to filter labels |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of label names |
Source code in provide/foundation/integrations/openobserve/client_metrics_mixin.py
get_metric_metadata
async
¶
Get metadata for metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
str | None
|
Optional metric name to filter metadata |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, list[dict[str, Any]]]
|
Dictionary mapping metric names to metadata list |
Source code in provide/foundation/integrations/openobserve/client_metrics_mixin.py
list_metrics
async
¶
List all available metrics.
Uses the Prometheus API endpoint to get all metric names.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of metric names |
Source code in provide/foundation/integrations/openobserve/client_metrics_mixin.py
query_promql
async
¶
Execute instant PromQL query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
PromQL query string |
required |
time
|
str | int | None
|
Evaluation timestamp (Unix timestamp or RFC3339, defaults to now) |
None
|
timeout
|
str | None
|
Query timeout |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
MetricQueryResult with query results |
Source code in provide/foundation/integrations/openobserve/client_metrics_mixin.py
query_range_promql
async
¶
query_range_promql(
query: str,
start: str | int,
end: str | int,
step: str | int,
timeout: str | None = None,
) -> Any
Execute PromQL range query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
PromQL query string |
required |
start
|
str | int
|
Start timestamp (Unix timestamp or RFC3339) |
required |
end
|
str | int
|
End timestamp (Unix timestamp or RFC3339) |
required |
step
|
str | int
|
Query resolution step (duration string like "15s" or seconds as int) |
required |
timeout
|
str | None
|
Query timeout |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
MetricQueryResult with time series data |