Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 37 ยท Data Sources

Data Sources Overview

Learn what Grafana data sources are, which built-in and plugin types exist, how to add and test one, proxy versus direct access, the Mixed source and query caching.

A data source tells Grafana how to talk to a storage system: where it lives, how to authenticate, and which query language to use. Without at least one, a dashboard is empty. This lesson covers the common ground shared by every data source; the following lessons look at Prometheus, Loki, SQL and others one by one.

Types of data sources

Category Examples
Metrics Prometheus, Mimir, InfluxDB, Graphite, OpenTSDB
Logs Loki, Elasticsearch, OpenSearch
Traces Tempo, Jaeger, Zipkin
SQL and relational MySQL, PostgreSQL, Microsoft SQL Server
Cloud monitoring CloudWatch, Azure Monitor, Google Cloud Monitoring
Built-in utilities TestData, Mixed, Dashboard (reuse another panel's results), Grafana (internal data)
Plugins MongoDB, Oracle, Snowflake, Jira, Infinity (JSON/CSV/XML over HTTP), many more

Some of the more specialized ones need an Enterprise license or Grafana Cloud; community plugins are installed from the catalog.

Adding a data source

  1. Main menu > Connections > Data sources > Add new data source.
  2. Choose the type (use the search box).
  3. Fill in Name, URL and authentication.
  4. Click Save & test. A green banner means Grafana could connect and read from it; an error message tells you what failed.

You need the Admin role in the organization. Names must be unique; renaming a data source does not break dashboards that refer to it by UID, but old JSON that used the name may.

URL, access and authentication

Most HTTP-based sources have:

  • URL: an address reachable from the Grafana server. In Docker this is often a service name (http://prometheus:9090), never localhost for another container.
  • Access: Server (proxy) means the Grafana backend sends the requests. Browser (direct) access was removed for most sources in current versions. Proxy mode keeps credentials on the server and is the secure choice.
  • Authentication: basic auth, forwarding OAuth identity, TLS client certificates, custom headers (for example X-Scope-OrgID for multi-tenant Loki/Mimir).
  • Secrets: passwords and tokens are stored encrypted using the secret_key, and are not shown again after saving.

Default data source and permissions

You can mark one source as Default; new panels start with it. In Enterprise/Cloud, data source permissions restrict who may query or edit a source. Queries are run with the dashboard viewer's request but the data source's credentials, so give the Grafana account read-only database rights.

Mixed and Dashboard data sources

Mixed lets a single panel send different queries to different data sources, so you can overlay Prometheus latency with MySQL deployment events. Dashboard lets a panel reuse the result of another panel on the same dashboard, so one expensive query feeds several visualizations.

What happens when a panel runs

sequenceDiagram
  participant B as Browser
  participant G as Grafana server
  participant D as Data source
  B->>G: query (range, interval, variables)
  G->>D: native query with credentials
  D-->>G: raw result
  G-->>B: data frames
  B->>B: draw panel

The browser never sees the data source's password: the Grafana server runs the query.

Stand-in: a registry of data sources

The sketch below models "add, test and default" so you can see the rules: unique names, one default, and a connection test that reports a clear message.

JS Stand-in: data source registry

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Stand-in: Mixed queries

A Mixed panel merges frames from several sources by refId. This stand-in runs two fake sources and prints the merged result.

JS Stand-in: a Mixed panel

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Query caching and limits

Grafana Cloud and Enterprise support query caching per data source; in OSS, rely on the backend's own caching and keep refresh intervals sensible. Many sources let you set a timeout and max rows, which protect both Grafana and the database.

Troubleshooting "Save & test" failures

  • Connection refused / no such host: wrong URL, service down or not reachable from Grafana's network.
  • 401/403: wrong credentials or missing permission.
  • TLS errors: self-signed certificate; add the CA certificate or enable "Skip TLS verify" only for labs.
  • Timeout: firewall or very slow backend.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In proxy (server) access mode, who sends the query to the data source?

    The Grafana backend makes the request, keeping credentials off the browser.
  2. 2. Which data source lets one panel combine queries to several sources?

    Mixed sends each query to its own data source and combines the frames.
  3. 3. Why is http://localhost:9090 usually wrong for Prometheus when Grafana runs in a container?

    Use the service name or a reachable address from the Grafana server.
  4. 4. Which role is needed to add a data source?

    Org Admins (or users with data source write permission) can add and edit them.

Summary

  • A data source = connection + credentials + query language.
  • Add it under Connections, then Save & test.
  • Proxy access keeps secrets on the server; use reachable URLs.
  • Mixed and Dashboard sources combine or reuse results.
  • Give Grafana read-only credentials where possible.

Next: The Prometheus Data Source and PromQL Basics