Search
provide.foundation.integrations.openobserve.search
¶
Search operations for OpenObserve.
Classes¶
Functions¶
aggregate_by_level
async
¶
aggregate_by_level(
stream: str = "default",
start_time: str | int | None = None,
end_time: str | int | None = None,
client: OpenObserveClient | None = None,
) -> dict[str, int]
Get count of logs by level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream
|
str
|
Stream name to search in |
'default'
|
start_time
|
str | int | None
|
Start time |
None
|
end_time
|
str | int | None
|
End time |
None
|
client
|
OpenObserveClient | None
|
OpenObserve client |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, int]
|
Dictionary mapping level to count |
Source code in provide/foundation/integrations/openobserve/search.py
get_current_trace_logs
async
¶
get_current_trace_logs(
stream: str = "default",
client: OpenObserveClient | None = None,
) -> SearchResponse | None
Get logs for the current active trace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream
|
str
|
Stream name to search in |
'default'
|
client
|
OpenObserveClient | None
|
OpenObserve client |
None
|
Returns:
| Type | Description |
|---|---|
SearchResponse | None
|
SearchResponse with logs for current trace, or None if no active trace |
Source code in provide/foundation/integrations/openobserve/search.py
search_by_level
async
¶
search_by_level(
level: str,
stream: str = "default",
start_time: str | int | None = None,
end_time: str | int | None = None,
size: int = 100,
client: OpenObserveClient | None = None,
) -> SearchResponse
Search for logs by level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
str
|
Log level to filter (ERROR, WARN, INFO, DEBUG, etc.) |
required |
stream
|
str
|
Stream name to search in |
'default'
|
start_time
|
str | int | None
|
Start time |
None
|
end_time
|
str | int | None
|
End time |
None
|
size
|
int
|
Number of results |
100
|
client
|
OpenObserveClient | None
|
OpenObserve client |
None
|
Returns:
| Type | Description |
|---|---|
SearchResponse
|
SearchResponse with matching logs |
Source code in provide/foundation/integrations/openobserve/search.py
search_by_service
async
¶
search_by_service(
service: str,
stream: str = "default",
start_time: str | int | None = None,
end_time: str | int | None = None,
size: int = 100,
client: OpenObserveClient | None = None,
) -> SearchResponse
Search for logs by service name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service
|
str
|
Service name to filter |
required |
stream
|
str
|
Stream name to search in |
'default'
|
start_time
|
str | int | None
|
Start time |
None
|
end_time
|
str | int | None
|
End time |
None
|
size
|
int
|
Number of results |
100
|
client
|
OpenObserveClient | None
|
OpenObserve client |
None
|
Returns:
| Type | Description |
|---|---|
SearchResponse
|
SearchResponse with matching logs |
Source code in provide/foundation/integrations/openobserve/search.py
search_by_trace_id
async
¶
search_by_trace_id(
trace_id: str,
stream: str = "default",
client: OpenObserveClient | None = None,
) -> SearchResponse
Search for logs by trace ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trace_id
|
str
|
Trace ID to search for |
required |
stream
|
str
|
Stream name to search in |
'default'
|
client
|
OpenObserveClient | None
|
OpenObserve client (creates new if not provided) |
None
|
Returns:
| Type | Description |
|---|---|
SearchResponse
|
SearchResponse with matching logs |
Source code in provide/foundation/integrations/openobserve/search.py
search_errors
async
¶
search_errors(
stream: str = "default",
start_time: str | int | None = None,
size: int = 100,
client: OpenObserveClient | None = None,
) -> SearchResponse
Search for error logs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stream
|
str
|
Stream name to search in |
'default'
|
start_time
|
str | int | None
|
Start time |
None
|
size
|
int
|
Number of results |
100
|
client
|
OpenObserveClient | None
|
OpenObserve client |
None
|
Returns:
| Type | Description |
|---|---|
SearchResponse
|
SearchResponse with error logs |
Source code in provide/foundation/integrations/openobserve/search.py
search_logs
async
¶
search_logs(
sql: str,
start_time: str | int | None = None,
end_time: str | int | None = None,
size: int = 100,
client: OpenObserveClient | None = None,
) -> SearchResponse
Search logs in OpenObserve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sql
|
str
|
SQL query to execute |
required |
start_time
|
str | int | None
|
Start time (relative like "-1h" or microseconds) |
None
|
end_time
|
str | int | None
|
End time (relative like "now" or microseconds) |
None
|
size
|
int
|
Number of results to return |
100
|
client
|
OpenObserveClient | None
|
OpenObserve client (creates new if not provided) |
None
|
Returns:
| Type | Description |
|---|---|
SearchResponse
|
SearchResponse with results |