diff options
Diffstat (limited to 'docs/guides/dtail-metrics-example.md')
| -rw-r--r-- | docs/guides/dtail-metrics-example.md | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/docs/guides/dtail-metrics-example.md b/docs/guides/dtail-metrics-example.md new file mode 100644 index 0000000..5416726 --- /dev/null +++ b/docs/guides/dtail-metrics-example.md @@ -0,0 +1,49 @@ +# Dtail Metrics Example + +This page walks through using Epimetheus watch mode with a CSV that could come from a tool like [Dtail](https://dtail.dev/) or any similar log/aggregation export. + +## Scenario + +You have a CSV file (e.g. `dtail.csv`) with columns that mix numeric stats and identifiers (host, service, etc.). You want to turn those into Prometheus metrics so you can graph them in Grafana. + +## Steps + +1. **Ensure the CSV has a header row** + First line = column names. Epimetheus will sanitize them for use as metric names and labels. + +2. **Identify numeric vs string columns** + - Numeric columns (e.g. `count`, `avg_latency_ms`, `p99`) become metric values. + - String columns (e.g. `host`, `service`, `region`) become labels. + +3. **Run watch mode** with a base metric name and your Prometheus (or Prometheus-compatible) write URL: + + ```bash + ./epimetheus -mode=watch \ + -file=dtail.csv \ + -metric-name=dtail \ + -prometheus=http://localhost:9090/api/v1/write + ``` + +4. **Optional: resolve IPs to hostnames** + If one of your label columns contains IPs (e.g. `host` or `ip`), you can resolve them: + + ```bash + ./epimetheus -mode=watch \ + -file=dtail.csv \ + -metric-name=dtail \ + -prometheus=http://localhost:9090/api/v1/write \ + -resolve-ip-labels=host + ``` + +5. **Query in Prometheus / Grafana** + Metrics will appear as `dtail_<column_name>` with your string columns as labels, e.g.: + + ```promql + dtail_avg_latency_ms{service="api", region="eu"} + ``` + +## References + +- [CSV Format Flexibility](csv-format-flexibility.md) – how column types and names are interpreted. +- [DNS Resolution](dns-resolution.md) – IP-to-hostname resolution. +- [Operating Modes](modes.md) – all watch mode options. |
