agentleFS
coralogixcoralogix/cx-cli/skills/cx-telemetry-querying/SKILL.md

cx-telemetry-querying

Skill241 starsChanged 3 months agoApache-2.0View on GitHub

Use this skill for any question involving telemetry data: "investigate an issue", "debug a problem", "find out why something is slow", "check error rates", "analyze user behavior", "understand a production incident", "query telemetry data", "look at logs", "search logs", "find errors", "find stack traces", "de-minify a stack trace", "map a RUM error to source code", "filter by severity", "check traces", "examine spans", "investigate request latency", "debug service-to-service calls", "look up a trace ID", "analyze RUM data", "query rum.events", "check frontend performance", "frontend errors", "Core Web Vitals", "JavaScript exceptions", "query metrics", "check CPU usage", "run a PromQL query", "check error rate", "look up a metric", "check memory usage", "how do I write a DataPrime query", "DataPrime syntax", or wants to answer questions using observability data from logs, metrics, traces, RUM, or APM.

The file

Show its rules and text

We split this skill into the rules it gives an agent

30 rules. About 0 are common, 19 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill as the entry point for any investigation, debugging, or data question that may be answered from telemetry data.

    line 23
  2. Distinctive:

    Before querying, load the reference files for the chosen pillar:

    line 27
  3. Very specific:

    All query commands (cx logs, cx spans, cx metrics, cx dataprime, cx search-fields) are read-only and work in --read-only mode.

    line 41
  4. Distinctive:

    Use this table for obvious cases where one pillar is the clear first choice:

    line 47
  5. Distinctive:

    When the answer could reside in multiple pillars, run discovery in parallel to find the best source.

    line 64
  6. Distinctive:

    Check if a relevant metric exists:

    line 68
  7. Very specific:

    If a matching metric is found, load references/promql-guidelines.md + references/metrics-querying.md and continue.

    line 77
  8. Distinctive:

    Use semantic field search to find relevant DataPrime paths:

    line 81
  9. Distinctive:

    If matching fields are found:

    line 99
  10. Distinctive:

    When discovery results are ambiguous or you need to validate what a metric/field actually represents, search the codebase:

    line 105
  11. Very specific:

    Look for metric registration code (e.g., prometheus.NewCounter, metrics.record)

    line 107
  12. Very specific:

    Look for log statements that emit the field (e.g., logger.info("transaction", ...))

    line 108
  13. Very specific:

    Look for span attributes (e.g., span.setAttribute("purchase.amount", ...))

    line 109
  14. Distinctive:

    Do not stop after one failed attempt.

    line 128
  15. Very specific:

    Search metrics: cx metrics search --name '*revenue*' and cx metrics search --name '*transaction*'

    line 159
  16. Very specific:

    Search log fields: cx search-fields "transaction amount" --dataset logs

    line 160
  17. Very specific:

    Search span fields: cx search-fields "payment total" --dataset spans

    line 161
  18. Very specific:

    If a metric like payment_total_usd exists, load metrics references and run a range query

    line 162
  19. Distinctive:

    If only logs have the data, load logs references and use DataPrime aggregation

    line 163
  20. Very specific:

    If traces have purchase.amount attribute, load spans references

    line 164
  21. Very specific:

    If a histogram metric exists, load metrics references and use histogram_quantile

    line 172
  22. Distinctive:

    If no metric, fall back to traces: load spans references and aggregate span durations

    line 173
  23. Distinctive:

    If RUM shows backend calls are slow, pivot to spans references for the API calls

    line 182
  24. Distinctive:

    Check error rate metrics → load metrics references

    line 189
  25. Distinctive:

    Search for error logs → load logs references

    line 190
  26. Distinctive:

    Not every question is answered by querying data.

    line 198
  27. Distinctive:

    Load references before querying: check the Loading References table first

    line 216
  28. Distinctive:

    Discover before querying: always run search/discovery to find the right source

    line 217
  29. Distinctive:

    Validate with code: when unsure what a metric or field represents, check the codebase

    line 219
  30. Distinctive:

    Pivot on failure: if one pillar is empty, try another before giving up

    line 220

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Telemetry Querying Skill

