1 Star 0 Fork 1

chenhuxy/oracledb_exporter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
operating-principles.md 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
Yannig Perré 提交于 6年前 . Exporter principles.

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.

Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chenhuxy/oracledb_exporter.git
git@gitee.com:chenhuxy/oracledb_exporter.git
chenhuxy
oracledb_exporter
oracledb_exporter
master

搜索帮助