signoz-generating-queries
Generate, write, or run an ad-hoc query against SigNoz observability data — metrics, logs, or traces — without wrapping it in a dashboard panel or alert. Make sure to use this skill whenever the user asks "show me error rates", "query logs for timeout errors", "what's the p99 latency for the cart service", "how many requests hit the payment endpoint", "find slow traces", "errors in the last hour", or otherwise asks an exploratory question that needs live observability data — even if they don't say "query" or "search" explicitly.
SigNoz · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add SigNoz/agent-skills --skill signoz-generating-queries技能说明
name: signoz-generating-queries description: > Generate, write, or run an ad-hoc query against SigNoz observability data (metrics, logs, or traces) without wrapping it in a dashboard panel or alert. Make sure to use this skill whenever the user asks "show me error rates", "query logs for timeout errors", "what's the p99 latency for the cart service", "how many requests hit the payment endpoint", "find slow traces", "errors in the last hour", or otherwise asks an exploratory question that needs live observability data, even if they don't say "query" or "search" explicitly.
Query Generate
Prerequisites
This skill calls SigNoz MCP server tools heavily (signoz_execute_builder_query,
signoz_query_metrics, signoz_search_logs, signoz_search_traces,
signoz_aggregate_logs, signoz_aggregate_traces, signoz_get_field_keys,
signoz_get_field_values, signoz_list_metrics, signoz_list_services,
signoz_get_service_top_operations, signoz_get_trace_details). Before
running the workflow, confirm the signoz_* tools are available. If they
are not, run signoz-mcp-setup first to initialize or repair the MCP connection.
Do not fall back to raw HTTP calls or fabricate query results without the MCP
tools.
When to use
Use this skill when the user asks to:
- Query, search, or look up observability data (traces, logs, metrics)
- Compute aggregations (error rate, p99 latency, request count, throughput)
- Find specific log entries, traces, or metric values
- Investigate patterns (spikes, drops, trends over time)
Do NOT use when:
- User wants raw ClickHouse SQL for a dashboard panel (custom joins, window functions, regex over log bodies); that's a separate dashboard-panel SQL workflow, not this skill.
- User needs the Exceptions Explorer as an exception-specific signal: the current MCP contract has no exception query tool. Explain that limitation and offer an equivalent error-trace or error-log query only if it answers their underlying question.
Instructions
Step 1: Determine the signal type
Map the user's intent to the right signal:
| User intent | Signal | Why |
|---|---|---|
| Error rate, latency, throughput, request count | metrics (preferred) or traces | Metrics are pre-aggregated and fastest. Use traces if the user needs per-request detail or no matching metric exists. |
| p50/p75/p90/p95/p99 latency | metrics (histogram) or traces (aggregate on duration_nano) | Prefer metrics if a histogram metric exists (e.g., signoz_latency_bucket). Fall back to trace aggregation. |
| Find specific log entries, error messages, stack traces | logs | Text search, pattern matching, severity filtering. |
| Find specific traces, slow requests, error spans | traces | Per-request detail, span attributes, duration filtering. |
| Infrastructure metrics (CPU, memory, disk, network) | metrics | Always metrics for resource utilization. |
| Ingestion volume (bytes or count), cost, or billing usage | metrics with source=meter (Cost Meter) | signoz.meter.* ingestion metrics (logs/spans/datapoints by count and bytes) live only in the meter store; bytes are unavailable on the raw signals. Dollar cost is not a metric; derive it from volume × per-unit price (see Step 2). groupBy/filter work like a normal metric, but only over the limited attribute set the meter retains (not arbitrary log/trace fields). For a count sliced by an attribute the meter doesn't carry, aggregate logs/traces directly instead. |
| "How many X per Y" (count/rate grouped by dimension) | traces or logs (aggregate) | Use signoz_aggregate_traces or signoz_aggregate_logs for grouped counts. |
Traces have no unqualified full-text search; use CONTAINS against a discovered
structured trace field. searchText-style body search is logs-only.
If the signal is genuinely ambiguous, ask the user before proceeding. The
host application decides how the question is surfaced (e.g. a structured
clarification tool or an inline <assistant_question> tag); follow the
host's UI rendering rules.
Step 2: Discover available data
Always discover before querying. Use only names returned by tools, never guess from training knowledge.
Run discovery calls in parallel where possible:
-
For metrics: Call
signoz_list_metricswith asearchTextsubstring matching the user's intent (e.g.,searchText: "http",searchText: "latency"). The response includes metric type, temporality, and isMonotonic; pass these tosignoz_query_metricsto avoid extra lookups. Before filtering or grouping, discover labels withsignoz_get_field_keys(signal: "metrics", metricName: <discovered-name>); metric labels are not trace/log attributes (db.system, for example, is a span attribute unless discovery also returns it for metrics).Choose
timeAggregationfrom the discovered metric metadata:Metric type Valid timeAggregationgauge latest,sum,avg,min,max,count,count_distinctmonotonic counter/sum rate,increasenon-monotonic sum avg,sum,min,max,count,count_distinct; neverlatestorratehistogram / exponential histogram omit; aggregation is automatic -
For Cost Meter (ingestion volume, cost, billing): pass
source=metertosignoz_list_metricsto discover the metrics (signoz.meter.*); they're invisible in the default store and the set evolves, so don't hardcode it. groupBy/filters/aggregations then work like any metric, with three caveats: bytes exist only here (count is also available via directsignoz_aggregate_logs/_traces); the meter retains only a limited attribute set, so discover groupable keys viasignoz_get_field_keys(signal: "metrics", source: "meter"), and fall back to a direct count (no bytes) to slice by an attribute it lacks; and dollar cost is not a meter metric: the store holds only vol