Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Latest commit

 

History

History
20 lines (13 loc) · 1.12 KB

operating-principles.md

File metadata and controls

20 lines (13 loc) · 1.12 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 toml file (default-metrics.toml) and store each metrics in a Metric struct
  • Load the custom toml file (if a custom toml file is 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.