• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLKnowledge Workmonitoring

query-patterns

プラグイン
Honeycomb
ソース
GitHub で見る ↗
説明

Honeycomb(クラウド基盤の分析プラットフォーム)でのクエリ(検索・分析命令)の構築と結果の解釈について、実用的で確かな方法を説明します。 対象範囲: - 操作の選択: パーセンタイル値(遅延時間の分布を100段階で表示)の活用、AVG(平均値)ではなく HEATMAP(分布図)の使用 - リレーショナルフィールド(root.、parent.、any.、none. といった関連データの参照パターン) - 計算済みフィールド(既存データから自動算出される項目) - クエリの数式演算 - 結果の読み取り: P99/P50 比率、ヒートマップの帯状表示、TOTAL/OTHER 行、JSON 形式での生データ取得 次のような場合に使用: ユーザーがスパン(処理単位の記録)・トレース(一連の処理フロー)・ログやイベントデータを Honeycomb で検索したいとき。「レイテンシ(応答時間)を表示してほしい」「エラー率を知りたい」「遅いリクエストを見つけたい」「外れ値を抽出したい」「結果を解釈してほしい」「リレーショナルフィールドについて」「計算済みフィールドについて」「生データをダウンロードしたい」といった要望があるとき。 メトリクスデータセット(dataset_type=metrics)を除くすべてのデータセット種別に対応します。メトリクス用のクエリについては、metrics-queries スキルを使用してください。

原文を表示

Opinionated guidance for constructing and interpreting Honeycomb queries on trace and event datasets — operation selection (percentiles not AVG, HEATMAP for distributions), relational field patterns (root., parent., any., none.), calculated fields, query math, and result interpretation (P99/P50 ratios, heatmap bands, TOTAL/OTHER rows, raw JSON via query_result_json). Use this skill when the user wants to query spans, traces, or log/event data in Honeycomb — requests like "show me latency", "error rate", "find slow requests", "find outliers", "interpret results", "relational fields", "calculated fields", or "download raw results". This skill covers all dataset types except metrics datasets (dataset_type=metrics) — for those, use metrics-queries instead.

ユースケース
  • スパン・トレース・ログデータをHoneycombで検索するとき
  • レイテンシの分布や遅いリクエストを分析するとき
  • エラー率や外れ値を抽出・調査するとき
  • クエリ結果の読み取りや解釈が必要なとき
  • リレーショナルフィールドや計算済みフィールドを活用するとき
本文(日本語訳)

Honeycomb クエリパターン

効果的なHoneycombクエリを書くための実践的なガイドです。MCPツールには既にパラメータとスキーマの説明がありますが、このスキルは「いつ なぜ 各パターンを使うのか」に焦点を当てており、「どうやって ツールを呼び出すか」ではありません。

主要な原則

  1. 遅延測定に平均値(AVG)を使わない — 平均値は遅い利用者の実感を見落とします。P99(またはP95/P90)を使って実際に遅い利用者が経験する状況を把握してください。平均値はペイロードサイズなど遅延以外の指標に限定してください。
  2. 分布の確認にはヒートマップ(HEATMAP)を使う — 単一の数値は二山分布(複数の異なるパターンが混在している状態)を隠します。ヒートマップで、利用者が1つのグループなのか2つに分かれているのかを把握してください。
  3. 計算を1つのクエリに組み合わせる — COUNT, P99(duration_ms), HEATMAP(duration_ms) を1つのクエリで実行すると、API呼び出しが減り、全体像が見えます。
  4. 大きな範囲から始めて、WHERE で絞る — COUNT/GROUP BY で全体形を理解してから、フィルタを加えて対象を限定します。
  5. 既存の作業を確認する — 新しいクエリを書く前に find_queries を呼び出してください。誰かが既に同じ質問に答えているかもしれません。

適切な操作を選ぶ

知りたいこと 使用する操作
トラフィック量はどのくらい? COUNT(ルートまたはサービスでグループ化)
ユニークな利用者/IPアドレスは何個? COUNT_DISTINCT(フィールド)
ほとんどの利用者にはどのくらい速い? P50(duration_ms)
遅い利用者にはどのくらい速い? P99(duration_ms)
二山分布のパターンがある? HEATMAP(duration_ms)
最悪のケースは? MAX(duration_ms)
同時実行の処理は何個? CONCURRENCY
時間とともに悪化している? RATE_AVG(duration_ms)

関連フィールド戦略

関連フィールドのプレフィックスを使って、トレース内のスパン(処理の記録)をまたいだ質問をします:

  • 「特定の下流サービスが原因で遅いエンドポイントを見つけたい」: any.service.name でフィルタして、そのサービスが関わるトレースを探し、root.http.route でグループ化して、影響を受けているユーザー向けエンドポイントを把握します。
  • 「エラーが起きたトレースの特徴は何か?」: any.error = true でフィルタし、root.name でグループ化して、トレース木のどのエントリポイントにエラーがあるかを見ます。
  • ノイズを除外する: none.service.name = "health-check" でヘルスチェックを含むトレースを削除します。

