TimelessMetrics.HTTP (timeless_metrics v6.0.6)

Copy Markdown View Source

Optional HTTP ingest interface compatible with VictoriaMetrics JSON line import format.

Usage

Add to your supervision tree alongside TimelessMetrics:

children = [
  {TimelessMetrics, name: :metrics, data_dir: "/var/lib/metrics"},
  {TimelessMetrics.HTTP, store: :metrics, port: 8428}
]

Endpoints

Ingest

  • POST /api/v1/import - VictoriaMetrics JSON line import

Query

  • GET /api/v1/export - Export raw points in VM JSON line format
  • GET /api/v1/query - Latest value for a series
  • GET /api/v1/query_range - Range query with bucketed aggregation

Charts

  • GET /chart - SVG line chart, embeddable via <img> tag

Operational

  • GET /health - Health check with store stats

Query Parameters

All query endpoints accept:

  • metric - metric name (required)
  • Any other param becomes a label filter (e.g. ?metric=cpu_usage&host=web-1)

Range endpoints also accept:

  • start or from - start timestamp (unix seconds, default: 1 hour ago)
  • end or to - end timestamp (unix seconds, default: now)

/api/v1/query_range also accepts:

  • step - bucket size in seconds (default: 60)
  • aggregate - one of: avg, min, max, sum, count, last, first (default: avg)

VictoriaMetrics JSON Line Format

Each line is a JSON object:

{"metric":{"__name__":"cpu_usage","host":"web-1"},"values":[73.2,74.1],"timestamps":[1700000000,1700000060]}

The __name__ field is the metric name; all other fields in metric become labels. values and timestamps are parallel arrays.

Vector Configuration

[sinks.metricstore]
type = "http"
inputs = ["metrics_transform"]
uri = "http://localhost:8428/api/v1/import"
encoding.codec = "text"
framing.method = "newline_delimited"

Summary

Functions

child_spec(opts)

dispatch(arg1, arg2, req)

handle(req)