<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Observability as code on Grafana Labs</title><link>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/</link><description>Recent content in Observability as code on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v13.0/as-code/observability-as-code/index.xml" rel="self" type="application/rss+xml"/><item><title>Introduction to Grafana CLI</title><link>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/grafana-cli/</link><pubDate>Tue, 14 Apr 2026 09:48:24 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/grafana-cli/</guid><content><![CDATA[

  
    
      
    
  

  &lt;div&gt;
  &lt;div class=&#34;d-flex flex-direction-row flex-direction-column-small gap-2 justify-content-start align-items-center align-items-start-small flex-wrap &#34;&gt;&lt;div class=&#34;d-flex flex-direction-column&#34;&gt;
      &lt;div&gt;&lt;h1
  
  id=&#34;observability-as-code&#34;
  &gt;Observability as Code&lt;/h1&gt;&lt;/div&gt;
      
        &lt;div class=&#34;&#34;&gt;Using Observability as Code, you can version, automate, and scale Grafana configurations, including dashboards and observability workflows.&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2 id=&#34;explore&#34;&gt;Explore&lt;/h2&gt;

&lt;div class=&#34;w-100p&#34;&gt;
  &lt;div class=&#34;card-content-grid mt-1&#34;&gt;&lt;a class=&#34;card sm&#34; href=&#34;./grafana-cli/&#34;&gt;
  &lt;div class=&#34;card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start &#34;&gt;&lt;div class=&#34;card-title body-default fw-500 lh-2 text-gray-16&#34;&gt;Grafana CLI&lt;/div&gt;&lt;div class=&#34;card-description body-small text-gray-12 fw-400&#34;&gt;Grafana CLI (&lt;code&gt;grafanactl&lt;/code&gt;) is a command-line tool designed to simplify interaction with Grafana instances using the new REST APIs. You can authenticate, manage multiple environments, and perform administrative tasks from the terminal. It&amp;rsquo;s suitable for CI/CD pipelines, local development, or free-form tasks.&lt;/div&gt;&lt;/div&gt;
&lt;/a&gt;&lt;a class=&#34;card sm&#34; href=&#34;./foundation-sdk/&#34;&gt;
  &lt;div class=&#34;card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start &#34;&gt;&lt;div class=&#34;card-title body-default fw-500 lh-2 text-gray-16&#34;&gt;Foundation SDK&lt;/div&gt;&lt;div class=&#34;card-description body-small text-gray-12 fw-400&#34;&gt;The Grafana Foundation SDK is a set of tools, types, and libraries that let you define Grafana dashboards and resources using familiar programming languages like Go, TypeScript, Python, Java, and PHP. Use it in conjunction with &lt;code&gt;grafanactl&lt;/code&gt; to push your programmatically generated resources.&lt;/div&gt;&lt;/div&gt;
&lt;/a&gt;&lt;a class=&#34;card sm&#34; href=&#34;./git-sync/intro-git-sync/&#34;&gt;
  &lt;div class=&#34;card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start &#34;&gt;&lt;div class=&#34;card-title body-default fw-500 lh-2 text-gray-16&#34;&gt;Git Sync&lt;/div&gt;&lt;div class=&#34;card-description body-small text-gray-12 fw-400&#34;&gt;Git Sync lets you store your dashboard files in a GitHub repository and synchronize those changes with your Grafana instance, enabling version control, branching, and pull requests directly from Grafana.&lt;/div&gt;&lt;/div&gt;
&lt;/a&gt;&lt;a class=&#34;card sm&#34; href=&#34;./provision-resources/&#34;&gt;
  &lt;div class=&#34;card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start &#34;&gt;&lt;div class=&#34;card-title body-default fw-500 lh-2 text-gray-16&#34;&gt;On-prem file provisioning&lt;/div&gt;&lt;div class=&#34;card-description body-small text-gray-12 fw-400&#34;&gt;File provisioning in Grafana lets you include resources, including folders and dashboard JSON files, that are stored in a local file system.&lt;/div&gt;&lt;/div&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;div>