計算フィールド

計算フィールドはクエリ実行時に評価される行ごとの式です。コードに変更を加えることなく、既存フィールドを変換・分類・組み合わせます。

3つのスコープ — 必要に応じて最も狭い範囲を選ぶ:

  • クエリスコープ(保存しない):探索的な単発分析
  • データセットレベル(保存):1つのサービスのデータセット内で再利用可能
  • 環境レベル(保存):すべてのデータセット全体で再利用可能(例:error_pct)

一般的なパターン:

  • エラー率: MUL(IF($error, 1, 0), 100) → AVG(error_pct) でパーセンテージを取得
  • ステータス分類: IF(GTE($http.status_code, 500), "5xx", GTE($http.status_code, 400), "4xx", "ok")
  • 遅延の範囲分け: BUCKET($duration_ms, 500, 0, 3000)
  • プレフィックスでのルーティング: IF(STARTS_WITH($url, "/admin"), "admin", STARTS_WITH($url, "/api"), "api", "other")
  • 完全一致の分類: IF(EQUALS(...)) をつなげるのではなく SWITCH を使う — 同じ式でより効率的

重要な注意点:

  • 表示用の別名だけのフィールドを作らない — 別のフィールドをただ名前変更するだけのフィールドは分析的な価値がなく、スキーマを汚します。実際の計算(分類、抽出、演算)をするときだけ、計算フィールドを保存してください。
  • 大きな/複雑なフィールドに正規表現を避ける — REG_MATCH、REG_VALUE、REG_COUNT を exception.stacktrace、db.statement、長いログ行に実行すると非常に遅くなります。より対象を絞ったOpenTelemetry(技術標準)フィールド(exception.type、exception.message、db.operation)が存在するかを先に確認してください。長いフィールドに正規表現を使わなくてはならない場合は、まず CONTAINS チェックで守ってください。
  • EQUALS は厳密な型チェック — EQUALS($http.status_code, 200) はフィールドが文字列として保存されていると黙って false を返します。比較する前に find_columns でフィールド型を確認してください。
  • FORMAT_TIME は重い処理 — 大量のクエリでは避けてください。
  • 一度きりの作業は保存するならクエリスコープで、データセットレベルではなく — 保存されたフィールドは全員のスキーマに表示されます。

完全な構文、操作リファレンス、さらに詳しいアンチパターン例は ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/calculated-fields.md を参照してください。

毎回クエリ前に

  • ユーザー向けの遅延を測定するときは is_root でフィルタする — これがないと、内部の処理記録が数値を膨らませます
  • 人が読める時間範囲を使う("24h"、"-6h")— ユニックスタイムスタンプはエラーが起きやすく、見直しが難しくなります
  • クエリ前に find_columns でカラムを検証する — フィールド名の存在確認と、結果が空になることを防げます

結果の解釈

クエリを実行すると、MCPツールは整形されたマークダウンとメタデータを返します。最も重要なメタデータフィールドは query_result_json — 生のJSON結果へのURLです。正確な分析のため、ASCIIレンダリングだけに頼らず、ダウンロードしてjqやPythonで解析してください。

重要な解釈ルール:

  • P99/P50 が 10倍超 — 二山分布の可能性;HEATMAPで確認してください
  • 結果の TOTAL 行 = すべてのグループ全体の集計
  • OTHER 行 = クエリ上限を超えたグループ(OTHER が大きい場合は上限を上げてください)
  • ASCIIヒートマップ ▁▂▃▄▅▆▇█ = 低から高への密度;2つの帯 = 2つの利用者グループ
  • メタデータの query_run_pk — 外れ値分析のため run_bubbleup に直接渡します

参考資料

リファレンスファイル

  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/visualize-operations.md — VISUALIZE 操作の完全リファレンスと例
  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/relational-fields.md — 関連フィールド詳細ガイドとサービス横断パターン
  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/query-examples.md — ユースケース別に整理された充実したクエリ集
  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/result-interpretation.md — クエリ結果解釈、生JSONアクセス、統計的ヒューリスティックスガイド
  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/calculated-fields.md — 計算フィールド構文、操作リファレンス全体、一般的なパターン、アンチパターン(表示用フィールド、重い文字列操作、型不一致)

関連スキル

  • これらクエリパターンを使う体系的な調査ワークフロー:production-investigation スキル
  • SLO解釈とバーンアラート設計:slos-and-triggers スキル
原文(English)を表示

Honeycomb Query Patterns

Opinionated guidance for writing effective Honeycomb queries. The MCP tools already document their parameters and schemas — this skill focuses on when and why to use each pattern, not how to call the tools.

