이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 2. Exposing metrics in your Quarkus applications
Enable metrics in Quarkus 1.11 using the micrometer extension. After you enable it, real-time values of all metrics collected by the micrometer extension are viewed using the /q/metrics endpoint. By default, this endpoint only responds in plain text.
Procedure
Add the
quarkus-micrometer-registry-prometheusextension as a dependency to your application:./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-micrometer-registry-prometheus"
./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-micrometer-registry-prometheus"Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command adds the following dependency to your
pom.xml: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 Enter the following command to display collected metrics on your terminal:
curl http://localhost:8080/q/metrics
curl http://localhost:8080/q/metricsCopy to Clipboard Copied! Toggle word wrap Toggle overflow (Optional) To enable the collection of metrics in JSON format using the Micrometer extension, add the following line to the
src/main/resources/application.propertiesfile:quarkus.micrometer.export.json.enabled=true
quarkus.micrometer.export.json.enabled=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Save the changes to the
application.propertiesfile. Use the following command to view metrics in JSON format:
curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8080/q/metrics
curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8080/q/metricsCopy to Clipboard Copied! Toggle word wrap Toggle overflow