

# OPS04-BP04 實作相依性遙測
<a name="ops_observability_dependency_telemetry"></a>

 對於監控工作負載所依賴的外部服務和元件運作狀況與效能，相依性遙測至關重要，可提供連線能力、逾時，以及像是 DNS、資料庫或第三方 API 等其他與相依性相關重要事件的寶貴洞見。檢測應用程式以產生有關這些相依性的指標、日誌和追蹤，便可更清楚了解可能影響工作負載的潛在瓶頸、效能問題或故障。

 **預期成果：**確保工作負載所依賴的相依性如預期般正常運作，讓您能夠主動解決問題並確保最佳的工作負載效能。

 **常見的反模式：**
+  **忽略外部相依性：**僅關注內部應用程式指標，而忽略與外部相依性相關的指標。
+  **缺乏主動監控：**等待問題出現，而非持續監控相依性的運作狀況與效能。
+  **單獨運作的監控：**使用多種分散的監控工具，如此可能導致僅片段掌握相依性運作狀況且獲得的資訊不一致。

 **建立此最佳實務的優勢：**
+  **改善工作負載可靠性：**確保外部相依性穩定運作並保持最佳效能。
+  **更快偵測並解決問題：**主動找出並解決相依性相關問題，不讓問題影響工作負載。
+  **全方位視角：**獲得全方位視角，有效掌握影響工作負載運作狀況的內部和外部元件。
+  **增強工作負載可擴展性：**了解外部相依性的可擴展性限制與效能特性。

 **未建立此最佳實務時的曝險等級：**高 

## 實作指引
<a name="implementation-guidance"></a>

 從識別您的工作負載所依賴的服務、基礎設施和程序開始，實作相依性遙測。將相依性正常運作時的良好條件量化，然後判斷衡量時所需的資料。有了這些資訊，您就可以打造儀表板並設定警示，以便為營運團隊提供這些相依性狀態的洞見。相依性無法按需求運作時，使用 AWS 工具探索並量化其影響。持續重新檢視您的策略，以考量優先順序、目標和獲得的洞見的變化。

### 實作步驟
<a name="implementation-steps"></a>

 若要有效實作相依性遙測：

1.  **識別外部相依性：**與利益相關者協作，共同找出工作負載所依賴的外部相依性。外部相依性可能包含各種服務，像是外部資料庫、第三方 API、前往其他環境的網路連線能力路由，以及 DNS 服務。實現有效相依性遙測的第一步，就是徹底了解這些相依性。

1.  **擬訂監控策略：**清楚了解外部相依性之後，就可以為其量身打造監控策略。這包括了解每一項相依性的重要性、預期行為，以及任何相關的服務層級協議或目標 (SLA 或 SLT)。設定主動警示，以便在發生狀態變更或效能偏差時通知您。

1.  **使用[網路監控](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Network-Monitoring-Sections.html)：**使用[網際網路監控](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-InternetMonitor.html)和[網路監控](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/what-is-network-monitor.html)，全面了解全球網際網路和網路狀況。這些工具可協助您了解並回應影響外部相依性的停機、中斷或效能降低。

