<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>User guides on Grafana Labs</title><link>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/</link><description>Recent content in User guides on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/index.xml" rel="self" type="application/rss+xml"/><item><title>Dashboards as code</title><link>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/dashboards-as-code/</link><pubDate>Mon, 12 Oct 2026 15:20:54 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/dashboards-as-code/</guid><content><![CDATA[&lt;h1 id=&#34;manage-dashboards-as-code-with-gcx&#34;&gt;Manage dashboards as code with &lt;code&gt;gcx&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;With this workflow, you can define and manage dashboards as code, saving them to a version control system like Git. This is useful for teams that want to maintain a history of changes, collaborate on dashboard design, and ensure consistency across environments.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;In order to use the &lt;code&gt;gcx dev serve&lt;/code&gt; functionality, you need to enable a feature toggle in your configuration file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;ini&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-ini&#34;&gt;[feature_toggles]
kubernetesDashboards = true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Refer to &lt;a href=&#34;/docs/grafana/latest/setup-grafana/configure-grafana/#feature_toggles&#34;&gt;Configure Grafana&lt;/a&gt; to learn more about enabling feature toggles.&lt;/p&gt;
&lt;p&gt;Although the local preview proxy supports service account token, Basic, and mTLS contexts, use a service account token instead of OAuth for &lt;code&gt;gcx dev serve&lt;/code&gt;. OAuth is rejected before startup until refresh-token rotation can be persisted safely by the long-running server.&lt;/p&gt;
&lt;h2 id=&#34;workflow&#34;&gt;Workflow&lt;/h2&gt;
&lt;p&gt;To manage dashboards as code with &lt;code&gt;gcx&lt;/code&gt; follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use a dashboard generation script (for example, with the &lt;a href=&#34;https://github.com/grafana/grafana-foundation-sdk&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Foundation SDK&lt;/a&gt;). You can find an example implementation in the Grafana as code &lt;a href=&#34;https://github.com/grafana/dashboards-as-code-workshop/tree/main/part-one-golang-starter&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;hands-on lab repository&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Serve and preview the output of the dashboard generator locally:

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx config use-context YOUR_CONTEXT  # for example &amp;#34;dev&amp;#34;
gcx dev serve --script &amp;#39;go run scripts/generate-dashboard.go&amp;#39; --watch &amp;#39;./scripts&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;When the output looks correct, generate dashboard manifest files:

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;go run scripts/generate-dashboard.go --generate-resource-manifests --output &amp;#39;./resources&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Push the generated resources to your Grafana instance:

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx config use-context YOUR_CONTEXT  # for example &amp;#34;dev&amp;#34;
gcx resources push -p ./resources/&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="manage-dashboards-as-code-with-gcx">Manage dashboards as code with &lt;code>gcx&lt;/code>&lt;/h1>
&lt;p>With this workflow, you can define and manage dashboards as code, saving them to a version control system like Git. This is useful for teams that want to maintain a history of changes, collaborate on dashboard design, and ensure consistency across environments.&lt;/p></description></item><item><title>Explore and modify resources</title><link>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/explore-modify-resources/</link><pubDate>Mon, 12 Oct 2026 15:20:54 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/explore-modify-resources/</guid><content><![CDATA[&lt;h1 id=&#34;explore-and-modify-resources-with-gcx&#34;&gt;Explore and modify resources with &lt;code&gt;gcx&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;The Grafana CLI allows you to interact with Grafana resources directly from your terminal. You can browse, inspect, update, and delete resources without using the Grafana UI.&lt;/p&gt;
&lt;p&gt;Use this approach if you&amp;rsquo;re an advanced user and want to manage resources more efficiently, or to integrate Grafana operations into automated workflows.&lt;/p&gt;
&lt;h2 id=&#34;find-and-delete-dashboards-using-incorrect-data-sources&#34;&gt;Find and delete dashboards using incorrect data sources&lt;/h2&gt;
&lt;p&gt;To identify and remove production dashboards relying on non-production data sources, use the command below to list dashboard UIDs along with the data source UIDs used in their panels:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx resources get dashboards --context prod | jq &amp;#39;.items | map({ uid: .metadata.name, datasources: .spec.panels | map(.datasource.uid)  })&amp;#39;
[
   {
      &amp;#34;uid&amp;#34;: &amp;#34;important-production-dashboard&amp;#34;,
      &amp;#34;datasources&amp;#34;: [
         &amp;#34;mimir-prod&amp;#34;
      ]
   },
   {
      &amp;#34;uid&amp;#34;: &amp;#34;test-dashboard-from-dev&amp;#34;,
      &amp;#34;datasources&amp;#34;: [
         &amp;#34;mimir-dev&amp;#34;
      ]
   },
   {
      &amp;#34;uid&amp;#34;: &amp;#34;test-dashboard-from-stg&amp;#34;,
      &amp;#34;datasources&amp;#34;: [
         &amp;#34;mimir-stg&amp;#34;
      ]
   }
]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next, identify the dashboards that are using unexpected data sources, and delete them:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx resources delete dashboards/test-dashboard-from-stg,test-dashboard-from-dev
✔ 2 resources deleted, 0 errors&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;edit-remote-resources&#34;&gt;Edit remote resources&lt;/h2&gt;
&lt;p&gt;You can edit resources directly from the default editor, without having to pull them first:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx resources edit dashboard/edit-me-please&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This command opens the default editor as configured by the &lt;code&gt;EDITOR&lt;/code&gt; environment variable, or fall back to &amp;lsquo;vi&amp;rsquo; for Linux or &amp;rsquo;notepad&amp;rsquo; for Windows.&lt;/p&gt;
&lt;p&gt;After the editor process terminates, the resource is updated in the Grafana instance targeted by the current context. Note that edition will be cancelled if no changes are written to the file or if the file after edition is empty.&lt;/p&gt;
]]></content><description>&lt;h1 id="explore-and-modify-resources-with-gcx">Explore and modify resources with &lt;code>gcx&lt;/code>&lt;/h1>
&lt;p>The Grafana CLI allows you to interact with Grafana resources directly from your terminal. You can browse, inspect, update, and delete resources without using the Grafana UI.&lt;/p></description></item><item><title>Manage resources</title><link>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/manage-resources/</link><pubDate>Mon, 12 Oct 2026 15:20:54 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/manage-resources/</guid><content><![CDATA[&lt;h1 id=&#34;manage-resources-with-gcx&#34;&gt;Manage resources with &lt;code&gt;gcx&lt;/code&gt;&lt;/h1&gt;
&lt;h2 id=&#34;migrate-resources-between-environments&#34;&gt;Migrate resources between environments&lt;/h2&gt;
&lt;p&gt;Grafana resources can be migrated from one environment to another, for example from a development to production environment.&lt;/p&gt;
&lt;p&gt;You need to &lt;a href=&#34;../../configuration#define-contexts&#34;&gt;configure one context per environment&lt;/a&gt;. In this example scenario, use &lt;code&gt;dev&lt;/code&gt; for the development environment and &lt;code&gt;prod&lt;/code&gt; for production.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make changes to dashboards and other resources using the Grafana UI in your &lt;strong&gt;development instance&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Pull those resources from the development environment to your local machine:

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx resources pull --context dev # Add `-o yaml` export resources as YAML &lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Push the resources to production:

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx resources push --context prod&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;

&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Resources are pulled and pushed from the &lt;code&gt;./resources&lt;/code&gt; directory by default.
Configure this path with the &lt;code&gt;--path&lt;/code&gt;/&lt;code&gt;-p&lt;/code&gt; flags.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

Resources are pulled and pushed from the &lt;code&gt;./resources&lt;/code&gt; directory by default.
Configure this path with the &lt;code&gt;--path&lt;/code&gt;/&lt;code&gt;-p&lt;/code&gt; flags.&lt;/p&gt;
&lt;h2 id=&#34;back-up-and-restore-resources&#34;&gt;Back up and restore resources&lt;/h2&gt;
&lt;p&gt;Follow this workflow to back up all Grafana resources from one instance and later restore them. This can be useful to replicate a configuration or perform disaster recovery.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ensure the current context points to the Grafana instance to backup/restore:

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx config use-context YOUR_CONTEXT  # for example &amp;#34;prod&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Pull all resources from your target environment:

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx resources pull --path ./backup-prod # Add `-o yaml` to export resources as YAML&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Save the exported resources to version control or cloud storage.&lt;/li&gt;
&lt;li&gt;Push the resources to restore them:

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx resources push --path ./backup-prod&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="manage-resources-with-gcx">Manage resources with &lt;code>gcx&lt;/code>&lt;/h1>
&lt;h2 id="migrate-resources-between-environments">Migrate resources between environments&lt;/h2>
&lt;p>Grafana resources can be migrated from one environment to another, for example from a development to production environment.&lt;/p></description></item><item><title>Lint resources</title><link>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/lint-resources/</link><pubDate>Mon, 12 Oct 2026 15:20:54 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/lint-resources/</guid><content><![CDATA[&lt;h1 id=&#34;lint-resources-with-gcx&#34;&gt;Lint resources with &lt;code&gt;gcx&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;Use the Grafana CLI linter to verify that resources, such as dashboards and alert rules, comply with good practices and environment-specific policies.&lt;/p&gt;
&lt;h2 id=&#34;use-the-linter&#34;&gt;Use the linter&lt;/h2&gt;
&lt;p&gt;To lint resources run:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;gcx dev lint run ./resources&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The following applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Directories are recursively explored.&lt;/li&gt;
&lt;li&gt;All &lt;a href=&#34;https://github.com/grafana/gcx/blob/main/docs/reference/linter-rules/index.md&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;built-in rules&lt;/a&gt; are enabled by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;configure-linter-rules&#34;&gt;Configure linter rules&lt;/h3&gt;
&lt;p&gt;For a finer control, you can configure the linter rules:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;# Disable all rules for a resource type:
gcx dev lint run --disable-resource dashboard ./resources

# Disable all rules in a category:
gcx dev lint run --disable-category idiomatic ./resources

# Disable specific rules:
gcx dev lint run --disable uneditable-dashboard --disable panel-title-description ./resources

# Enable rules for specific resource types:
gcx dev lint run --disable-all --enable-resource dashboard ./resources

# Enable only some categories:
gcx dev lint run --disable-all --enable-category idiomatic ./resources

# Enable only specific rules:
gcx dev lint run --disable-all --enable uneditable-dashboard ./resources&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can modify the severity level of a rule by updating the &lt;code&gt;custom.severity&lt;/code&gt; annotation. Valid values are &lt;code&gt;warning&lt;/code&gt; and &lt;code&gt;error&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;define-custom-linting-rules&#34;&gt;Define custom linting rules&lt;/h2&gt;
&lt;p&gt;Custom and built-in rules are defined in &lt;a href=&#34;https://www.openpolicyagent.org/docs/policy-language&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Rego&lt;/a&gt;, the policy language used by &lt;a href=&#34;https://www.openpolicyagent.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Open Policy Agent (OPA)&lt;/a&gt;. This ensures that resources comply with policies specific to your environment.&lt;/p&gt;
&lt;p&gt;You can scaffold new custom rules with &lt;code&gt;gcx&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;# Creates a new &amp;#34;dashboard&amp;#34; linter rule in the current directory:
gcx dev lint new dashboard custom-rule&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This generates a file with the bootstrapped rule:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;rego&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-rego&#34;&gt;# METADATA
# description: Briefly describe the rule here.
# custom:
#  severity: warning
package custom.gcx.rules.dashboard.idiomatic[&amp;#34;custom-rule&amp;#34;]

import data.gcx.result
import data.gcx.utils

# Dashboard v1
report contains violation if {
	utils.resource_is_dashboard_v1(input)

	input.spec.timezone != &amp;#34;utc&amp;#34;

	violation := result.fail(rego.metadata.chain(), sprintf(&amp;#34;timezone is &amp;#39;%s&amp;#39;, expected &amp;#39;utc&amp;#39;&amp;#34;, input.spec.timezone))
}

# Dashboard v2
report contains violation if {
	utils.resource_is_dashboard_v2(input)

	input.spec.timeSettings.timezone != &amp;#34;utc&amp;#34;

	violation := result.fail(rego.metadata.chain(), sprintf(&amp;#34;timezone is &amp;#39;%s&amp;#39;, expected &amp;#39;utc&amp;#39;&amp;#34;, input.spec.timeSettings.timezone))
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Refer to the existing &lt;a href=&#34;https://github.com/grafana/gcx/tree/main/internal/linter/bundle/gcx/rules&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Built-in rules&lt;/a&gt; for inspiration to write custom ones.&lt;/p&gt;
&lt;h3 id=&#34;rules-for-other-resources&#34;&gt;Rules for other resources&lt;/h3&gt;
&lt;p&gt;You can create rules for other resource types than dashboards, or in categories other than &lt;code&gt;idiomatic&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;shell&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-shell&#34;&gt;# Creates a new &amp;#34;alertrule&amp;#34; linter rule, categorized under &amp;#34;bug&amp;#34;:
gcx dev lint new alertrule custom-rule -c bug&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="lint-resources-with-gcx">Lint resources with &lt;code>gcx&lt;/code>&lt;/h1>
&lt;p>Use the Grafana CLI linter to verify that resources, such as dashboards and alert rules, comply with good practices and environment-specific policies.&lt;/p></description></item><item><title>Diagnose missing telemetry</title><link>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/diagnose-missing-telemetry/</link><pubDate>Mon, 12 Oct 2026 15:20:54 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/guides/diagnose-missing-telemetry/</guid><content><![CDATA[&lt;h1 id=&#34;diagnose-missing-telemetry-with-gcx&#34;&gt;Diagnose missing telemetry with &lt;code&gt;gcx&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;If you&amp;rsquo;re investigating an empty dashboard or missing application telemetry, use this guide to learn how to use &lt;code&gt;gcx&lt;/code&gt; to gather evidence before proposing a repair. You don&amp;rsquo;t need a new diagnostic skill or Grafana Cloud.&lt;/p&gt;
&lt;p&gt;You can investigate directly or use an agent with &lt;code&gt;gcx&lt;/code&gt; existing skills. Start with evidence, ask before repairs, and verify the original symptom afterward. If you use an agent, its harness and model access are separate from &lt;code&gt;gcx&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Before you begin, make sure to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Follow &lt;a href=&#34;../../installation&#34;&gt;Install gcx&lt;/a&gt; if &lt;code&gt;gcx version&lt;/code&gt; is unavailable.&lt;/li&gt;
&lt;li&gt;Follow &lt;a href=&#34;https://github.com/grafana/gcx#install-agent-skills&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Install Agent Skills&lt;/a&gt; for your harness. Start a session that can discover the installed skills. The existing &lt;code&gt;debug-with-grafana&lt;/code&gt; skill handles investigation; &lt;code&gt;setup-gcx&lt;/code&gt; helps with setup.&lt;/li&gt;
&lt;li&gt;Use a reachable Grafana instance supported by your &lt;code&gt;gcx&lt;/code&gt; version, with access to the relevant datasources. A static instrumentation check alone does not provide a telemetry destination.&lt;/li&gt;
&lt;li&gt;If you have no backend, &lt;a href=&#34;https://github.com/grafana/docker-otel-lgtm#run-the-docker-image&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;start docker-otel-lgtm&lt;/a&gt;   for a local development sink. Setting up a sink does not authorize changing an existing application&amp;rsquo;s exporter. A local proof does not establish that your production destination works.&lt;/li&gt;
&lt;li&gt;Know which application or fixture you may inspect. Do not enumerate unrelated containers, environments, or services to compensate for missing context.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The command examples use the current &lt;code&gt;gcx&lt;/code&gt; command surface. Check &lt;code&gt;gcx version&lt;/code&gt; and the relevant command&amp;rsquo;s &lt;code&gt;--help&lt;/code&gt; when following them with another release.&lt;/p&gt;
&lt;h2 id=&#34;connect-without-changing-your-usual-context&#34;&gt;Connect without changing your usual context&lt;/h2&gt;
&lt;p&gt;If you have already configured the destination, use explicit &lt;code&gt;--config&lt;/code&gt; and &lt;code&gt;--context&lt;/code&gt; arguments. Don&amp;rsquo;t switch the current context just for this investigation. Otherwise, create a separate private configuration outside your checkout.&lt;/p&gt;
&lt;p&gt;The examples use &lt;code&gt;GCX_CONFIG&lt;/code&gt;, the actual &lt;code&gt;gcx&lt;/code&gt; environment override. If it&amp;rsquo;s pointing at another configuration, unset it first:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;GCX_DIAGNOSTICS_DIR=$(mktemp -d)
export GCX_CONFIG=&amp;#34;$GCX_DIAGNOSTICS_DIR/config.yaml&amp;#34;
(umask 077; printf &amp;#39;{}\n&amp;#39; &amp;gt; &amp;#34;$GCX_CONFIG&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Keep the path until cleanup. In another terminal, set the variable to the same path; don&amp;rsquo;t create a second empty configuration by repeating the block.&lt;/p&gt;
&lt;h3 id=&#34;log-in&#34;&gt;Log in&lt;/h3&gt;
&lt;p&gt;For an existing Grafana destination, use interactive login with a new context in that file, replacing the example URL:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;gcx login diagnostics --config &amp;#34;$GCX_CONFIG&amp;#34; \
  --server https://your-grafana.example&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For local LGTM, use that repository&amp;rsquo;s local connection instructions instead of this login step. Refer to &lt;a href=&#34;../../configuration&#34;&gt;Configure gcx&lt;/a&gt; for supported authentication methods. &lt;strong&gt;Supply credentials locally through the supported authentication flow&lt;/strong&gt;, not in chat, copied transcripts, or committed files. Prefer read-only access when available as approval instructions don&amp;rsquo;t restrict API permissions.&lt;/p&gt;
&lt;h3 id=&#34;check-the-overrides&#34;&gt;Check the overrides&lt;/h3&gt;
&lt;p&gt;Environment overrides can still affect the selected configuration. Review which overrides you intentionally set before running queries and don&amp;rsquo;t dump your whole environment or configuration into a transcript. Don&amp;rsquo;t disable TLS verification to make a connection error disappear.&lt;/p&gt;
&lt;p&gt;Use your selected context name below, where &lt;code&gt;diagnostics&lt;/code&gt; is the login example:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;gcx config check --config &amp;#34;$GCX_CONFIG&amp;#34; --context diagnostics
gcx datasources list --config &amp;#34;$GCX_CONFIG&amp;#34; --context diagnostics&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;verify-the-connection-and-authentication&#34;&gt;Verify the connection and authentication&lt;/h3&gt;
&lt;p&gt;Stop and resolve any connection or authentication errors before interpreting query results.&lt;/p&gt;
&lt;p&gt;For example, against a Prometheus datasource:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;gcx metrics query &amp;#39;vector(1)&amp;#39; --datasource &amp;#39;PROMETHEUS_DATASOURCE_UID&amp;#39; \
  --error-on-empty \
  --config &amp;#34;$GCX_CONFIG&amp;#34; --context diagnostics&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Keep in mind the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Choose the datasource UID returned by discovery, rather than assuming a default.&lt;/li&gt;
&lt;li&gt;A successful configuration check doesn&amp;rsquo;t prove application ingestion.&lt;/li&gt;
&lt;li&gt;A returned value proves that query path works, not that the application emitted metrics.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With &lt;code&gt;--error-on-empty&lt;/code&gt;, an empty response exits unsuccessfully; without it, a successful empty query, an invalid query, and a failed connection are different observations. The flag is supported on the Prometheus query, Loki logs/metrics, Tempo search/metrics, and Pyroscope query commands, but it&amp;rsquo;s not a generic flag for unrelated datasource query commands.&lt;/p&gt;
&lt;h2 id=&#34;use-an-agent-for-diagnostics&#34;&gt;Use an agent for diagnostics&lt;/h2&gt;
&lt;p&gt;Start the agent in the relevant application or test checkout, and provide it with the symptoms and boundaries for diagnostics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The original dashboard URL, failed test assertion, or checker finding.&lt;/li&gt;
&lt;li&gt;The explicit gcx config path, context, and intended destination (no secrets).&lt;/li&gt;
&lt;li&gt;The application/service identity and one representative operation, if known.&lt;/li&gt;
&lt;li&gt;The UTC time window, observed query, and request/trace identifiers, if available.&lt;/li&gt;
&lt;li&gt;The relevant Compose project, deployment, or Collector configuration you own.&lt;/li&gt;
&lt;li&gt;Which resources may be inspected and which actions require approval.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Make sure the agent doesn&amp;rsquo;t invent answers and to identify what information or access is missing. For example, use this prompt, filling in what you know:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;Use the existing gcx skills to investigate `&amp;lt;symptom&amp;gt;`. Query only `&amp;lt;config path and context&amp;gt;` and inspect only `&amp;lt;application/fixture scope&amp;gt;`. The expected operation is `&amp;lt;operation&amp;gt;` in `&amp;lt;time window&amp;gt;`. Diagnose first and distinguish observed evidence from hypotheses. State what you could not observe; do not infer data loss from missing access. Ask before changing application, Collector, dashboard, or test configuration, restarting resources, or enabling payload logging. Do not weaken an assertion to make a test pass. Propose the smallest justified repair, and stop for approval.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;An empty dashboard can result from no data being created, export failure, filtering, an incorrect query, or a time/identity mismatch. Static configuration and absence of results are leads, not proof of a particular failure boundary.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Always ask for the evidence supporting each conclusion and the next discriminating check&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&#34;verify-a-repair-and-restore-the-environment&#34;&gt;Verify a repair and restore the environment&lt;/h2&gt;
&lt;p&gt;After approving a specific change:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Exercise a fresh representative operation and record its time and available identifiers. Old telemetry must not satisfy the recovery check.&lt;/li&gt;
&lt;li&gt;Query the relevant datasource, then recheck the original dashboard or rerun the original test uncached. A successful backend query alone does not prove the panel or assertion is correct.&lt;/li&gt;
&lt;li&gt;Review the actual diff and runtime changes. Functional recovery doesn&amp;rsquo;t prove that unrelated dashboard or configuration fields were preserved.&lt;/li&gt;
&lt;li&gt;Restore temporary diagnostic configuration and logging. Remove temporary backups and stop only resources created for this investigation, after confirming they are no longer needed. Never clean up pre-existing resources by assumption.&lt;/li&gt;
&lt;li&gt;Record the confirmed cause, remaining unknowns, approved changes, and result.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Debug-exporter payloads and logs may contain sensitive data. Enable them only with permission, for a bounded investigation, and never publish raw output. Avoid full environment dumps or HTTP payload logging that can expose credentials.&lt;/p&gt;
&lt;p&gt;If you created the private directory above, inspect it locally and remove only that directory when finished. Remove any diagnostic credentials stored by login using your normal credential-management process; deleting a config file doesn&amp;rsquo;t revoke a server-side token. Explicit configuration or context arguments leave your usual current context unchanged. Don&amp;rsquo;t delete an existing configuration used for the investigation, or revoke a credential shared with another workflow.&lt;/p&gt;
]]></content><description>&lt;h1 id="diagnose-missing-telemetry-with-gcx">Diagnose missing telemetry with &lt;code>gcx&lt;/code>&lt;/h1>
&lt;p>If you&amp;rsquo;re investigating an empty dashboard or missing application telemetry, use this guide to learn how to use &lt;code>gcx&lt;/code> to gather evidence before proposing a repair. You don&amp;rsquo;t need a new diagnostic skill or Grafana Cloud.&lt;/p></description></item></channel></rss>