SigNoz ダッシュボードパネル用の ClickHouse SQL(データベース問い合わせ言語)を作成します。これは、ビルダー UI では表現できない複雑な処理に対応します。具体的には、複数テーブルの結合、ウィンドウ関数(時系列データの統計計算)、ログ本文からの正規表現による抽出、ビルダー構文では対応できない集計などを含む、時系列グラフ・数値表示・テーブルなどのウィジェットに対応しています。 **次のような場合に使用:** - ユーザーが「ClickHouse クエリ」「生の SQL パネル」「カスタム SQL ウィジェット」を明示的に要求する場合 - SigNoz ダッシュボードパネルの説明で、ビルダーでは作成できない SQL クエリが必要な場合 このスキルはダッシュボードパネルの SQL 作成に特化しています。一度きりのデータ探索で、ダッシュボードパネルに組み込まない場合は、代わりに `signoz-generating-queries` を使用してください。
Write raw ClickHouse SQL for a SigNoz dashboard panel — timeseries, value, or table widgets that the builder UI cannot express (custom joins, window functions, regex extraction over log bodies, aggregations beyond builder syntax). Trigger when the user explicitly asks for a "ClickHouse query", a "raw SQL panel", a "custom SQL widget", or describes a SigNoz dashboard panel whose query needs SQL the builder cannot produce. Anchored to dashboard-panel SQL specifically. For ad-hoc data exploration that does not need to land in a panel, use `signoz-generating-queries` instead.
次のようなSigNozクエリについてユーザーが質問した場合に使用します:
ユーザーがダッシュボードパネルをリクエストしたがClickHouseに言及していない場合でも、このスキルを使用してください。
リクエストがログについてなのかトレースについてなのかを判断します。
リクエストが曖昧な場合は、ユーザーに明確にするよう求めてください。
references/clickhouse-logs-reference.md を参照してください。references/clickhouse-traces-reference.md を参照してください。各リファレンスには、テーブルスキーマ、最適化パターン、属性アクセス方法、ダッシュボードテンプレート、クエリ例、検証チェックリストが含まれています。
(ts, value) の行を返すvalue を返すUInt64$start_timestamp_nano および $end_timestamp_nano$start_timestamp および $end_timestampfromUnixTimestamp64Nano(timestamp)signoz_logs.distributed_logs_v2signoz_logs.distributed_logs_v2_resourceDateTime64(9)$start_datetime および $end_datetime$start_timestamp および $end_timestampsignoz_traces.distributed_signoz_index_v3signoz_traces.distributed_traces_v3_resourcets_bucket_start BETWEEN $start_timestamp - 1800 AND $end_timestamp が抜けているIN / JOIN: distributed_product_mode='deny' の場合は失敗します。代わりに時間制限付きのフィンガープリント GLOBAL IN パターンまたはローカル副問い合わせテーブルを使用してください。GLOBAL JOIN は確実に小規模で制限された右側のみに使用してください(全シャードにデータセットを送信するため)GROUP BY から集約されていない列(JSONExtractString(body, ...) などの計算列を含む)を省略している$start_datetime または $end_datetime を使用している$start_timestamp_nano または $end_timestamp_nano を使用しているsignoz_logs.logs、素の logs、distributed_logs に対するログクエリ: 常に signoz_logs.distributed_logs_v2 を使用してくださいresources_string['service.name'] ではなく resource_string_service$$name を使用するトレースクエリ生成されたすべてのクエリは、監視用に SETTINGS 句で終わる必要があります:
SELECT ...
FROM ...
WHERE ...
SETTINGS log_comment = 'signoz-writing-clickhouse-queries skill | YYYY-MM-DD'
YYYY-MM-DD を今日の日付に置き換えてください(例: 2026-04-03)。クエリにすでに SETTINGS 句がある場合は、コンマで区切って log_comment を追加してください。
SETTINGS log_comment 帰属表記句を追加するUse this skill when the user asks for SigNoz queries involving:
If the user asks for a dashboard panel but does not mention ClickHouse, still use this skill.
Identify whether the request is about logs or traces.
If the request is ambiguous, ask the user to clarify.
references/clickhouse-logs-reference.md
before writing any query.references/clickhouse-traces-reference.md
before writing any query.Each reference covers table schemas, optimization patterns, attribute access syntax, dashboard templates, query examples, and a validation checklist.
(ts, value) for a chart over time.value for a stat or counter widget.UInt64 in nanoseconds.$start_timestamp_nano and $end_timestamp_nano.$start_timestamp and $end_timestamp.fromUnixTimestamp64Nano(timestamp).signoz_logs.distributed_logs_v2.signoz_logs.distributed_logs_v2_resource.DateTime64(9).$start_datetime and $end_datetime.$start_timestamp and $end_timestamp.signoz_traces.distributed_signoz_index_v3.signoz_traces.distributed_traces_v3_resource.ts_bucket_start BETWEEN $start_timestamp - 1800 AND $end_timestamp.IN / JOIN whose subquery reads a distributed table: with
distributed_product_mode='deny' it fails. Prefer the time-bounded fingerprint
GLOBAL IN pattern or a local subquery table. Use GLOBAL JOIN only for a
demonstrably small, bounded RHS; it broadcasts that dataset to every shard.GROUP BY, including computed
projections such as JSONExtractString(body, ...).$start_datetime or $end_datetime.$start_timestamp_nano or $end_timestamp_nano.signoz_logs.logs, bare logs, or distributed_logs;
always use signoz_logs.distributed_logs_v2.resources_string['service.name'] instead of
resource_string_service$$name.Every generated query MUST end with a SETTINGS clause for monitoring:
SELECT ...
FROM ...
WHERE ...
SETTINGS log_comment = 'signoz-writing-clickhouse-queries skill | YYYY-MM-DD'
Replace YYYY-MM-DD with today's date (e.g., 2026-04-03). If the query
already has a SETTINGS clause, append log_comment to it with a comma.
SETTINGS log_comment attribution clause.原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。