1.  **利用 [AWS Health](https://aws.amazon.com/premiumsupport/technology/aws-health/) 隨時掌握新知：**AWS Health 是 AWS 雲端 資源運作狀態的權威資訊來源。使用 AWS Health 視覺化並接收有關任何目前服務事件和近期變更的通知 (例如規劃的生命週期事件)，如此您就能採取行動來緩解衝擊。

   1.  透過 [AWS 使用者通知](https://docs.aws.amazon.com/notifications/latest/userguide/what-is-service.html) [建立符合用途的 AWS Health 事件通知](https://docs.aws.amazon.com/health/latest/ug/user-notifications.html)，以利用電子郵件和聊天管道傳送，並[透過 Amazon EventBridge 或 [AWS Health API](https://docs.aws.amazon.com/health/latest/APIReference/Welcome.html) 以程式設計方式與您的監控和警示工具整合](https://docs.aws.amazon.com/health/latest/ug/cloudwatch-events-health.html)。

   1.  透過 Amazon EventBridge 或 AWS Health API 整合變更管理或您可能已在使用的 ITSM 工具 (如 [Jira](https://docs.aws.amazon.com/smc/latest/ag/cloud-sys-health.html) 或 [ServiceNow](https://docs.aws.amazon.com/smc/latest/ag/sn-aws-health.html))，以規劃並追蹤需要採取行動的運作狀態事件進度。

   1.  如果您使用 AWS Organizations，請啟用 [AWS Health 的組織檢視](https://docs.aws.amazon.com/health/latest/ug/aggregate-events.html)，以彙總帳戶之間的 AWS Health 事件。

1.  **使用 [AWS X-Ray](https://aws.amazon.com/xray/) 檢測您的應用程式：**AWS X-Ray 提供了深入了解應用程式及其基礎相依性運作效能的洞見。透過從頭到尾追蹤請求，您就可以找出應用程式所依賴的外部服務或元件的瓶頸或故障。

1.  **使用 [Amazon DevOps Guru](https://aws.amazon.com/devops-guru/)：**這項機器學習驅動的服務可識別操作問題，預測重大問題可能在什麼時候發生，並且建議可採取的特定行動。對於獲得相依性洞見並確保其不是造成操作問題的根源來說，這項服務非常寶貴。

1.  **定期監控：**持續監控與外部相依性相關的指標和日誌。針對非預期的行為或效能降低的情況設定警示。

1.  **變更後驗證：**每當有任何外部相依性更新或變更，便驗證其效能並檢查是否符合您的應用程式需求。

 **實作計劃的工作量：**中 

## 資源
<a name="resources"></a>

 **相關的最佳實務：**
+  [OPS04-BP01 定義工作負載 KPI](https://docs.aws.amazon.com/wellarchitected/latest/operational-excellence-pillar/ops_observability_identify_kpis.html) 
+  [OPS04-BP02 實作應用程式遙測](https://docs.aws.amazon.com/wellarchitected/latest/operational-excellence-pillar/ops_observability_application_telemetry.html) 
+  [OPS04-BP03 實作使用者活動遙測](https://docs.aws.amazon.com/wellarchitected/latest/operational-excellence-pillar/ops_observability_customer_telemetry.html) 
+  [OPS04-BP05 實作交易可追溯性](https://docs.aws.amazon.com/wellarchitected/latest/operational-excellence-pillar/ops_observability_dist_trace.html) 
+  [OP08-BP04 建立可執行的提醒](https://docs.aws.amazon.com/wellarchitected/latest/operational-excellence-pillar/ops_workload_observability_create_alerts.html) 

 **相關文件：**
+  [Amazon Personal Health 儀板表 使用者指南](https://docs.aws.amazon.com/health/latest/ug/what-is-aws-health.html) 
+  [AWS 網際網路監控使用者指南](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-InternetMonitor.html) 
+  《AWS X-Ray 開發人員指南》[https://docs.aws.amazon.com/xray/latest/devguide/aws-xray.html](https://docs.aws.amazon.com/xray/latest/devguide/aws-xray.html) 
+  [AWS DevOps Guru 使用者指南](https://docs.aws.amazon.com/devops-guru/latest/userguide/welcome.html) 

 **相關影片：**
+  [深入了解影響應用程式效能的網際網路問題](https://www.youtube.com/watch?v=Kuc_SG_aBgQ) 
+  [Amazon DevOps Guru 簡介](https://www.youtube.com/watch?v=2uA8q-8mTZY) 
+  [使用 AWS Health 大規模管理資源生命週期事件](https://www.youtube.com/watch?v=VoLLNL5j9NA) 

 **相關範例：**
+  [AWS Health Aware](https://github.com/aws-samples/aws-health-aware/) 
+  [使用以標籤為基礎的篩選來大規模管理 AWS Health 監控和提醒](https://aws.amazon.com/blogs/mt/using-tag-based-filtering-to-manage-health-monitoring-and-alerting-at-scale/) 