http://localhost:17001/actuator/prometheus
頁面:HTTP ERROR 406
uj5u.com熱心網友回復:
貼一下你的請求和回應截圖uj5u.com熱心網友回復:
你提供資訊有限,不過406是客戶端例外,406是指請求回傳的內容不符合你的request header里Accept的定義,例如/actuator/prometheus需要Accept:text/plain, 我猜你要么是Accept寫錯了,要么很可能引入了處理json的jar,導致/actuator/prometheus回傳的是json,而不是textuj5u.com熱心網友回復:
application.yml檔案下面配置management:
endpoints:
web:
exposure:
include: info,health,prometheus
server:
servlet:
context-path: /
port: 17001
pom.xml下面引入
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Micrometer Prometheus registry -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
uj5u.com熱心網友回復:

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/12773.html
標籤:Java相關
