I am new to Prometheus so pardon if this is a silly question.
I have several log files from which I can extract stats/metrics by some easy parser logic. If I just parse this and expose these metrics on a http API like the following:
and add the http address to the Prometheus config file, will my Prometheus instance be able to scrape the metrics?
Also, another question: how does the server/database know that a particular type of metric is counter/histogram/gauge? Is it just nomenclature that is not really used by the server for queries or storage?
Yes. As long as the scrape target is formatted per Prometheus exposition format, you can generate the metrics however you wish. I was unable to find the document I thought existed but, Writing Exporters covers much of the same ground.
Prometheus data model is basically time-series (timestamp, float64) by labels (dimension). The SDK metrics, counter
, gauge
, histogram
and summary
are higher-level abstractions implemented by the SDKs for developer convenience.