---
# System prepended metadata

title: PromQL
tags: [fastwork]

---

# PromQL
###### tags: `fastwork`

## Port-forward prometheus
```
kubectl port-forward statefulset/prometheus 9090:9090 -n lens-metrics
```


## CPU Usage
```
sum by (namespace, container_name) (rate(container_cpu_usage_irate{namespace="production", container_name="fw-backend-x"}[5m]) * 100)
```

## Memory Usage
```
sum by (namespace, container_name) (rate(container_memory_usage_bytes{namespace="production", container_name="fw-backend-x"}[5m])*100)
```

## Percentile

### CPU
```
quantile(0.95, (rate(container_cpu_usage_irate{namespace="production", container_name="fw-desktop-v4"}[5m]) * 100))
```

### Memory
```
quantile(0.95, (rate(container_memory_usage_bytes{namespace="production", container_name="fw-backend-x"}[5m])*100))
```