&lt;div class="d-flex flex-direction-row flex-direction-column-small gap-2 justify-content-start align-items-center align-items-start-small flex-wrap ">&lt;div class="d-flex flex-direction-column">
&lt;div>&lt;h1
id="observability-as-code"
>Observability as Code&lt;/h1>&lt;/div>
&lt;div class="">Using Observability as Code, you can version, automate, and scale Grafana configurations, including dashboards and observability workflows.&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="explore">Explore&lt;/h2>
&lt;div class="w-100p">
&lt;div class="card-content-grid mt-1">&lt;a class="card sm" href="./grafana-cli/">
&lt;div class="card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start ">&lt;div class="card-title body-default fw-500 lh-2 text-gray-16">Grafana CLI&lt;/div>&lt;div class="card-description body-small text-gray-12 fw-400">Grafana CLI (&lt;code>grafanactl&lt;/code>) is a command-line tool designed to simplify interaction with Grafana instances using the new REST APIs. You can authenticate, manage multiple environments, and perform administrative tasks from the terminal. It&amp;rsquo;s suitable for CI/CD pipelines, local development, or free-form tasks.&lt;/div>&lt;/div>
&lt;/a>&lt;a class="card sm" href="./foundation-sdk/">
&lt;div class="card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start ">&lt;div class="card-title body-default fw-500 lh-2 text-gray-16">Foundation SDK&lt;/div>&lt;div class="card-description body-small text-gray-12 fw-400">The Grafana Foundation SDK is a set of tools, types, and libraries that let you define Grafana dashboards and resources using familiar programming languages like Go, TypeScript, Python, Java, and PHP. Use it in conjunction with &lt;code>grafanactl&lt;/code> to push your programmatically generated resources.&lt;/div>&lt;/div>
&lt;/a>&lt;a class="card sm" href="./git-sync/intro-git-sync/">
&lt;div class="card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start ">&lt;div class="card-title body-default fw-500 lh-2 text-gray-16">Git Sync&lt;/div>&lt;div class="card-description body-small text-gray-12 fw-400">Git Sync lets you store your dashboard files in a GitHub repository and synchronize those changes with your Grafana instance, enabling version control, branching, and pull requests directly from Grafana.&lt;/div>&lt;/div>
&lt;/a>&lt;a class="card sm" href="./provision-resources/">
&lt;div class="card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start ">&lt;div class="card-title body-default fw-500 lh-2 text-gray-16">On-prem file provisioning&lt;/div>&lt;div class="card-description body-small text-gray-12 fw-400">File provisioning in Grafana lets you include resources, including folders and dashboard JSON files, that are stored in a local file system.&lt;/div>&lt;/div>
&lt;/a>&lt;/div>
&lt;/div></description></item><item><title>Foundation SDK</title><link>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/foundation-sdk/</link><pubDate>Tue, 14 Apr 2026 09:48:24 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/foundation-sdk/</guid><content><![CDATA[&lt;h1 id=&#34;get-started-with-the-grafana-foundation-sdk&#34;&gt;Get started with the Grafana Foundation SDK&lt;/h1&gt;
&lt;p&gt;The Grafana Foundation SDK is a set of tools, types, and libraries that let you define Grafana dashboards and resources using strongly typed code. By writing your dashboards as code, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Leverage strong typing:&lt;/strong&gt; Catch errors at compile time, ensuring more reliable configurations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enhance version control:&lt;/strong&gt; Track changes seamlessly using standard version control systems like Git.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automate deployments:&lt;/strong&gt; Integrate dashboard provisioning into your CI/CD pipelines for consistent and repeatable setups.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The SDK supports multiple programming languages, including Go, TypeScript, Python, PHP, and Java, so you can choose the one that best fits your development environment. Refer to the &lt;a href=&#34;https://github.com/grafana/grafana-foundation-sdk&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Foundation SDK&lt;/a&gt; GitHub repository for further details.&lt;/p&gt;
&lt;iframe width=&#34;560&#34; height=&#34;315&#34; src=&#39;https://www.youtube.com/embed/_OKQoABmg0Q&#39; title=&#34;YouTube video player&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&#34; referrerpolicy=&#34;strict-origin-when-cross-origin&#34; allowfullscreen&gt;&lt;/iframe&gt;
&lt;h2 id=&#34;grafana-foundation-sdk-overview&#34;&gt;Grafana Foundation SDK overview&lt;/h2&gt;
&lt;p&gt;Here&amp;rsquo;s a quick overview of how the Grafana Foundation SDK works:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Composable builder pattern:&lt;/strong&gt; You can chain different builder blocks to define dashboards fluently. You start with a &lt;code&gt;DashboardBuilder&lt;/code&gt;, then add panels, queries, and other components step by step.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Safe strong typing:&lt;/strong&gt; Everything in the SDK is strongly typed. This gives you autocompletion in your IDE, catches mistakes early, and helps ensure you&amp;rsquo;re always using valid configuration values.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configuration with structured options:&lt;/strong&gt; When a configuration get complex (like data reduction or display settings), the SDK uses typed option builders to keep things readable, predictable, and easy to control.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you build more advanced dashboards, you’ll work with additional builders and types to support richer functionality.
The SDK supports not just panels and queries, but also variables, thresholds, field overrides, transformations, and more.
Refer to &lt;a href=&#34;https://grafana.github.io/grafana-foundation-sdk/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;the full API reference&lt;/a&gt; to explore what&amp;rsquo;s possible.&lt;/p&gt;
&lt;p&gt;Refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/foundation-sdk/foundation-sdk-key-concepts/&#34;&gt;Foundation SDK key concepts&lt;/a&gt; for a more extensive explanation, and read on to see these concepts in action.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Ensure you have the following prerequisites:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Programming environment:&lt;/strong&gt; Set up for your chosen language. For example: Go, Node.js for TypeScript, or Python 3.x for Python.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Grafana instance:&lt;/strong&gt; A running Grafana instance compatible with the SDK (Grafana v10.0 or higher).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Package manager:&lt;/strong&gt; Appropriate for your language, for example, &lt;code&gt;npm&lt;/code&gt; or &lt;code&gt;yarn&lt;/code&gt; for TypeScript or &lt;code&gt;pip&lt;/code&gt; for Python.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;install-the-grafana-foundation-sdk&#34;&gt;Install the Grafana Foundation SDK&lt;/h2&gt;
&lt;p&gt;To install the Foundation SDK:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Clone the &lt;a href=&#34;https://github.com/grafana/intro-to-foundation-sdk&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;intro-to-foundation-sdk repository&lt;/a&gt; to access examples and a &lt;code&gt;docker-compose&lt;/code&gt; stack.&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;go&lt;/code&gt; or &lt;code&gt;typescript&lt;/code&gt; tab to view instructions to install the SDK. For other languages, refer to the &lt;a href=&#34;https://grafana.github.io/grafana-foundation-sdk/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana Foundation SDK documentation&lt;/a&gt; for installation instructions.&lt;/li&gt;
&lt;/ol&gt;



  

  


&lt;div data-element=&#34;tabs&#34;&gt;
  &lt;div data-element=&#34;tabs-bar&#34;&gt;
    
      &lt;div data-element=&#34;tab&#34; data-key=&#34;0&#34; data-label=&#34;Go&#34;&gt;Go&lt;/div&gt;
    
      &lt;div data-element=&#34;tab&#34; data-key=&#34;1&#34; data-label=&#34;typescript&#34;&gt;typescript&lt;/div&gt;
    
  &lt;/div&gt;
  &lt;div data-element=&#34;tab-content&#34;&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;Go&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-go&#34;&gt;go get github.com/grafana/grafana-foundation-sdk/go@latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&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;typescript&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-typescript&#34;&gt;npm install @grafana/grafana-foundation-sdk&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;create-a-dashboard&#34;&gt;Create a dashboard&lt;/h2&gt;
&lt;p&gt;See the following examples in Go and Typescript to create a simple dashboard:&lt;/p&gt;
&lt;p&gt;This code defines a dashboard titled “My Dashboard” with a two panels:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a simple stat panel displaying a version number, and&lt;/li&gt;
&lt;li&gt;a time series panel displaying randomized data from the &lt;code&gt;testdata&lt;/code&gt; data source &lt;code&gt;random_walk&lt;/code&gt; scenario.&lt;/li&gt;
&lt;/ul&gt;



  

  


&lt;div data-element=&#34;tabs&#34;&gt;
  &lt;div data-element=&#34;tabs-bar&#34;&gt;
    
      &lt;div data-element=&#34;tab&#34; data-key=&#34;0&#34; data-label=&#34;Go&#34;&gt;Go&lt;/div&gt;
    
      &lt;div data-element=&#34;tab&#34; data-key=&#34;1&#34; data-label=&#34;typescript&#34;&gt;typescript&lt;/div&gt;
    
  &lt;/div&gt;
  &lt;div data-element=&#34;tab-content&#34;&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;Go&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-go&#34;&gt;package main

// Import the appropriate Grafana Foundation SDK packages
import (
  &amp;#34;encoding/json&amp;#34;
  &amp;#34;log&amp;#34;

  &amp;#34;github.com/grafana/grafana-foundation-sdk/go/cog&amp;#34;
  &amp;#34;github.com/grafana/grafana-foundation-sdk/go/common&amp;#34;
  &amp;#34;github.com/grafana/grafana-foundation-sdk/go/dashboard&amp;#34;
  &amp;#34;github.com/grafana/grafana-foundation-sdk/go/stat&amp;#34;
  &amp;#34;github.com/grafana/grafana-foundation-sdk/go/testdata&amp;#34;
  &amp;#34;github.com/grafana/grafana-foundation-sdk/go/timeseries&amp;#34;
)

func main() {
  // Define a data source reference for our testdata data source
  testdataRef := dashboard.DataSourceRef{
    Type: cog.ToPtr(&amp;#34;grafana-testdata-datasource&amp;#34;),
    Uid:  cog.ToPtr(&amp;#34;testdata&amp;#34;),
  }

  // Define our dashboard as strongly typed code
  builder := dashboard.NewDashboardBuilder(&amp;#34;My Dashboard&amp;#34;).
    WithPanel(
      stat.NewPanelBuilder().
        Title(&amp;#34;Version&amp;#34;).
        Datasource(testdataRef).
        ReduceOptions(common.NewReduceDataOptionsBuilder().
          Calcs([]string{&amp;#34;lastNotNull&amp;#34;}).
          Fields(&amp;#34;/.*/&amp;#34;)).
        WithTarget(
          testdata.NewDataqueryBuilder().
            ScenarioId(&amp;#34;csv_content&amp;#34;).
            CsvContent(&amp;#34;version\nv1.2.3&amp;#34;),
        ),
    ).
    WithPanel(
      timeseries.NewPanelBuilder().
        Title(&amp;#34;Random Time Series&amp;#34;).
        Datasource(testdataRef).
        WithTarget(
          testdata.NewDataqueryBuilder().
            ScenarioId(&amp;#34;random_walk&amp;#34;),
        ),
    )

  // Build the dashboard - errors in configuration will be thrown here
  dashboard, err := builder.Build()
  if err != nil {
    log.Fatalf(&amp;#34;failed to build dashboard: %v&amp;#34;, err)
  }

  // Output the generated dashboard as JSON
  dashboardJson, err := json.MarshalIndent(dashboard, &amp;#34;&amp;#34;, &amp;#34;  &amp;#34;)
  if err != nil {
    log.Fatalf(&amp;#34;failed to marshal dashboard: %v&amp;#34;, err)
  }

  log.Printf(&amp;#34;Dashboard JSON:\n%s&amp;#34;, dashboardJson)
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&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;typescript&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-typescript&#34;&gt;// Import the appropriate Grafana Foundation SDK packages
import * as common from &amp;#39;@grafana/grafana-foundation-sdk/common&amp;#39;;
import * as dashboard from &amp;#39;@grafana/grafana-foundation-sdk/dashboard&amp;#39;;
import * as stat from &amp;#39;@grafana/grafana-foundation-sdk/stat&amp;#39;;
import * as testdata from &amp;#39;@grafana/grafana-foundation-sdk/testdata&amp;#39;;
import * as timeseries from &amp;#39;@grafana/grafana-foundation-sdk/timeseries&amp;#39;;

// Define a data source reference for our testdata data source
const testDataRef: dashboard.DataSourceRef = {
  type: &amp;#39;grafana-testdata-datasource&amp;#39;,
  uid: &amp;#39;testdata&amp;#39;,
};

// Define our dashboard as strongly typed code
const builder = new dashboard.DashboardBuilder(&amp;#39;My Dashboard&amp;#39;)
  .withPanel(
    new stat.PanelBuilder()
      .title(&amp;#39;Version&amp;#39;)
      .reduceOptions(new common.ReduceDataOptionsBuilder().calcs([&amp;#39;lastNotNull&amp;#39;]).fields(&amp;#39;/.*/&amp;#39;))
      .datasource(testdataRef)
      .withTarget(new testdata.DataqueryBuilder().scenarioId(&amp;#39;csv_content&amp;#39;).csvContent(&amp;#39;version\nv1.2.3&amp;#39;))
  )
  .withPanel(
    new timeseries.PanelBuilder()
      .title(&amp;#39;Random Time Series&amp;#39;)
      .datasource(testdataRef)
      .withTarget(new testdata.DataqueryBuilder().scenarioId(&amp;#39;random_walk&amp;#39;))
  );

// Build the dashboard - errors in configuration will be thrown here
const dashboard = builder.build();

// Output the generated dashboard as JSON
console.log(JSON.stringify(dashboard, null, 2));&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;export-and-use-the-json&#34;&gt;Export and use the JSON&lt;/h2&gt;
&lt;p&gt;After you&amp;rsquo;ve defined your dashboard as code, build the final dashboard representation using the dashboard builder, typically using the &lt;code&gt;build()&lt;/code&gt; function depending on language choice, and output the result as a JSON.&lt;/p&gt;
&lt;p&gt;With the JSON payload, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Manually import:&lt;/strong&gt; Paste into Grafana’s dashboard import feature.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automate:&lt;/strong&gt; Use the 
    &lt;a href=&#34;/docs/grafana/v13.0/developer-resources/api-reference/http-api/&#34;&gt;Grafana API&lt;/a&gt;, the 
    &lt;a href=&#34;/docs/grafana/v13.0/grafana-cli/&#34;&gt;Grafana CLI&lt;/a&gt;, or 
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/&#34;&gt;Git Sync&lt;/a&gt; to programmatically upload the dashboard JSON.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;explore-a-real-world-example&#34;&gt;Explore a real-world example&lt;/h2&gt;
&lt;p&gt;If you want to explore further and see a more real-world example of using the Grafana Foundation SDK, watch the following walkthrough:&lt;/p&gt;
&lt;iframe width=&#34;560&#34; height=&#34;315&#34; src=&#39;https://www.youtube.com/embed/ZjWdGVsrCiQ&#39; title=&#34;YouTube video player&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&#34; referrerpolicy=&#34;strict-origin-when-cross-origin&#34; allowfullscreen&gt;&lt;/iframe&gt;
&lt;p&gt;In this video, we generate a dashboard from code and deploy it using the Grafana API, covering patterns and practices you&amp;rsquo;d use in production environments. It also includes a working example of a web service that emits metrics and logs, and shows how to deploy a dashboard alongside it using Docker Compose.&lt;/p&gt;
&lt;p&gt;You can find the full source code for this example in the &lt;a href=&#34;https://github.com/grafana/intro-to-foundation-sdk/tree/main/generate-and-deploy-example&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;intro-to-foundation-sdk repository&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;p&gt;Now that you understand the basics of using the Grafana Foundation SDK, here are some next steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Explore more features:&lt;/strong&gt; Check out the &lt;a href=&#34;https://grafana.github.io/grafana-foundation-sdk/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;full API reference&lt;/a&gt; to learn about advanced dashboard configurations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Version control your dashboards:&lt;/strong&gt; Store your dashboard code in a Git repository to track changes over time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automate dashboard provisioning with CI/CD:&lt;/strong&gt; &lt;a href=&#34;./dashboard-automation&#34;&gt;Integrate the SDK into your CI/CD pipeline&lt;/a&gt; to deploy dashboards automatically.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Learn about 
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/&#34;&gt;Grafana Git Sync&lt;/a&gt;&lt;/strong&gt;, which lets you synchronize your resources so you can store your dashboards as JSON files stored in GitHub and manage them as code.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="get-started-with-the-grafana-foundation-sdk">Get started with the Grafana Foundation SDK&lt;/h1>
&lt;p>The Grafana Foundation SDK is a set of tools, types, and libraries that let you define Grafana dashboards and resources using strongly typed code. By writing your dashboards as code, you can:&lt;/p></description></item><item><title>Introduction to Git Sync</title><link>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/git-sync/</link><pubDate>Tue, 14 Apr 2026 14:59:56 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/git-sync/</guid><content><![CDATA[&lt;h1 id=&#34;introduction-to-git-sync&#34;&gt;Introduction to Git Sync&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Git Sync is now GA for Grafana Cloud, OSS and Enterprise.&lt;/strong&gt; Refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/usage-limits/&#34;&gt;Usage and performance limitations&lt;/a&gt; to understand usage limits for the different tiers.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;/help/&#34;&gt;Contact Grafana&lt;/a&gt; for support or to report any issues you encounter and help us improve this feature.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Git Sync in Grafana lets you synchronize your resources so you can store your dashboards as JSON files in any Git provider and manage them as code. You and your team can version control, collaborate, and automate deployments efficiently.&lt;/p&gt;
&lt;h2 id=&#34;how-it-works&#34;&gt;How it works&lt;/h2&gt;
&lt;p&gt;Git Sync allows you to connect external resources with your Grafana instance. After setup, all synchronized resources live in Git under the provisioned folder, and you can continue to have non-provisioned resources outside that folder.&lt;/p&gt;
&lt;p&gt;Git Sync is bidirectional. You can modify provisioned resources both from the Grafana UI or from the synced repository, and changes will be reflected in both places.&lt;/p&gt;
&lt;p&gt;Git Sync is available for any Git provider through a Pure Git repository type, and has specific enhanced integrations for GitHub, GitLab and Bitbucket. Refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/usage-limits/&#34;&gt;Usage and performance limitations&lt;/a&gt; for further details, including usage tiers.&lt;/p&gt;
&lt;p&gt;Refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/key-concepts/&#34;&gt;key concepts&lt;/a&gt; for more information on how Git Sync works.&lt;/p&gt;
&lt;h3 id=&#34;make-changes-in-the-grafana-ui&#34;&gt;Make changes in the Grafana UI&lt;/h3&gt;
&lt;p&gt;Whenever you modify a dashboard directly from the UI, you can also commit those changes to your synchronized Git repositories upon saving. You can configure settings to either enforce PR approvals before merging in your repository, or allow direct commits.&lt;/p&gt;
&lt;h3 id=&#34;make-changes-in-your-git-repositories&#34;&gt;Make changes in your Git repositories&lt;/h3&gt;
&lt;p&gt;Your Grafana instance polls the provisioned Git resources to synchronize. If you made any changes in your synchronized Git repositories, they will be updated in the Grafana database as well. The Grafana UI reads from the database and updates the UI to reflect these changes.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Without webhooks, Grafana polls for changes at the specified interval. The default polling interval is 60 seconds, and you can change this setting in the Grafana UI.&lt;/li&gt;
&lt;li&gt;If you enable the 
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/git-sync-setup/#configure-webhooks-and-image-rendering&#34;&gt;webhooks feature&lt;/a&gt;, repository notifications appear almost immediately.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;common-use-cases&#34;&gt;Common use cases&lt;/h2&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;Refer to 
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/provision-resources/git-sync-deployment-scenarios/&#34;&gt;Git Sync deployment scenarios&lt;/a&gt; for sample scenarios, including architecture and configuration details.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;You can use Git Sync for the following use cases:&lt;/p&gt;
&lt;h3 id=&#34;version-control-and-auditing&#34;&gt;Version control and auditing&lt;/h3&gt;
&lt;p&gt;Organizations can maintain a structured, version-controlled history of Grafana dashboards. The version control lets you revert to previous versions when necessary, compare modifications across commits, and ensure transparency in dashboard management.&lt;/p&gt;
&lt;p&gt;Additionally, having a detailed history of changes enhances compliance efforts, as teams can generate audit logs that document who made changes, when they were made, and why.&lt;/p&gt;
&lt;h3 id=&#34;automated-deployment-and-cicd-integration&#34;&gt;Automated deployment and CI/CD integration&lt;/h3&gt;
&lt;p&gt;Teams can streamline their workflow by integrating dashboard updates into their CI/CD pipelines. By pushing changes to GitHub, automated processes can trigger validation checks, test dashboard configurations, and deploy updates programmatically using the &lt;code&gt;grafanactl&lt;/code&gt; CLI and Foundation SDK.&lt;/p&gt;
&lt;p&gt;This reduces the risk of human errors, ensures consistency across environments, and enables a faster, more reliable release cycle for dashboards used in production monitoring and analytics.&lt;/p&gt;
&lt;h3 id=&#34;collaborative-dashboard-development&#34;&gt;Collaborative dashboard development&lt;/h3&gt;
&lt;p&gt;With Git Sync, multiple users can work on dashboards simultaneously without overwriting each other’s modifications.
By leveraging pull requests and branch-based workflows, teams can submit changes for review before merging them into the main branch. This process not only improves quality control but also ensures that dashboards adhere to best practices and organizational standards.&lt;/p&gt;
&lt;p&gt;Additionally, GitHub’s built-in discussion and review tools facilitate effective collaboration, making it easier to address feedback before changes go live.&lt;/p&gt;
&lt;h3 id=&#34;multi-environment-synchronization&#34;&gt;Multi-environment synchronization&lt;/h3&gt;
&lt;p&gt;Enterprises managing multiple Grafana instances, such as development, staging, and production environments, can seamlessly sync dashboards across these instances. This ensures consistency in visualization and monitoring configurations, reducing discrepancies that might arise from manually managing dashboards in different environments.&lt;/p&gt;
&lt;p&gt;By using Git Sync, teams can automate deployments across environments, eliminating repetitive setup tasks and maintaining a standardized monitoring infrastructure across the organization.&lt;/p&gt;
&lt;h3 id=&#34;disaster-recovery-and-backup&#34;&gt;Disaster recovery and backup&lt;/h3&gt;
&lt;p&gt;By continuously syncing dashboards to GitHub, organizations can create an always-updated backup, ensuring dashboards are never lost due to accidental deletion or system failures.&lt;/p&gt;
&lt;p&gt;If an issue arises, such as a corrupted dashboard, unintended modification, or a system crash, teams can quickly restore the latest functional version from the Git repository. This not only minimizes downtime but also adds a layer of resilience to Grafana monitoring setups, ensuring critical dashboards remain available when needed.&lt;/p&gt;
&lt;h2 id=&#34;build-dashboards-as-code&#34;&gt;Build dashboards as code&lt;/h2&gt;
&lt;p&gt;Because dashboards are defined in JSON files, you can enable as-code workflows where the JSON file is an output from Go, TypeScript, or another coding language in the format of a dashboard schema.&lt;/p&gt;
&lt;p&gt;To learn more about creating dashboards in a coding language to provision them for Git Sync, refer to the 
    &lt;a href=&#34;/docs/grafana/v13.0/observability-as-code/foundation-sdk/&#34;&gt;Foundation SDK&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h2 id=&#34;explore-git-sync&#34;&gt;Explore Git Sync&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/key-concepts/&#34;&gt;Git Sync Key concepts&lt;/a&gt;&lt;br&gt;Key concepts to understand how Git Sync works.&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/usage-limits/&#34;&gt;Usage and performance limitations&lt;/a&gt;&lt;br&gt;Git Sync usage tiers, compatible Git providers, and known limitations.&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/git-sync-setup/&#34;&gt;Set up Git Sync&lt;/a&gt;&lt;br&gt;Instructions for setting up Git Sync, so you can provision GitHub repositories for use with Grafana.&lt;ul&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/git-sync-setup/set-up-before/&#34;&gt;Setup prerequisites&lt;/a&gt;&lt;br&gt;Prerequisites for Git Sync, so you can provision GitHub repositories for use with Grafana.&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/git-sync-setup/set-up-code/&#34;&gt;Set up Git Sync as code&lt;/a&gt;&lt;br&gt;Instructions for setting up Git Sync as code, so you can provision Git repositories for use with Grafana.&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/git-sync-setup/set-up-terraform/&#34;&gt;Set up Git Sync with Terraform&lt;/a&gt;&lt;br&gt;Instructions for setting up Git Sync as code, so you can provision Git repositories for use with Grafana.&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/git-sync-setup/set-up-extend/&#34;&gt;Instantaneous pulling and dashboard previews&lt;/a&gt;&lt;br&gt;Instructions for extending Git Sync for real-time notification and image rendering.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/export-resources/&#34;&gt;Add non-provisioned resources from Grafana&lt;/a&gt;&lt;br&gt;Export non-provisioned resources from Grafana.&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/use-git-sync/&#34;&gt;Work with provisioned repositories in Git Sync&lt;/a&gt;&lt;br&gt;Instructions for working with Git Sync to perform common tasks, such as saving dashboards to GitHub and synchronizing changes with Grafana.&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/provisioned-dashboards/&#34;&gt;Work with provisioned dashboards in Git Sync&lt;/a&gt;&lt;br&gt;Update, save, and modify provisioned resources in Grafana using Git Sync.&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/scenarios/&#34;&gt;Git Sync deployment scenarios&lt;/a&gt;&lt;br&gt;Learn about common Git Sync deployment patterns and configurations for different organizational needs&lt;ul&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/scenarios/single-instance/&#34;&gt;Single instance Git Sync&lt;/a&gt;&lt;br&gt;Synchronize a single Grafana instance with a Git repository&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/scenarios/dev-prod/&#34;&gt;Git Sync for development and production environments&lt;/a&gt;&lt;br&gt;Use separate Grafana instances for development and production with Git-controlled promotion&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/scenarios/multi-region/&#34;&gt;Git Sync with regional replication&lt;/a&gt;&lt;br&gt;Synchronize multiple regional Grafana instances from a shared Git location&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/scenarios/high-availability/&#34;&gt;Git Sync for high availability environments&lt;/a&gt;&lt;br&gt;Run multiple Grafana instances serving traffic simultaneously, synchronized via Git Sync&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/git-sync/scenarios/multi-team/&#34;&gt;Multiple team Git Sync&lt;/a&gt;&lt;br&gt;Use multiple Git repositories with one Grafana instance, one repository per team&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
]]></content><description>&lt;h1 id="introduction-to-git-sync">Introduction to Git Sync&lt;/h1>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>&lt;strong>Git Sync is now GA for Grafana Cloud, OSS and Enterprise.&lt;/strong> Refer to
&lt;a href="/docs/grafana/v13.0/as-code/observability-as-code/git-sync/usage-limits/">Usage and performance limitations&lt;/a> to understand usage limits for the different tiers.&lt;/p></description></item><item><title>Provision resources on-prem</title><link>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/provision-resources/</link><pubDate>Tue, 14 Apr 2026 09:48:24 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.0/as-code/observability-as-code/provision-resources/</guid><content><![CDATA[&lt;h1 id=&#34;on-prem-file-provisioning&#34;&gt;On-prem file provisioning&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;On-prem file provisioning is an &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;experimental feature&lt;/a&gt; introduced in Grafana v12 for open source and Enterprise editions available in &lt;a href=&#34;/grafana/download/nightly&#34;&gt;nightly releases&lt;/a&gt;. It&amp;rsquo;s &lt;strong&gt;not available in Grafana Cloud&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Engineering and on-call support is not available. Documentation is either limited or not provided outside of code comments. No SLA is provided.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;On-prem local file provisioning allows you to configure how to store your dashboard JSON and other files from your local file system. You can set a single folder, or multiple folders to a different repository, with up to 10 connections.&lt;/p&gt;
&lt;p&gt;With on-prem file provisioning:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All provisioned resources are changed in the local files.&lt;/li&gt;
&lt;li&gt;The dashboards saved in your GitHub repository or local folder appear in Grafana in the &amp;lsquo;provisioned&amp;rsquo; folder. The dashboards and folders saved to the local path are referred to as &amp;lsquo;provisioned&amp;rsquo; resources and are labeled as such in the Grafana UI.&lt;/li&gt;
&lt;li&gt;Any changes made in the provisioned files are reflected in the Grafana database. The Grafana UI reads the database and updates the UI to reflect these changes.&lt;/li&gt;
&lt;li&gt;You can&amp;rsquo;t use the Grafana UI to edit or delete provisioned resources.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;explore-file-provisioning&#34;&gt;Explore file provisioning&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/grafana/v13.0/as-code/observability-as-code/provision-resources/file-path-setup/&#34;&gt;Set up file provisioning&lt;/a&gt;&lt;br&gt;Instructions for setting up file provisioning with a local path.&lt;/li&gt;&lt;/ul&gt;
]]></content><description>&lt;h1 id="on-prem-file-provisioning">On-prem file provisioning&lt;/h1>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>On-prem file provisioning is an &lt;a href="/docs/release-life-cycle/">experimental feature&lt;/a> introduced in Grafana v12 for open source and Enterprise editions available in &lt;a href="/grafana/download/nightly">nightly releases&lt;/a>. It&amp;rsquo;s &lt;strong>not available in Grafana Cloud&lt;/strong>.&lt;/p></description></item></channel></rss>