简体   繁体   English

在 NiFi 中创建自定义 Prometheus 指标

[英]Create custom Prometheus metrics in NiFi

We are going to use the Prometheus framework to monitor our NiFi instance and dataflows inside.我们将使用 Prometheus 框架来监控我们的 NiFi 实例和内部的数据流。

In order to achieve this, we already configured PrometheusReportingTask to expose pre-existing NiFi metrics.为了实现这一点,我们已经配置了 PrometheusReportingTask 来公开预先存在的 NiFi 指标。

The amount of metrics is pretty full but we would like to create custom Prometheus metrics in or custom/predefined NiFi processors and expose them using PrometheusReportingTask.指标数量非常多,但我们想在自定义/预定义的 NiFi 处理器中创建自定义 Prometheus 指标,并使用 PrometheusReportingTask 公开它们。

Is it possible to implement it?有可能实施吗?

Thanks!谢谢!

PrometheusReportingTask has hardcoded metrics registries and can't be extended as such. PrometheusReportingTask 具有硬编码的指标注册表,因此无法扩展。 You could create your own ReportingTask that opens another port as a Prometheus scrape target and expose your metrics, then your Prometheus instance can scrape both targets.您可以创建自己的 ReportingTask,打开另一个端口作为 Prometheus 抓取目标并公开您的指标,然后您的 Prometheus 实例可以抓取这两个目标。

If you don't want to code a full ReportingTask instance (and a NAR to keep it in), take a look at ScriptedReportingTask , you can put your custom code in there so you don't need to create a project/module/NAR for your custom reporting task.如果你不想编写一个完整的 ReportingTask 实例(和一个 NAR 来保存它),看看ScriptedReportingTask ,你可以把你的自定义代码放在那里,这样你就不需要创建一个项目/模块/NAR用于您的自定义报告任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM