diff --git a/mission-control-chart b/mission-control-chart index 95e64d81..f1041d21 160000 --- a/mission-control-chart +++ b/mission-control-chart @@ -1 +1 @@ -Subproject commit 95e64d81bd9522d98cd389f36400c7d0b6499b2a +Subproject commit f1041d21c96ce85ebe1e5b72e5b9b85e049ea61f diff --git a/mission-control/docs/guide/views/concepts/templating.md b/mission-control/docs/guide/views/concepts/templating.md index 016c168b..4a8e7f74 100644 --- a/mission-control/docs/guide/views/concepts/templating.md +++ b/mission-control/docs/guide/views/concepts/templating.md @@ -96,16 +96,46 @@ templating: | -------- | ------ | ----------------------------------------------------------------- | | `key` | string | Unique identifier for the variable (used in template expressions) | | `label` | string | Display name shown to users | +| `values` | array | Static list of options for the dropdown | +| `valueFrom` | object | Dynamic options from config items (alternative to `values`) | + +:::note One of values or valueFrom is required +Every variable must have exactly one of `values` (static list) or `valueFrom` (dynamic from configs) to populate the dropdown options. These fields are mutually exclusive. +::: ### Optional Properties | Property | Type | Description | | ----------- | ------ | -------------------------------------------------------------------- | | `default` | string | Default value when view loads | -| `values` | array | Static list of options (mutually exclusive with `valueFrom`) | -| `valueFrom` | object | Dynamic options from config items (mutually exclusive with `values`) | | `dependsOn` | array | List of variable keys this depends on | +## valueFrom Structure + +When using dynamic values from config items, `valueFrom` has the following structure: + +| Property | Type | Description | +|----------|------|-------------| +| `config` | object | Config selector to find matching config items | +| `config.types` | array | List of config types to match (e.g., `['Kubernetes::Cluster']`) | +| `config.tagSelector` | string | Tag selector for filtering configs (optional) | +| `config.search` | string | Free text search for configs (optional) | +| `config.limit` | int | Maximum number of configs to return (optional, default: no limit) | +| `label` | string | CEL expression for dropdown display labels (optional, defaults to config name) | +| `value` | string | CEL expression for dropdown values (optional, defaults to config name) | + +**Example:** + +```yaml +valueFrom: + config: + types: ['Kubernetes::Pod'] + tagSelector: 'cluster=production' + limit: 50 + label: 'row.name + " (" + row.tags.namespace + ")"' # Display: "nginx (default)" + value: 'row.name' # Value used in queries: "nginx" +``` + ## Variable Types ### Static Values Variable diff --git a/mission-control/docs/guide/views/panels/properties.md b/mission-control/docs/guide/views/panels/properties.md new file mode 100644 index 00000000..9156b6a0 --- /dev/null +++ b/mission-control/docs/guide/views/panels/properties.md @@ -0,0 +1,28 @@ +--- +title: Properties +sidebar_custom_props: + icon: mdi:form-textbox +--- + +The `properties` panel displays a single row of data as a vertical list of key-value pairs. This is useful for showing details of a specific entity. + +## Configuration + +This panel type does not require any specific configuration. It uses the standard panel definition. + +## Behavior + +- Displays column names as labels and their values from the first row of the query result. +- Useful when the query returns a single record. + +## Example + +```yaml +panels: + - name: Deployment Details + type: properties + query: | + SELECT name, status, created_at, version + FROM deployments + LIMIT 1 +``` diff --git a/mission-control/docs/guide/views/panels/timeseries.md b/mission-control/docs/guide/views/panels/timeseries.md new file mode 100644 index 00000000..0af74214 --- /dev/null +++ b/mission-control/docs/guide/views/panels/timeseries.md @@ -0,0 +1,29 @@ +--- +title: Time Series +sidebar_custom_props: + icon: mdi:chart-timeline-variant +--- + +The `timeseries` panel visualizes data over time using line, area, or point charts. + +## Properties + +| Property | Type | Description | +| ---------- | ------ | ---------------------------------------------------------------------- | +| `timeKey` | string | Field name containing the timestamp (default: infers timestamp column) | +| `valueKey` | string | Field name containing the numeric value (for single-series charts) | +| `style` | string | Visualization style: `lines` (default), `area`, `points` | +| `legend` | object | Legend configuration (see below) | + +## Legend Configuration + +| Property | Type | Description | +| -------- | ------- | -------------------------------------------------------- | +| `enable` | boolean | Show or hide legend (default: `true`) | +| `layout` | string | Legend orientation: `horizontal` (default) or `vertical` | + +## Example + +```yaml title="timeseries.yaml" file=/modules/mission-control/fixtures/views/panels/timeseries.yaml + +``` diff --git a/mission-control/docs/guide/views/queries/http.md b/mission-control/docs/guide/views/queries/http.md new file mode 100644 index 00000000..490a0153 --- /dev/null +++ b/mission-control/docs/guide/views/queries/http.md @@ -0,0 +1,146 @@ +--- +title: HTTP +sidebar_custom_props: + icon: mdi:web +--- + +The `http` query allows you to fetch data from external APIs and use it within your view. It supports RESTful APIs and can extract data using JSONPath. + +## Example + +```yaml title="recipes-http.yaml" file=/modules/mission-control/fixtures/views/recipes-http.yaml + +``` + +## Configuration + +| Field | Type | Description | +| ------------ | --------------------------------- | --------------------------------------------------------------- | +| `url` | string | The URL to send the request to. | +| `method` | string | HTTP method (GET, POST, PUT, DELETE, PATCH). Default: `GET`. | +| `body` | string | Request body for POST/PUT/PATCH requests. Supports templating. | +| `jsonpath` | string | JSONPath expression to extract specific data from the response. | +| `headers` | list | List of headers to include in the request. | +| `connection` | string | Reference to a connection for authentication. | +| `username` | [EnvVar](/docs/reference/env-var) | Basic auth username. | +| `password` | [EnvVar](/docs/reference/env-var) | Basic auth password. | +| `bearer` | [EnvVar](/docs/reference/env-var) | Bearer token. | + +### JSONPath Extraction + +If the API returns a nested structure, you can use `jsonpath` to extract the list of items you want to treat as rows. + +For example, if the API returns: + +```json +{ + "status": "success", + "data": { + "items": [ + { "id": 1, "name": "A" }, + { "id": 2, "name": "B" } + ] + } +} +``` + +Use `jsonpath: "$.data.items"` to extract the array. + +### Authentication + +You can provide authentication details inline or reference a stored connection. + +**Inline Basic Auth:** + +```yaml +http: + url: https://api.example.com/data + username: + value: myuser + password: + value: mypass +``` + +**Using a Connection:** + +```yaml +http: + url: https://api.example.com/data + connection: connection://my-api-creds +``` + +## Connection Field + +The `connection` field references a stored [Connection](/mission-control/guide/configurations/connections) resource. When specified, Mission Control hydrates the connection by: + +1. Looking up the connection by name in the view's namespace +2. Extracting authentication details (username, password, bearer token, OAuth credentials) +3. Applying TLS configuration (CA, cert, key, insecure skip verify) +4. Merging custom headers defined in the connection +5. Resolving any environment variable references in connection properties + +Connection properties that can be inherited: +- `url` - Base URL for the API +- `username` / `password` - HTTP Basic Authentication +- `bearer` - Bearer token for token-based auth +- `oauth` - OAuth2 credentials (clientID, clientSecret, tokenURL, scopes, params) +- `tls` - TLS configuration (ca, cert, key, insecureSkipVerify) +- `headers` - Additional HTTP headers + +**Example with connection:** + +```yaml title="http-connection.yaml" file=/modules/mission-control/fixtures/views/http-connection.yaml + +``` + +## Templating Support + +The `body` field supports Go templating, allowing dynamic request payloads: + +```yaml title="http-post-body.yaml" file=/modules/mission-control/fixtures/views/http-post-body.yaml + +``` + +Template variables available in the body: +- `$(var.)` - View template variables +- Environment variables via `$(ENV_VAR_NAME)` + +## Response Size Limits + +By default, HTTP responses are limited to **25 MB** to prevent memory issues with large payloads. You can configure this limit using the `view.http.body.max_size_bytes` property. + +### Configuring the Limit + +Set the property via environment variable or configuration: + +```yaml +# Increase limit to 50 MB +properties: + view.http.body.max_size_bytes: "52428800" +``` + +### Size Limit Error Handling + +When a response exceeds the configured limit, the view returns an error with details: + +``` +http response body size (32 MB) exceeds maximum allowed (25 MB); increase limit via property "view.http.body.max_size_bytes" +``` + +To resolve: +1. Increase the limit via the property (if you have sufficient memory) +2. Use pagination in the API request to fetch smaller chunks +3. Apply filters in the API request to reduce response size +4. Use `jsonpath` to extract only the needed subset of data + +**Example with pagination:** + +```yaml +queries: + paged-data: + http: + url: https://api.example.com/items?page=1&per_page=100 + connection: connection://my-api +``` + + diff --git a/mission-control/docs/guide/views/table/columns/decimal.md b/mission-control/docs/guide/views/table/columns/decimal.md new file mode 100644 index 00000000..c9202d46 --- /dev/null +++ b/mission-control/docs/guide/views/table/columns/decimal.md @@ -0,0 +1,18 @@ +--- +title: Decimal +sidebar_custom_props: + icon: mdi:decimal +--- + +The `decimal` column type displays numeric values with support for high precision. It is similar to `number` but explicitly intended for decimal values. + +## Example + +```yaml +columns: + - name: error_rate + type: decimal + - name: cost + type: decimal + unit: '$' +``` diff --git a/mission-control/docs/guide/views/table/index.md b/mission-control/docs/guide/views/table/index.md index 4632ddd4..bf206224 100644 --- a/mission-control/docs/guide/views/table/index.md +++ b/mission-control/docs/guide/views/table/index.md @@ -38,6 +38,17 @@ Use `merge` to combine configs with Prometheus metrics into one table: ``` +## Default Sort and Page Size + +Use `display.table` to control the initial sort order and page size: + +```yaml +display: + table: + sort: -cpu_usage # Sort by cpu_usage descending + size: 50 # Show 50 rows per page +``` + ## Best Practices - Always set `primaryKey` on at least one column (composite keys allowed). diff --git a/mission-control/docs/reference/views/_view.mdx b/mission-control/docs/reference/views/_view.mdx index 55509d87..65e01d46 100644 --- a/mission-control/docs/reference/views/_view.mdx +++ b/mission-control/docs/reference/views/_view.mdx @@ -29,6 +29,11 @@ description: "Default card layout for the view (body column count and whether cards are the default mode)", scheme: "[DisplayCard](#view-card-layout)" }, + { + field: "display.table", + description: "Default table layout for the view (sort order and page size)", + scheme: "[DisplayTable](#view-table-layout)" + }, { field: "display.plugins[]", description: "Attach the view as a tab on matching config items with templated variables extracted from the config", @@ -91,6 +96,7 @@ - **At least one query**: Views must define at least one named query (unless the view only renders `sections`) - **Output definition**: Views must have either `panels` or `columns` (or both) - **Merge requirement**: When using multiple queries with table output (columns only), you must provide a `merge` SQL query +- **Column definition**: When using Prometheus or HTTP queries, `columns` map must be defined to generate the table schema ::: ### Query @@ -113,6 +119,11 @@ Query definition for data sources. description: "Run a SQL query against a configured connection (PostgreSQL, MySQL, SQL Server)", scheme: "[SQL query](/mission-control/guide/views/queries/sql)" }, + { + field: "http", + description: "Query external APIs via HTTP", + scheme: "[HTTP Query](#http-query)" + }, { field: "prometheus", description: "Query time-series data from Prometheus", @@ -122,6 +133,64 @@ Query definition for data sources. field: "viewTableSelector", description: "Read cached rows from another view table", scheme: "[View Table Selector](#view-table-selector)" + }, + { + field: "columns", + description: "Define column types for the query results (useful for HTTP/Prometheus)", + scheme: "map[string]ColumnType" + } +]}/> + +#### HTTP Query + +Query configuration for HTTP requests. + + @@ -178,7 +247,7 @@ Column definition for view tables with data types and visualization properties. field: "type", required: true, description: "Data type that determines formatting and visualization", - scheme: "`string`, `number`, `boolean`, `datetime`, `duration`, `health`, `status`, `gauge`, `bytes`, `decimal`, `millicore`, `url`, `badge`, `config_item`, `labels`" + scheme: "`string`, `number`, `boolean`, `datetime`, `duration`, `health`, `status`, `gauge`, `bytes`, `decimal`, `millicore`, `config_item`, `labels`" }, { field: "primaryKey", @@ -210,6 +279,11 @@ Column definition for view tables with data types and visualization properties. description: "Link to configs, other views, or custom URLs using CEL/Go templates", scheme: "[ColumnURL](#column-urls)" }, + { + field: "badge", + description: "Badge configuration for the column", + scheme: "BadgeConfig" + }, { field: "unit", description: "Unit string appended to values (e.g., %, bytes, millicore)", @@ -261,7 +335,7 @@ Panel definition for interactive visualizations. field: "type", required: true, description: "Type of panel visualization", - scheme: "`piechart`, `table`, `text`, `number`, `duration`, `gauge`, `bargauge`, `timeseries`" + scheme: "`piechart`, `table`, `text`, `number`, `duration`, `gauge`, `bargauge`, `timeseries`, `properties`" }, { field: "query", @@ -293,6 +367,11 @@ Panel definition for interactive visualizations. field: "timeseries", description: "Configuration for timeseries panels", scheme: "[Timeseries Configuration](#timeseries-configuration)" + }, + { + field: "properties", + description: "Properties panel renders query results as key-value pairs (no specific configuration)", + scheme: "object" } ]}/> @@ -426,9 +505,26 @@ Configuration for timeseries panels (API-level; UI rendering in progress). } ]}/> +### View Table Layout + +`display.table` controls the default table layout for the view. + + + ### View Card Layout -`display.card` controls the default card layout for tables with card positioning. Cards become the default view when `default: true` and at least one column defines `card.position` (or legacy `cardPosition`). Use `columns[].card.useForAccent` to color the card accent based on a column's value (status/health heuristics in the UI): +`display.card` controls the default card layout for the view (when `default: true`, cards are shown instead of the table). + +#### Changes UI Filters + + + +#### Configs UI Filters + + + ```yaml title="workload-overview.yaml" file=/modules/mission-control/fixtures/views/workload-overview.yaml {6-24} ``` diff --git a/modules/canary-checker b/modules/canary-checker index 989c9d6c..9597e54d 160000 --- a/modules/canary-checker +++ b/modules/canary-checker @@ -1 +1 @@ -Subproject commit 989c9d6cb1f395f97010de874eab8c706096a94b +Subproject commit 9597e54d23f361bd9ba60a3f8fc9511482e96c7c diff --git a/modules/config-db b/modules/config-db index bdc31c21..241712bd 160000 --- a/modules/config-db +++ b/modules/config-db @@ -1 +1 @@ -Subproject commit bdc31c213cb2936337a9e88bdddef8e058e5f4b2 +Subproject commit 241712bdc6a46ac544e52cc86f7ea382699a448d diff --git a/modules/duty b/modules/duty index 36ae9072..328f338f 160000 --- a/modules/duty +++ b/modules/duty @@ -1 +1 @@ -Subproject commit 36ae907273a73e42204d5ac0057028d38c230478 +Subproject commit 328f338fd43d4dd888b36a74bebbfebf7a222fa1 diff --git a/modules/mission-control b/modules/mission-control index b4cf1bfe..f1ea4396 160000 --- a/modules/mission-control +++ b/modules/mission-control @@ -1 +1 @@ -Subproject commit b4cf1bfe9c1f2197f98497977c72c933b2192365 +Subproject commit f1ea43969b5139e7e976fda900caf01817c7bd51 diff --git a/modules/mission-control-chart b/modules/mission-control-chart index ce11edea..f1041d21 160000 --- a/modules/mission-control-chart +++ b/modules/mission-control-chart @@ -1 +1 @@ -Subproject commit ce11edeaf72c85033bd9ec6ce7bf3905f94b14ad +Subproject commit f1041d21c96ce85ebe1e5b72e5b9b85e049ea61f diff --git a/modules/mission-control-registry b/modules/mission-control-registry index bd2475fc..c0d9678f 160000 --- a/modules/mission-control-registry +++ b/modules/mission-control-registry @@ -1 +1 @@ -Subproject commit bd2475fce1114b60108590cd4776d73b5bf9a943 +Subproject commit c0d9678f764ae3fc7b252a0ce347b8190d1e7315