Amazon OpenSearch Service 中的可觀測性 - Amazon OpenSearch Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Amazon OpenSearch Service 中的可觀測性

適用於 Amazon OpenSearch Service 的 OpenSearch 儀表板預設安裝包括可觀測性外掛程式,您可以用來將使用 Piped Processing Language (PPL) 的資料驅動型事件視覺化,以便探索、發現和查詢存放在 OpenSearch 中的資料。該外掛程式需要 OpenSearch 1.2 或更高版本。

可觀測性外掛程式為從常見資料來源收集和監控指標、日誌和跟蹤提供了統一的體驗。在一處進行資料收集和監控可實現整個基礎設施完整堆疊的端到端可觀測性。

注意

本文件提供 OpenSearch Service 中可觀測性的簡短概觀。如需觀察性外掛程式的完整文件,包括許可,請參閱觀察性

每個人的資料探索程序都不相同。如果您初次探索資料和建立視覺化效果,建議您嘗試如下所示的工作流程。

利用事件分析探索您的資料

首先,假設您在 OpenSearch Service 網域中收集航班資料,而且您想瞭解哪家航空公司上個月有最多抵達匹茲堡國際機場的航班。您可以編寫以下 PPL 查詢:

source=opensearch_dashboards_sample_data_flights | stats count() by Dest, Carrier | where Dest = "Pittsburgh International Airport"

此查詢從名為 opensearch_dashboards_sample_data_flights 的索引中調取資料。然後使用 stats 命令取得航班總數,並根據目的地機場和航空公司進行分組。最後,其使用 where 子句來篩選結果,找出抵達匹茲堡國際機場的航班。

顯示的上個月資料如下所示:

Table showing flight counts to Pittsburgh International Airport for different carriers.

您可以選擇查詢編輯器中的 PPL 按鈕,取得每個 PPL 命令的使用資訊和示例:

OpenSearch PPL Reference Manual showing stats command description and aggregation functions table.

讓我們來看一個更複雜的示例,其查詢與航班誤點有關的資訊:

source=opensearch_dashboards_sample_data_flights | where FlightDelayMin > 0 | stats sum(FlightDelayMin) as minimum_delay, count() as total_delayed by Carrier, Dest | eval avg_delay=minimum_delay / total_delayed | sort - avg_delay

查詢中的每個命令都會影響最終輸出:

  • source=opensearch_dashboards_sample_data_flights – 從與上一個示例相同的索引中調取資料

  • where FlightDelayMin > 0 – 篩選資料,以取得誤點的航班

  • stats sum(FlightDelayMin) as minimum_delay, count() as total_delayed by Carrier – 針對每家航空公司,取得最短總誤點時間和誤點航班總數

  • eval avg_delay=minimum_delay / total_delayed – 藉由將最短誤點時間除以誤點航班總數,計算每家航空公司的平均誤點時間

  • sort - avg_delay – 依平均誤點以降序對結果進行排序

藉助此查詢,您可以判定 OpenSearch 儀表板航空公司一般而言較不會誤點。

Table comparing airline carriers' delay statistics, including average delay and total delayed flights.

您可以在 Event analytics (事件分析) 頁面的 Queries and Visualizations (查詢和視覺化效果) 之下,找到更多範例 PPL 查詢。

建立視覺化效果

正確查詢到您感興趣的資料後,可將這些查詢另存為視覺化效果:

Bar chart showing flight counts to Pittsburgh International Airport by four carriers.

然後將這些視覺化效果新增到操作面板中,以比較不同的資料片段。利用筆記本來組合可與團隊成員共享的不同視覺化效果和程式碼區塊。

利用 Trace Analytics 進行深入分析

Trace Analytics 提供將 OpenSearch 資料中事件流視覺化的方法,以識別和修復分佈式應用程式中的效能問題。

Trace analytics dashboard showing time spent by service and span detail for various operations.