監視 Spring Boot

在您安裝 Instana 代理程式之後,會自動部署並安裝 Spring Boot 感應器。

在依照這個主題所概述來配置 Spring Boot 掣動器之後,您可以在 Instana 使用者介面中檢視與 Spring Boot 應用程式相關的度量值。

支援的資訊

支援的版本

Instana 支援 Spring Boot 1.x、 2.x 及 3.x。

支援的作業系統

Spring Boot 感應器支援的作業系統與主機代理程式需求一致,您可以在每一個主機代理程式的「支援的作業系統」區段中檢查這些需求,例如 支援的作業系統 Linux

配置 Spring Boot 掣動器

Spring Boot 監視需要在 pom.xml 檔中配置 Spring Boot 掣動器:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

啟用 JMX

對於 Spring Boot 2.2.x 以及更新版本,您必須透過設定下列內容,在 application.properties 檔案中啟用「Java 管理延伸 (JMX)」:

spring.jmx.enabled=true

公開 Spring Boot 管理 MBean

如果在具有下列配置設定的 application.properties 檔中停用端點,則您需要公開 Spring Boot 管理 MBean ,因為感應器依賴 MBean 來收集 Spring Boot 應用程式中的度量值:

management.endpoints.enabled-by-default=false

您可以啟用下列端點來公開 Spring Boot 管理 MBean:

management.endpoint.info.enabled=true
management.endpoint.health.enabled=true
management.endpoint.metrics.enabled=true
management.endpoint.env.enabled=true

Instana 會查詢 Spring Boot 管理 MBean org.springframework.boot:type=Endpoint,name=Metrics中的度量值,且您不需要配置安全掣動器端點的鑑別或認證。

設定性能-間隔參數

依預設, Instana 會查詢管理 MBean org.springframework.boot:type=Endpoint,name=Health,每 10 分鐘查詢一次 Spring Boot 應用程式的性能。

必要的話,您可以在秒內配置所需的 health-interval 參數:

com.instana.plugin.springboot:
  health-interval: 30

附註: 性能檢查可能會建立新的下游呼叫,視性能檢查實作而定。 如果性能檢查失敗,則您會看到警告訊息,指出主要原因。

透過 HTTP 公開端點

對於 Spring Boot 2 以及更新版本, Spring Boot 掣動器提供 Micrometer的相依關係管理及自動配置。 視 Spring Boot 版本而定, JVM 儀表板上會提供不同的 Micrometer 度量

附註: 您必須仔細考量何時透過 HTTP 公開端點,因為端點可能包含機密性資訊。 依預設,只會公開性能端點。 如需相關資訊,請參閱 公開端點

若要從 HTTP 排除特定端點,請使用下列指引:

management.endpoints.web.exposure.exclude=health,info

若要從 HTTP 排除所有端點,請使用下列指引:

management.endpoints.web.exposure.exclude=*

附註: 對於 Spring Boot 3.x,在 Instana 使用者介面中顯示應用程式配置內容之前,您需要在 application.properties 檔案中進行額外變更,這是 Spring Boot 應用程式的標準配置檔。 否則,由於機密值,這些內容會顯示為 ****** 。 如需相關資訊,請參閱 消毒機密值

若要一律將值顯示為明碼,請在 application.properties 檔案中使用下列配置:

management.endpoint.env.show-values=ALWAYS

命名 Spring Boot 應用程式

Instana 使用 build-info.properties 檔案來解壓縮 Spring Boot 實例的名稱。 例如,可以使用 spring-boot-maven-plugin來產生此檔案:

<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
    <executable>true</executable>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>build-info</goal>
      </goals>
      <configuration>
        <additionalProperties>
          <name>${project.artifactId}</name>
          <version>${project.version}</version>
        </additionalProperties>
      </configuration>
    </execution>
  </executions>
</plugin>

如需與掣動器整合的相關資訊,請參閱 Spring Boot Maven 外掛程式說明文件

或者,您也可以在應用程式配置中設定 spring.application.name 內容。 不過,您必須先配置 Spring Boot 掣動器。 如需相關資訊,請參閱 配置 Spring Boot 掣動器

檢視度量值

若要檢視度量值,請完成下列步驟:

  1. 在 Instana 使用者介面的資訊看板中,選取 基礎架構
  2. 按一下特定的受監視主機。

您可以查看包含所有已收集度量及受監視處理程序的主機儀表板。

Spring Boot 掣動器端點會監視 Spring Boot 應用程式,並從中收集下列資料:

配置資料

Instana Spring Boot 感應器會收集下列配置資料:

配置 說明
名稱 Spring Boot 應用程式的名稱。
應用程式版本 Spring Boot 應用程式的建置版本。
SpringBoot 版本 Spring Boot 架構的版本。
狀態 Spring Boot 應用程式的狀態,例如 UpDown
Spring Boot 應用程式的 HTTP 埠。
HTTP 階段作業限制 Spring Boot 應用程式的 HTTP 階段作業數上限。
應用程式配置 Spring Boot 應用程式配置資訊,包括配置路徑和內容。

效能度量

Instana Spring Boot 感應器會收集下列度量值:

度量 說明 精度
端點要求或回應明細 每一個回應狀態碼
(1xx、 2xx、 3xx、 4xx或 5xx) 的每秒要求數
1 秒
HTTP 階段作業 作用中 HTTP 階段作業數 1 秒

性能簽章

對於每一個感應器,會根據送入的度量持續評估性能簽章的策劃知識庫,並用來提出取決於使用者影響的問題或發生事件。

內建事件 會根據實體上的性能簽章失敗來觸發問題或突發事件,而 自訂事件 會根據任何所選實體的個別度量值臨界值來觸發問題或突發事件。

如需 Spring Boot 感應器之建置事件的相關資訊,請參閱 內建事件參照

疑難排解

使用這些疑難排解項目來協助解決與監視 Spring Boot 應用程式相關的問題。 在 Instana 使用者介面中的 Spring Boot 儀表板上,會顯示一則錯誤訊息,其中含有所指出的問題類型,以及關於發生錯誤的簡要說明。

Spring Boot 未配置掣動器

監視問題類型: springboot_actuator_not_configured

如果要配置 Spring Boot 掣動器,請參閱 配置 Spring Boot 掣動器

JMX 未啟用

監視問題類型: springboot_jmx_not_enabled

若要啟用 JMX ,請參閱 配置 Spring Boot 掣動器