10.11. 使用 Micrometer 和 Prometheus 来监控 school timetable OptaPlanner Quarkus 应用程序
OptaPlanner 通过 Micrometer 公开指标数据,这是 Java 应用程序的指标检测库。您可以将 Micrometer 与 Prometheus 搭配使用以监控 school timetable 应用程序中 OptaPlanner solver。
先决条件
- 您已创建了 Quarkus OptaPlanner school timetable 应用程序。
- 已安装 Prometheus。有关安装 Prometheus 的详情,请查看 Prometheus 网站。
流程
将 Micrometer Prometheus 依赖项添加到 school timetable
pom.xml
文件中:<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-micrometer-registry-prometheus</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-micrometer-registry-prometheus</artifactId> </dependency>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 启动 school timetable 应用程序:
mvn compile quarkus:dev
mvn compile quarkus:dev
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
在 Web 浏览器中打开
http://localhost:8080/q/metric
。