spring中actuator監(jiān)視器配置詳解
actuator 配置說明
作用
主要是完成微服務(wù)的監(jiān)控,完成監(jiān)控治理。可以查看微服務(wù)間的數(shù)據(jù)處理和調(diào)用,當它們之間出現(xiàn)了異常,就可以快速定位到出現(xiàn)問題的地方。
依賴
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
配置
SpringBoot2.x相對于1.5.x版本而言,Actuator也發(fā)生很多變化,配置也發(fā)生了相應的變化。
基本配置
# 端口號 management.server.port=9001 # API路徑 management.server.servlet.context-path=/ # health是否顯示細節(jié),可選never,always,when-authenticated management.endpoint.health.show-details=always # 公開所有端點,默認只有端點/health和/info端點是暴露的,可以通過include和exclude進行包括和排除 management.endpoints.web.exposure.include=* management.endpoints.web.exposure.exclude=env
1.5.x與2.x版本屬性比較
舊的屬性 | 新的屬性 |
endpoints..* | management.endpoint..* |
endpoints.cors.* | management.endpoints.web.cors.* |
endpoints.jmx.* | management.endpoints.jmx.* |
management.address | management.server.address |
management.context-path | management.server.servlet.context-path |
management.ssl.* | management.server.ssl.* |
management.port | management.server.port |
說明: SpringBoot2.x已經(jīng)去掉了management.security的配置
endpoints接口信息
- 所有 endpoints 默認情況下都已移至"/actuator"。即多了根路徑actuator
- 默認只有端點/health和/info端點是暴露的。
endpoints屬性
HTTP 方法 | 路徑 | 描述 |
GET | /actuator/conditions | 提供了一份自動配置報告,記錄哪些自動配置條件通過了,哪些沒通過(之前為autoconfig) |
GET | /actuator/configprops | 描述配置屬性(包含默認值)如何注入Bean |
GET | /actuator/beans | 描述應用程序上下文里全部的Bean,以及它們的關(guān)系 |
GET | /actuator/dump | 獲取線程活動的快照 |
GET | /actuator/env | 獲取全部環(huán)境屬性 |
GET | /actuator/env/{name} | 根據(jù)名稱獲取特定的環(huán)境屬性值 |
GET | /actuator/health | 報告應用程序的健康指標,這些值由HealthIndicator的實現(xiàn)類提供 |
GET | /actuator/info | 獲取應用程序的定制信息,這些信息由info打頭的屬性提供 |
GET | /actuator/mappings | 描述全部的URI路徑,以及它們和控制器(包含Actuator端點)的映射關(guān)系 |
GET | /actuator/metrics | 報告各種應用程序度量信息,比如內(nèi)存用量和HTTP請求計數(shù) |
GET | /actuator/metrics/{name} | 報告指定名稱的應用程序度量值 |
POST | /actuator/shutdown | 關(guān)閉應用程序,要求endpoints.shutdown.enabled設(shè)置為true |
GET | /actuator/httptrace | 提供基本的HTTP請求跟蹤信息(時間戳、HTTP頭等)(之前為trace) |
到此這篇關(guān)于spring中actuator監(jiān)視器配置詳解的文章就介紹到這了,更多相關(guān)spring的actuator內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Spring Boot實現(xiàn)功能的統(tǒng)一詳解
這篇文章主要介紹了Spring Boot統(tǒng)一功能的處理,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2022-06-06使用mybatis切片實現(xiàn)數(shù)據(jù)權(quán)限控制的操作流程
數(shù)據(jù)權(quán)限控制需要對查詢出的數(shù)據(jù)進行篩選,對業(yè)務(wù)入侵最少的方式就是利用mybatis或者數(shù)據(jù)庫連接池的切片對已有業(yè)務(wù)的sql進行修改,本文給大家介紹了使用mybatis切片實現(xiàn)數(shù)據(jù)權(quán)限控制的操作流程,需要的朋友可以參考下2024-07-07SpringBoot項目接入Nacos的實現(xiàn)步驟
SpringBoot項目使用nacos作為配置中心和服務(wù)注冊中心,同時兼容dubbo的注冊中心。 本Demo項目使用的SpringBoot版本是2.3.9.RELEASE2021-05-05