---
title: "groupby"
description: "Fields of a `groupby` variable."
---

> Documentation Index
> Fetch the complete documentation index at: https://slashobserve.com/llms.txt
> Use this file to discover all available pages before exploring further.

# groupby

## Example

```json
{
  "name": "groupby",
  "type": "groupby",
  "datasource": "prom",
  "default": [
    "pod"
  ],
  "keys": [
    "pod",
    "service",
    "env"
  ]
}
```

From [`spec/examples/evolved-features.json`](https://github.com/slashobserve/slashobserve/blob/main/spec/examples/evolved-features.json).

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `name` (required) | `variableName` | Referenced in queries as $name, ${name} or ${name:format}. |
| `label` | `string` |   |
| `description` | `string` |   |
| `hide` | `"label"`, `"variable"` |   |
| `skipUrlSync` | `boolean` | The variable's value is not read from or written to the URL. |
| `type` (required) | `"groupby"` |   |
| `datasource` (required) | `datasourceRef` | A configured datasource uid, or ${name} naming a datasource variable declared in variables (before this variable, when used by one); queries then run on the datasource selected in that variable, and macros follow its datasourceType. |
| `default` | array of `string` | At most 20 items. |
| `keys` | array of `string` | The labels the picker offers instead of asking the datasource. At most 100 items. |

Generated from [`spec/schema/observespec.v0.json`](https://github.com/slashobserve/slashobserve/blob/bac0fe39/spec/schema/observespec.v0.json) at `bac0fe39`. [Report a problem](https://github.com/slashobserve/slashobserve/issues/new).