Use this skill as the entry point for any investigation, debugging, or data question that may be answered from telemetry data. It helps you decide where the relevant signal lives (metrics, logs, traces, RUM) and tells you which reference files to load before querying.

Loading References

Before querying, load the reference files for the chosen pillar:

PillarLoad these files
Logsreferences/dataprime-reference.md + references/logs-querying.md
Spans / Tracesreferences/dataprime-reference.md + references/spans-querying.md
Metricsreferences/promql-guidelines.md + references/metrics-querying.md
RUM (frontend)references/dataprime-reference.md + references/rum-querying.md + references/rum-fields.md
DataPrime syntax onlyreferences/dataprime-reference.md

Safety

All query commands (cx logs, cx spans, cx metrics, cx dataprime, cx search-fields) are read-only and work in --read-only mode. They never modify data and can be run freely without --yes.


Quick Routing Guide

Use this table for obvious cases where one pillar is the clear first choice:

Question TypeFirst ChoiceFallback
UI behavior, page load, frontend errorsRUMTraces (if backend-related)
Endpoint latency, throughput, error ratesMetricsTraces (for per-request detail)
Service-to-service dependencies, request flowTracesLogs (for debug output)
Specific error messages, stack tracesLogsTraces (for request context)
Infrastructure health (CPU, memory, disk)Metrics-
Business events (purchases, signups)Depends - see Discovery Workflow-

For ambiguous questions (e.g., "How much money did users spend last week?"), the signal could live in any pillar. Follow the Discovery Workflow below.


Discovery Workflow

When the answer could reside in multiple pillars, run discovery in parallel to find the best source.

Step 1: Search Metrics

Check if a relevant metric exists:

cx metrics search --name '*transaction*'
cx metrics search --name '*payment*'
cx metrics search --name '*revenue*'
cx metrics search --description "total purchase amount"

If a matching metric is found, load references/promql-guidelines.md + references/metrics-querying.md and continue.

Step 2: Search Log and Span Fields

Use semantic field search to find relevant DataPrime paths:

cx search-fields "transaction amount" --dataset logs
cx search-fields "payment total" --dataset spans
cx search-fields "purchase value" --dataset logs --limit 10

If you know a concrete value that should appear in the data but don't know which field holds it, use value search instead. It returns the matching field keys alongside sample values, which also lets you infer the field's type (string, numeric, enum, etc.):

cx search-fields "payment_failed" -s value --dataset logs
cx search-fields "grpc.status.UNAVAILABLE" -s value --dataset spans
cx search-fields "eu-west-1" -s value --dataset all

Requirements: cx search-fields needs a Coralogix API key or OAuth on the active profile. If credentials are missing, prompt the user to run cx profiles add <name>.

If matching fields are found:

  • For logs: load references/dataprime-reference.md + references/logs-querying.md
  • For spans: load references/dataprime-reference.md + references/spans-querying.md

Step 3: Search the Codebase

When discovery results are ambiguous or you need to validate what a metric/field actually represents, search the codebase:

  • Look for metric registration code (e.g., prometheus.NewCounter, metrics.record)
  • Look for log statements that emit the field (e.g., logger.info("transaction", ...))
  • Look for span attributes (e.g., span.setAttribute("purchase.amount", ...))

This confirms the semantic meaning and helps you choose the right pillar.

Step 4: Choose and Query

Based on discovery results, pick the pillar with the clearest signal, load its reference files (see Loading References), then query.


Fallback and Pivoting

If your initial route yields no results, pivot to another pillar.

Example pivot paths:

  • Metrics empty → try traces (per-request data) or logs (event records)
  • Logs empty → try traces (structured span attributes) or metrics (aggregated counters)
  • Traces empty → try logs (text-based debug output)

Do not stop after one failed attempt. Try at least two pillars before concluding the data does not exist.


CLI Commands Reference

