# Data Explorer & Monitors query builder

### Modes Overview

1. **Metrics** – Work with all your available metrics. Great for advanced use cases and custom metrics.
2. **Logs** – Query and visualize Logs data.
3. **Traces** – Query and visualize Traces, similar to logs.
4. **Events** – Query and visualize events, similar to logs.
5. **RUM -** Query and visualizer RUM Events.

### Metrics

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-e15f867d5410723dc8202e2e02b964893c640707%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

When you select the **Metrics** mode, you’ll work with something akin to Prometheus queries - but simplified.

groundcover supports a wide variety of metrics - [Application](https://docs.groundcover.com/capabilities/application-performance-monitoring/application-metrics) and [Infrastructure](https://docs.groundcover.com/capabilities/infrastructure-monitoring) metrics are automatically generated using our eBPF sensor, and [custom metrics](https://docs.groundcover.com/use-groundcover/scraping-custom-metrics) can be ingested natively.

### ![](https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-497538081448dec32eac34b0ca9d73ac917ab2b7%2FScreenshot%202025-03-30%20at%2019.14.05.png?alt=media)

**Metric Selector:**

* Search and choose a metric.
* View associated labels and metadata (for groundcover’s built-in metrics).
* If the chosen built-in metric’s type is known, the Query Builder automatically applies the best-suited function to streamline your workflow.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-18c1a42d49ac5bb0d1ab4756bd25bd3faeaa1115%2Fimage%20(170).png?alt=media" alt=""><figcaption></figcaption></figure>

**Filters Bar (Metrics):**

* Filter by label key/value pairs.
* Use `-` to exclude values
* All filters are ANDed together, but multiple values for the same key form an OR condition.
* Type a key and `:` (e.g `cluster:`) to list its values.
* Use patterns (wildcards, partial matches) to refine results.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-cd4dcf53fcd460c961dc0c424573c5c02640efb0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

**Aggregation Function Selector:**

* **sum**: Adds up all values.
* **avg**: Calculates the average value.
* **max**: Finds the maximum value.
* **min**: Finds the minimum value.
* **count**: Counts how many data points there are.
* **no aggregation**: Leaves data un-aggregated.

**Aggregation Labels Selector:**

* Select one or more labels to group your results by.

**Limit Selector:**

* Show top or bottom results based on:
  * **Max**: Highest values.
  * **Min**: Lowest values.
  * **Mean**: Highest/lowest average values.
  * **Median**: Highest/lowest median values.
  * **Last**: Highest/lowest most recent values.

**Visualization Type:**

* **Time-series**: View data over time (time range set by the time-picker).
* **Table**: See instant snapshot data.

**Time & Rollup Notes:**

* The **time-picker** defines the time range for your query.

**Advanced Query**

Switching to Advanced Query mode allows you to view and modify the PromQL query generated by the Query Builder. This mode provides full flexibility for advanced users. However, changes made in the editor are not reflected back in the Query Builder. The editor is ideal for making manual adjustments that are beyond the capabilities offered in Query Builder mode.

{% hint style="info" %}
Selecting or deselecting Clusters and Environments in the Backend Picker won't affect the metrics displayed.
{% endhint %}

### Metrics Formulas

To enhance your data analysis in **Metrics** mode, groundcover supports the use of **Formulas**. Formulas allow you to perform arithmetic operations and apply functions to your metrics queries.

**Using Formulas:**

1. **Assign Query Symbols:** each metric query is automatically assigned a letter (A, B, C, etc.).
2. **Construct Formulas:** Combine these letters using operators and functions to create expressions.

**Supported Operators:**

* Addition: `+`
* Subtraction: `-`
* Multiplication: `*`
* Division: `/`
* Modulo: `%`
* Exponentiation: `**`
* Parentheses: `()` for grouping

**Example:**

To calculate the CPU usage percentage where **A** is the used CPU metric and **B** is the total CPU capacity:

```
(A / B) * 100
```

### Logs/Traces

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-7ff4d29fd7c86a6c9bbcbed5ddf5db5931024944%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

**Filters Bar (Logs/Traces):**

* Same label-based filtering as Metrics.
* **Free Text Search (Logs only)**: Search for any substring.
* Exclude terms by prefixing with `-`
* Use `*` as a wildcard.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-1734d31a346912ea9b91359741364806a149d757%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

**Measurement Selection (Logs/Traces):**

* **Count**: Count total logs/traces.
* **Count (unique)**: Count distinct values of a chosen field.
* **Avg/Sum/Max/Min**: For numeric fields, perform calculations.
* **Percentiles (P99/P95/P50/P10)**: Show the value at a specific percentile.

**Group By:**

* Group results by fields (e.g., `k8s.namespace`, `service.name`) to break down the data by categories.

**Rollup (Logs/Traces):**

* Choose time buckets (like 1m, 5m) for aggregation. This helps smooth out spikes or show trends over chosen intervals.

**Limit:**

* Limit and sort table data to display only the most relevant rows.

**Visualization Type (Logs/Traces):**

* **Time-series**
* **Table**
* **Stat**
* **Top List**
* **Pie**

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-4618d99435c38deb5d476527a9373d35bcc3b184%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### Examples

Here are a few examples to help you understand how to build and visualize queries using the Query Builder:

Query the top 5 workloads with the highest **average container CPU usage** in the namespaces `demo-ng` and `opentelemetry-demo`.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-b0653e9179ccf26712087de51185cac89d5b04ac%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Quickly find the **average memory usage** of **workloads** in the namespace `demo-ng`. Instead of crafting a complex query, we simply selected **Container Memory > Usage Amount**.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-564064b95409b9c3698b52b74476325d5bef0b0c%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Query the P99 duration of all HTTP traces across the platform. This query is broad, with no filters applied for clusters, namespaces, or specific services.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-da1e374e614b13ac5c1e518652573b32d47a3733%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Narrow it down: Query the P99 duration of HTTP traces, but this time only for outbound traces from a specific workload.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-c76154003bba4ff25954cdb9a8509d11617c83f6%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Visualize the distribution of log counts per log level in the cluster demo. This provides a quick snapshot of the log severity levels.

### RUM

The RUM Query Builder allows you to query RUM data collected by the groundcover SDK.

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-8bea5801e101cabc0cfe6e529d48146a799b64fe%2FScreenshot%202025-03-30%20at%2019.14.34.png?alt=media" alt=""><figcaption></figcaption></figure>

It includes the same components as the [Logs/Traces](#logs-traces) builder (Measurement Selection, Group By, Rollup, Limit, Visualization Type), plus an additional selector for Event Type.

The following event types and their properties are available:

<table><thead><tr><th>Event Type</th><th width="273.875">Property</th><th>Description</th><th>Type</th></tr></thead><tbody><tr><td><strong>Page Loads</strong></td><td><code>page_load_time</code></td><td>Page Load Time</td><td>Numeric</td></tr><tr><td></td><td><code>page_url</code></td><td>Page URL</td><td>String</td></tr><tr><td><strong>Errors</strong></td><td><code>error_fingerprint</code></td><td>Error Fingerprint</td><td>String</td></tr><tr><td></td><td><code>error_message</code></td><td>Error Message</td><td>String</td></tr><tr><td></td><td><code>error_type</code></td><td>Error Type</td><td>String</td></tr><tr><td><strong>Custom Events</strong></td><td><code>custom_event_name</code></td><td>Event Name</td><td>String</td></tr><tr><td><strong>Interactions</strong></td><td><code>dom_event_target.text</code></td><td>Target Text</td><td>String</td></tr><tr><td></td><td><code>dom_event_selector</code></td><td>Target Selector</td><td>String</td></tr><tr><td></td><td><code>dom_event_target.id</code></td><td>Target ID</td><td>String</td></tr><tr><td></td><td><code>dom_event_target.className</code></td><td>Target Class Name</td><td>String</td></tr><tr><td><strong>Performance</strong></td><td><code>performance_metric_name</code></td><td>Metric Name</td><td>String</td></tr><tr><td></td><td><code>performance_metric_value</code></td><td>Metric Value</td><td>Numeric</td></tr><tr><td><strong>Navigations</strong></td><td><code>page_url</code></td><td>URL</td><td>String</td></tr></tbody></table>

#### Global properties available for all RUM events:

* `session_id`
* `service.name`
* `location.path`
* `location.title`
* `user.email`
* `user.organization`
* `user.name`
* `browser.version`
* `browser.name`
* `browser.type`
* `browser.platform`

#### Example

Create a visualization of **Errors** over time grouped by **error\_message** in the **demo** service:

<figure><img src="https://2771001740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUHgqKYgCiRKdOpWQdi52%2Fuploads%2Fgit-blob-ed2ad7f39f31cc6e3ec1efb81941e4e2e573d8f5%2FScreenshot%202025-03-30%20at%2019.22.05.png?alt=media" alt=""><figcaption></figcaption></figure>
