Honeycomb(オブザーバビリティプラットフォーム:システムの動作状況を可視化するツール)から最近のトレース(実行記録)を探して、最近のテスト実行時に何が起きたのかを確認します。 次のような場合に使用:「Honeycombで確認してほしい」「最新のトレースを見つけてほしい」「トレースを表示してほしい」と依頼された場合
Find a recent trace in Honeycomb, to see what happened in a recent test. Use when asked to "verify in Honeycomb", "find the most recent trace", or "show me the trace".
Honeycomb(可視化・監視ツール)を照会して、最近のテストによって作成されたトレース(処理の流れ)を検索します。
このスキルは、以下のような場合に自動で起動します:
クエリ(検索)の結果は以下の形式で報告します:
[VIZ] を照会しました。条件: [FILTERS]、集計方法: [GROUP_BY]、期間: [TIME_RANGE]
結果: [Honeycomb クエリへのリンク]
テスト対象のサービスはどれですか?(これがデータセットを決めます) 予想されるスパン(処理単位)の名前を知っていますか?
以下の条件で照会:
- データセット: [dataset]
- 条件: name = [予想されるスパン名]
- 時間範囲: [計算済みの期間]
- 計算方法: COUNT(数える)
- サンプルを含める: true
最新のサンプルを取り、get_trace を使って完全なトレースを取得します。
結果:
[計算方法] を照会しました。条件: [FILTERS]、期間: [TIME_RANGE]
[count] 件の結果が見つかりました
結果: [クエリへのリンク]
最新のトレース: [トレースへのリンク]
ルートスパン(最上位の処理): [スパン名]
全スパン数: [数値]
関連サービス: [サービス一覧]
以下の条件で照会:
- すべてのデータセット
- 条件: trace.parent_id does-not-exist(親トレースが存在しない)
- 時間範囲: [計算済みの期間]
- 計算方法: COUNT
- 集計: name(スパン名ごと)
- サンプルを含める: true
結果:
[計算方法] を照会しました。条件: [FILTERS]、集計: [BREAKDOWNS]、期間: [TIME_RANGE]
[count] 件の結果が見つかりました
結果: [クエリへのリンク]
各サンプルについて、以下を表示します:
Honeycomb 内のトレースへのリンクを以下の形式で作成します:
https://ui.honeycomb.io/modernity/environments/personal-agent/trace?trace_id=[<traceId>]
&trace_start_ts=[test_start_time]
&trace_end_ts=[((date +%s))]
以下の条件で照会:
計算項目: event_time=EVENT_TIMESTAMP()
計算方法: COUNT
集計: event_time、trace.trace_id
並び順: event_time(新しい順)
取得件数: 1
サンプルを含める: false
パターン1 と同じ形式でトレースの概要を表示します。
取得した trace_id を使い、get_trace で完全なトレースを取得します。
トレースを生成するテストを実行する前に、現在時刻を記録します:
start_time=$(date +%s)
テストを実行してトレースを生成します。
その後、正しい時間範囲を計算します:
echo $(( $(date +%s) - $start_time + 20))
この値をトレース検索のクエリに含めます。
Query Honeycomb to find the traces that were created by a recent test.
This skill is automatically activated when:
Report query results as: Queried [VIZ] where [FILTERS] by [GROUP_BY] over [TIME_RANGE] Results: [link to Honeycomb query]
What service are you testing? This determines the dataset. Do you know the name of the span you expect to see?
Query for:
- dataset: [dataset]
- filter: name = [expected span name]
- time_range: [calculated time range]
- calculation: COUNT
- include_samples: true
Now take the most recent sample, and use get_trace to get the full trace. Output:
Queried [CALCULATION] where [FILTERS] over [TIME_RANGE] Found [count] results Results: [link to the query]
Most recent trace: [link to the trace] Root span: [root span name] Total spans: [count of spans] Services: [list of services]
Query for:
- all datasets
- filter: trace.parent_id does-not-exist
- time_range: [calculated time range]
- calculation: COUNT
- breakdowns: name
- include_samples: true
Output: Queried [CALCULATION] where [FILTERS] by [BREAKDOWNS] over [TIME_RANGE] Found [count] results Results: [link to the query]
For each sample, print:
Query for:
calculated_fields: event_time=EVENT_TIMESTAMP()
calculation: COUNT
breakdowns: event_time, trace.trace_id
order: event_time DESC
limit: 1
include_samples: false
Print the summary of the trace, as in Pattern 1.
Take the output trace_id and use get_trace to get the full trace.
Before running a test that will generate a trace, print the current time.
start_time=$(date +%s)
Then run the test to create the trace.
Then calculate the correct time range:
echo $(( $(date +%s) - $start_time + 20))
Include that in the query you're using to find traces.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。