---
title: "ezgh obs metrics query"
description: "Evaluate PromQL over the project's metrics."
---

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

# ezgh obs metrics query

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh obs metrics query <promql> [--time t | --from t [--to t] [--step d]] [flags]
```

Evaluate a PromQL expression over the metrics of every dataset (environment) in the project that you may query. Without range flags it's an instant query, at `--time` (default now). With `--from`, `--to` or `--step` it's a range query: from `--from` (default 1h ago) to `--to` (default now), every `--step` (default: a step that gives about 250 points).

Metric names are Prometheus-style (`http.server.request.duration` in seconds is `http_server_request_duration_seconds`), and every series has the labels `environment`, `application`, `job` and `instance`. To read one environment, say so in the query: `up{environment="production"}`. Times are RFC 3339, a date, or a duration ago (2h, 7d); steps and timeouts are durations (15s, 5m, 1h) or seconds. -o json prints the Prometheus API's own answer.

Part of [`ezgh obs metrics`](/cli/reference/obs-metrics).

## Examples

```sh
ezgh obs metrics query 'sum by (job) (rate(http_server_request_duration_seconds_count[5m]))'
ezgh obs metrics query 'histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{environment="production"}[5m])))' --from 6h --step 5m
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--from` | string |  | a range query's start (default 1h ago) |
| `--step` | string |  | a range query's resolution, like 15s or 5m (default: about 250 points) |
| `--time` | string |  | an instant query's time (default now) |
| `--timeout` | string |  | evaluation timeout, at most the server's (30s) |
| `--to` | string |  | a range query's end (default now) |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/obs-metrics-query/index.mdx