CommandPurposeWhen to Use
cx schemaOutput the full command tree as JSONDiscover all available commands and their flags
cx metrics search --name <pattern>Find metrics by nameFirst step for metrics discovery
cx metrics search --description <text>Semantic metric searchWhen you know what you want but not the name
cx search-fields "<text>" --dataset logsFind log fields by descriptionDiscovery for log-based questions
cx search-fields "<text>" --dataset spansFind span fields by descriptionDiscovery for trace-based questions
cx search-fields "<value>" -s value --dataset logsFind log fields that contain a known valueWhen you know a value but not which log field holds it — also reveals field type from the returned values
cx search-fields "<value>" -s value --dataset spansFind span fields that contain a known valueWhen you know a value but not which span attribute holds it
cx search-fields "<value>" -s value --dataset allSame, across logs and spansWhen you want to search across both logs and spans at once
cx spans "filter $l.serviceName == '<service>'" --limit 10Search spans by serviceWhen investigating a specific service
cx dataprime listList DataPrime commands/functionsWhen building log or span queries
cx dashboards search "<description>"Find existing dashboards by natural-language descriptionBefore creating a new dashboard — check if one already exists
cx dashboards query-search --description "<text>"Find dashboard widgets whose queries cover a topicDiscover how a topic is already being monitored
cx dashboards query-search --field "<field-path>"Find widgets that reference a specific fieldReuse existing PromQL/DataPrime patterns for a known field

Examples

Example 1: Business Question (Ambiguous Source)

Question: "How much money did people spend on the platform last week?"

Approach:

  1. Search metrics: cx metrics search --name '*revenue*' and cx metrics search --name '*transaction*'
  2. Search log fields: cx search-fields "transaction amount" --dataset logs
  3. Search span fields: cx search-fields "payment total" --dataset spans
  4. If a metric like payment_total_usd exists, load metrics references and run a range query
  5. If only logs have the data, load logs references and use DataPrime aggregation
  6. If traces have purchase.amount attribute, load spans references

Example 2: Latency Question (Clear First Choice)

Question: "What's the average latency of the checkout route?"

Approach:

  1. First try metrics: cx metrics search --name '*checkout*latency*' or cx metrics search --name '*http*duration*'
  2. If a histogram metric exists, load metrics references and use histogram_quantile
  3. If no metric, fall back to traces: load spans references and aggregate span durations

Example 3: Frontend Performance (RUM)

Question: "Why is the dashboard page loading slowly for users?"

Approach:

  1. This is clearly a RUM question - load references/rum-querying.md + references/rum-fields.md + references/dataprime-reference.md
  2. Query web vitals and page load times with cx dataprime query --source rum.events '...'
  3. If RUM shows backend calls are slow, pivot to spans references for the API calls

Example 4: Error Investigation (Logs + Traces)

Question: "Why are users getting 500 errors on the payment endpoint?"

Approach:

  1. Check error rate metrics → load metrics references
  2. Search for error logs → load logs references
  3. Get traces for failed requests → load spans references
  4. Cross-reference: find trace IDs in logs, then fetch full traces for root cause

Beyond Investigation

Not every question is answered by querying data. If the user's intent is operational rather than investigative, route to the appropriate workflow skill:

User IntentRoute To
Reducing costs, checking usage, TCO policiescx-cost-optimization
Triaging a case, who got paged, case timelinecx-cases
SLO status, error budget, service-level targetscx-slos
Setting up monitoring, webhooks, notificationscx-observability-setup
Configuring parsing rules, enrichments, E2Mcx-data-pipeline
Access audit, API keys, user managementcx-platform-admin
Creating or managing dashboardscx-dashboards
Finding or searching existing dashboardscx-search-dashboard

Key Principles

  • Load references before querying: check the Loading References table first
  • Discover before querying: always run search/discovery to find the right source
  • Parallel discovery: for ambiguous questions, search metrics, logs, and spans concurrently
  • Validate with code: when unsure what a metric or field represents, check the codebase
  • Pivot on failure: if one pillar is empty, try another before giving up
  • Check stderr warnings on logs, spans, RUM, and other DataPrime queries: they are JSON lines and can mean the results are incomplete (see the Warnings section in dataprime-reference.md)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.