Key Principles

  1. Never use AVG for latency — AVG hides tail latency. Use P99 (or P95/P90) to see what slow users experience. Reserve AVG for non-latency metrics like payload size.
  2. Use HEATMAP for distributions — Single-number aggregates hide bimodal patterns. HEATMAP reveals whether you have one population or two.
  3. Combine calculations in one query — COUNT, P99(duration_ms), HEATMAP(duration_ms) in a single query reduces API calls and gives a complete picture.
  4. Start broad, narrow with WHERE — Begin with a COUNT/GROUP BY to understand shape, then add filters to focus.
  5. Check for prior work — Call find_queries before writing new queries. Someone may have already answered the question.

Choosing the Right Operation

Question Use
How much traffic? COUNT grouped by route or service
How many unique users/IPs? COUNT_DISTINCT(field)
How fast for most users? P50(duration_ms)
How fast for the worst-off users? P99(duration_ms)
Is there a bimodal pattern? HEATMAP(duration_ms)
What's the worst case? MAX(duration_ms)
How many concurrent operations? CONCURRENCY
Is it getting worse over time? RATE_AVG(duration_ms)

Relational Field Strategy

Use relational prefixes to ask cross-span questions within a trace:

  • "Show me slow endpoints caused by a specific downstream": Filter with any.service.name to find traces where that service participates, group by root.http.route to see which user-facing endpoints are affected.
  • "What's different about errored traces?": Filter with any.error = true, group by root.name to see which entry points have errors somewhere in their trace tree.
  • Exclude noise: none.service.name = "health-check" removes traces containing health checks.

Calculated Fields

Calculated fields are per-event expressions evaluated at query time. They transform, classify, and combine existing fields without re-instrumenting code.

Three scopes — choose the narrowest that fits the need:

  • Query-scoped (not saved): exploratory, one-off analysis
  • Dataset-level (saved): reusable within one service's dataset
  • Environment-level (saved): reusable across all datasets (e.g., error_pct)

Common patterns:

  • Error rate: MUL(IF($error, 1, 0), 100) → use AVG(error_pct) to get percentage
  • Status classification: IF(GTE($http.status_code, 500), "5xx", GTE($http.status_code, 400), "4xx", "ok")
  • Latency bucketing: BUCKET($duration_ms, 500, 0, 3000)
  • Prefix routing: IF(STARTS_WITH($url, "/admin"), "admin", STARTS_WITH($url, "/api"), "api", "other")
  • Exact-match classification: use SWITCH instead of IF(EQUALS(...)) chains — same expression, more efficient

Key guardrails:

  • Don't create presentational (alias-only) fields — a field that just renames another field adds no analytical value and clutters the schema. Only save a calculated field when it does real computation (classification, extraction, math).
  • Avoid regex on large/complex fields — running REG_MATCH, REG_VALUE, or REG_COUNT on exception.stacktrace, db.statement, or full log lines can be very slow. Check whether a more targeted OTel field exists first (exception.type, exception.message, db.operation). If you must regex a long field, guard it with a CONTAINS check first.
  • EQUALS has strict type matching — EQUALS($http.status_code, 200) silently returns false if the field is stored as a string. Use find_columns to verify the field type before comparing.
  • FORMAT_TIME is expensive — avoid in high-volume queries.
  • Save query-scoped, not dataset-level, for one-off work — saved fields show up in everyone's schema.

For full syntax, operator reference, and extended anti-pattern examples, consult ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/calculated-fields.md.

Before Every Query

  • Filter on is_root when measuring user-facing latency — without it, internal spans inflate the numbers
  • Use human-readable time ranges ("24h", "-6h") — epoch timestamps are error-prone and hard to review
  • Validate columns with find_columns before querying — confirms field names exist and prevents empty results

Interpreting Results

After running a query, the MCP tool returns formatted markdown plus metadata. The most important metadata field is query_result_json — a signed URL to the raw JSON result. For precise analysis, download it and parse with jq or python rather than relying solely on the ASCII rendering.

Key interpretation rules:

  • P99/P50 > 10x — bimodal distribution likely; run HEATMAP to confirm
  • TOTAL row in breakdown results = aggregate across all groups
  • OTHER row = groups beyond the query limit (increase limit if OTHER is large)
  • ASCII heatmap ▁▂▃▄▅▆▇█ = density from low to high; two bands = two populations
  • query_run_pk in metadata — feed directly to run_bubbleup for outlier analysis

Additional Resources

Reference Files

  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/visualize-operations.md — Complete VISUALIZE operation reference with examples
  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/relational-fields.md — Detailed relational field guide with cross-service patterns
  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/query-examples.md — Extensive query cookbook organized by use case
  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/result-interpretation.md — Guide to interpreting query results, raw JSON access, and statistical heuristics
  • ${CLAUDE_PLUGIN_ROOT}/skills/query-patterns/references/calculated-fields.md — Calculated field syntax, full operator reference, common patterns, and anti-patterns (presentational fields, expensive string ops, type mismatches)

Cross-References

  • For the structured investigation workflow that uses these query patterns: production-investigation skill
  • For SLO interpretation and burn alert design: slos-and-triggers skill

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。