dashboard client that lets you perform dashboard queries and retrieve relevant data programmatically.
This page shows how to use Netra.dashboard to craft dashboard queries, fetch session summaries, and retrieve session statistics.
Getting Started
Thedashboard client is available on the main Netra entry point after initialization.
query_data
Fetch dashboard data with customizable metrics, dimensions, and filters. This method supports various chart types and aggregation strategies.Parameters
| Parameter | Type | Description |
|---|---|---|
scope | Scope | Scope of data to query (SPANS or TRACES) |
chart_type | ChartType | Chart visualization type (controls the response shape) |
metrics | Metrics | Defines what metric to compute and how to aggregate it |
filter | FilterConfig | Filter configuration constraining the query |
dimension | Dimension? | Optional grouping to split results by a dimension |
Enums and Types
Scope
Scope
| Value | Description |
|---|---|
Scope.SPANS | Query individual span-level data |
Scope.TRACES | Query trace-level aggregated data |
ChartType
ChartType
| Value | Description |
|---|---|
ChartType.LINE_TIME_SERIES | Line chart over time |
ChartType.BAR_TIME_SERIES | Bar chart over time |
ChartType.HORIZONTAL_BAR | Horizontal bar chart |
ChartType.VERTICAL_BAR | Vertical bar chart |
ChartType.PIE | Pie chart |
ChartType.NUMBER | Single numeric value |
Metrics
Metrics
The
Aggregation:
Metrics object defines what to measure and how to aggregate.Measure:| Value | Description |
|---|---|
Measure.LATENCY | Request latency |
Measure.ERROR_RATE | Error rate percentage |
Measure.PII_COUNT | Count of PII detections |
Measure.REQUEST_COUNT | Number of requests |
Measure.TOTAL_COST | Total cost in USD |
Measure.VIOLATIONS | Policy violations count |
Measure.TOTAL_TOKENS | Total token usage |
| Value | Description |
|---|---|
Aggregation.AVERAGE | Mean value |
Aggregation.P50 | 50th percentile |
Aggregation.P90 | 90th percentile |
Aggregation.P95 | 95th percentile |
Aggregation.P99 | 99th percentile |
Aggregation.MEDIAN | Median value |
Aggregation.PERCENTAGE | Percentage calculation |
Aggregation.TOTAL_COUNT | Sum total |
FilterConfig
FilterConfig
| Field | Type | Description |
|---|---|---|
start_time | str | Start of time window (ISO 8601 UTC, e.g., "2026-01-10T00:00:00.000Z") |
end_time | str | End of time window (ISO 8601 UTC) |
group_by | GroupBy | Time bucket size: DAY, HOUR, or MINUTE |
filters | list[Filter]? | Optional list of filter conditions |
Filter
Filter
| Field | Type | Description |
|---|---|---|
field | FilterField | Field to filter on |
operator | Operator | Comparison operator |
type | Type | Value type |
value | Any | Value to compare against |
key | str? | Required only for Type.OBJECT filters |
TOTAL_COST, SERVICE, TENANT_ID, USER_ID, SESSION_ID, ENVIRONMENT, LATENCY, MODEL_NAME (Spans only), MODELS (Traces only), METADATAOperator values:
EQUALS, NOT_EQUALS, CONTAINS, NOT_CONTAINS, STARTS_WITH, ENDS_WITH, GREATER_THAN, LESS_THAN, GREATER_EQUAL_TO, LESS_EQUAL_TO, ANY_OF, NONE_OFType values:
STRING, NUMBER, BOOLEAN, ARRAY_OPTIONS, OBJECTDimension
Dimension
| Field | Type | Description |
|---|---|---|
field | DimensionField | Field to group by |
| Value | Supported Scopes |
|---|---|
DimensionField.ENVIRONMENT | Spans, Traces |
DimensionField.SERVICE | Spans only |
DimensionField.MODEL_NAME | Spans only |
If the query scope is
Scope.TRACES, only DimensionField.ENVIRONMENT is supported. The Scope.SPANS supports all dimension fields.get_session_summary
Retrieve aggregated session metrics including total sessions, costs, latency, and cost breakdown by model.Parameters
| Parameter | Type | Description |
|---|---|---|
filter | SessionFilterConfig | Filter configuration for the query |
SessionFilterConfig
| Field | Type | Description |
|---|---|---|
start_time | str | Start of time window (ISO 8601 UTC) |
end_time | str | End of time window (ISO 8601 UTC) |
filters | list[SessionFilter]? | Optional list of filter conditions |
SessionFilter (Optional)
| Field | Type | Description |
|---|---|---|
field | SessionFilterField | Supports TENANT_ID, ENVIRONMENT, SERVICE |
operator | SessionFilterOperator | Currently supports ANY_OF |
type | SessionFilterType | Currently supports ARRAY |
value | list[str] | List of values to match |
get_session_stats
Fetch a paginated list of sessions with individual session metrics including request count, cost, and duration.Parameters
| Parameter | Type | Description |
|---|---|---|
start_time | str | Start of time window (ISO 8601 UTC) |
end_time | str | End of time window (ISO 8601 UTC) |
filters | list[SessionFilter]? | Optional filter conditions |
limit | int? | Maximum results per page |
cursor | str? | Pagination cursor from previous page |
sort_field | SortField? | Field to sort by |
sort_order | SortOrder? | Sort direction |
Sorting Options
SortField
SortField
| Value | Description |
|---|---|
SortField.SESSION_ID | Sort by session ID |
SortField.START_TIME | Sort by session start time |
SortField.TOTAL_REQUESTS | Sort by request count |
SortField.TOTAL_COST | Sort by total cost |
SortOrder
SortOrder
| Value | Description |
|---|---|
SortOrder.ASC | Ascending order |
SortOrder.DESC | Descending order |
iter_session_stats
Stream over all pages of session stats until completion. This iterator handles pagination automatically.Parameters
| Parameter | Type | Description |
|---|---|---|
start_time | str | Start of time window (ISO 8601 UTC) |
end_time | str | End of time window (ISO 8601 UTC) |
filters | list[SessionFilter]? | Optional filter conditions |
sort_field | SortField? | Field to sort by |
sort_order | SortOrder? | Sort direction |
Complete Example
Next Steps
- Usage Utilities - Query token usage and trace data
- Python SDK Reference - Complete SDK documentation
- Custom Dashboard - Build custom dashboards