explore-datasources

Discover datasources, metrics, labels, and log streams in a Grafana instance using gcx commands.

1|Updated May 25, 2020
One-click install
npx skills add https://github.com/titaneric/dotfiles --skill explore-datasources-titaneric
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: explore-datasources
Source: https://github.com/titaneric/dotfiles/tree/main/dot_agents/skills/explore-datasources
Command: npx skills add https://github.com/titaneric/dotfiles --skill explore-datasources-titaneric

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? When working with Grafana, it is often unclear which datasources exist, what metrics or logs they contain, or which UID to use in queries. This Skill provides a structured workflow to inventory datasources and explore their Prometheus metrics and Loki log streams before writing queries. ## Core Features & Use Cases - Datasource Inventory: List all Grafana datasources by type (Prometheus, Loki) and retrieve their UIDs for use in subsequent commands. - Metrics Exploration: Enumerate Prometheus labels, label values, and metric metadata, then validate findings with instant or range PromQL queries. - Log Stream Discovery: Inspect Loki labels and list log streams using LogQL selectors with exact, regex, and negation matchers. - Use Case: A dashboard shows no data for a service. Use this Skill to verify the datasource exists, check whether the service appears in the up metric or job labels, and test a query to pinpoint whether the issue is configuration, scraping, or label selection. ## Quick Start Ask the assistant to list what metrics and log streams are available in your Grafana instance and identify the datasource UID for Prometheus.

Frequently Asked Questions about explore-datasources

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I list all datasources in Grafana from the command line?

Run gcx datasources list to show all datasources with their UID, name, type, and URL. Add --type prometheus or --type loki to filter by datasource type, and always use the UID in subsequent commands.

How do I find which services are sending logs to Loki?

Use gcx logs labels -d <uid> --label job to list job values, then run gcx logs series -d <uid> -M '{job="name"}' to see the log streams for a specific job. The series command requires at least one LogQL match selector.

What is the difference between instant and range Prometheus queries?

Instant queries with --time return a value at a single moment, while range queries with --from and --to return a series over a window. Use range queries for trends, peaks, and functions like increase() or max_over_time().

Why does the Loki series command fail with a match selector error?

The series command requires at least one -M flag containing a LogQL selector such as '{job="varlogs"}'. Also wrap the selector in single quotes so the shell does not misinterpret the inner double quotes.

Can I avoid passing the datasource UID to every gcx command?

Yes, set a default with gcx config set contexts.<context-name>.default-prometheus-datasource <uid> or the equivalent default-loki-datasource key. After that, the -d flag can be omitted from datasource commands.

What are the limitations of the gcx logs series command?

The series command supports label selectors only, including exact, regex, and negation matchers. It does not support log filters, parsers, or metric functions; use gcx logs query with full LogQL for those features.