Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 1.19 KB

operating-principles.md

File metadata and controls

20 lines (13 loc) · 1.19 KB

Operating principles

The exporter itself is dumb and does not do much. The initialization is done as follows:

  • Parse flags options
  • Load the default metrics definition file (both toml and yaml are supported) and store each metrics in a Metric struct
  • Load the custom metrics definition file, if given
  • Create an Exporter object
  • Register exporter in prometheus library
  • Launching a web server to handle incoming requests

These operations are mainly done in the main function.

After this initialization phase, the exporter will wait for the arrival of the request.

Each time, it will iterate over the content of the metricsToScrap structure (in the function scrape func (e * Export) scrape (ch chan <- prometheus.Metric)).

For each element (of Metric type), a call to the ScrapeMetric function will be made which will itself make a call to the ScrapeGenericValues function.

The ScrapeGenericValues function will read the information from the Metric structure and - depending on the parameters - will generate the metrics to return. In particular, it will use the GeneratePrometheusMetrics function which will make SQL calls to the database.