Expose Prometheus metrics

更新时间:
复制 MD 格式

This topic describes how to expose Remote Procedure Call (RPC) monitoring metrics using Prometheus.

Prerequisites

Use SOFABoot version 3.10.3 or later.

Procedure

  1. Add the following dependency to your project that uses SOFARPC:

    Important

    Do not specify the version. The dependencyManagement element controls the version.

    <dependency>
     <groupId>io.micrometer</groupId>
     <artifactId>micrometer-registry-prometheus</artifactId>
    </dependency>

    Adding this dependency automatically activates the Prometheus metrics for RPC.

  2. Add the following configuration to the application.properties file to expose the Actuator Prometheus endpoint.

    management.endpoints.web.exposure.include=prometheus,<Other endpoints>

After the project starts, you can access the Prometheus monitoring metrics through Actuator. The SOFARPC monitoring metrics will be included.

If the preceding steps do not resolve the issue, perform the following steps:

  • Check if your project includes spring-boot-starter-actuator. If not, add it.

  • Check if the open source SOFARPC version in your project is later than 5.9.1. If the version is earlier, modify or remove the SOFARPC version specification.

    Note

    SOFABoot 3.10.3 uses open source SOFARPC version 5.11.1.