<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Get started with Grafana Agent Flow on Grafana Labs</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/</link><description>Recent content in Get started with Grafana Agent Flow on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/agent/v0.38/flow/getting-started/index.xml" rel="self" type="application/rss+xml"/><item><title>Collect and forward Prometheus metrics</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/collect-prometheus-metrics/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/collect-prometheus-metrics/</guid><content><![CDATA[&lt;h1 id=&#34;collect-and-forward-prometheus-metrics&#34;&gt;Collect and forward Prometheus metrics&lt;/h1&gt;
&lt;p&gt;Grafana Agent Flow can be configured to collect &lt;a href=&#34;https://prometheus.io&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus&lt;/a&gt; metrics and
forward them to any Prometheus-compatible database.&lt;/p&gt;
&lt;p&gt;This topic describes how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Configure metrics delivery&lt;/li&gt;
&lt;li&gt;Collect metrics from Kubernetes Pods&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;components-used-in-this-topic&#34;&gt;Components used in this topic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/discovery.kubernetes/&#34;&gt;discovery.kubernetes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.remote_write/&#34;&gt;prometheus.remote_write&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.scrape/&#34;&gt;prometheus.scrape&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that you have basic familiarity with instrumenting applications with
Prometheus.&lt;/li&gt;
&lt;li&gt;Have a set of Prometheus exports or applications exposing Prometheus metrics
that you want to collect metrics from.&lt;/li&gt;
&lt;li&gt;Identify where you will write collected metrics. Metrics may be written to
Prometheus or Prometheus-compatible endpoints such as Grafana Mimir, Grafana
Cloud, or Grafana Enterprise Metrics.&lt;/li&gt;
&lt;li&gt;Be familiar with the concept of 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; in Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-metrics-delivery&#34;&gt;Configure metrics delivery&lt;/h2&gt;
&lt;p&gt;Before components can collect Prometheus metrics, you must have a component
responsible for writing those metrics somewhere.&lt;/p&gt;
&lt;p&gt;The 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.remote_write/&#34;&gt;prometheus.remote_write&lt;/a&gt; component is responsible for delivering
Prometheus metrics to one or Prometheus-compatible endpoints. Once a
&lt;code&gt;prometheus.remote_write&lt;/code&gt; component is defined, other Grafana Agent Flow
components can be used to forward metrics to it.&lt;/p&gt;
&lt;p&gt;To configure a &lt;code&gt;prometheus.remote_write&lt;/code&gt; component for metrics delivery,
complete the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;prometheus.remote_write&lt;/code&gt; component to 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;Alloy&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-alloy&#34;&gt;prometheus.remote_write &amp;#34;LABEL&amp;#34; {
  endpoint {
    url = &amp;#34;PROMETHEUS_URL&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;LABEL&lt;/code&gt; with a label to use for the component, such as &lt;code&gt;default&lt;/code&gt;.
The label chosen must be unique across all &lt;code&gt;prometheus.remote_write&lt;/code&gt;
components in the same configuration file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;PROMETHEUS_URL&lt;/code&gt; with the full URL of the Prometheus-compatible
endpoint where metrics will be sent, such as
&lt;code&gt;https://prometheus-us-central1.grafana.net/api/prom/push&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your endpoint requires basic authentication, paste the following inside
of the &lt;code&gt;endpoint&lt;/code&gt; block:&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;Alloy&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-alloy&#34;&gt;basic_auth {
  username = &amp;#34;USERNAME&amp;#34;
  password = &amp;#34;PASSWORD&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;USERNAME&lt;/code&gt; with the basic authentication username to use.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;PASSWORD&lt;/code&gt; with the basic authentication password or API key to
use.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you have more than one endpoint to write metrics to, repeat the
&lt;code&gt;endpoint&lt;/code&gt; block for additional endpoints.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring &lt;code&gt;prometheus.remote_write&lt;/code&gt; with
multiple endpoints and mixed usage of basic authentication, and a
&lt;code&gt;prometheus.scrape&lt;/code&gt; component which forwards metrics to it:&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;Alloy&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-alloy&#34;&gt;prometheus.remote_write &amp;#34;default&amp;#34; {
  endpoint {
    url = &amp;#34;http://localhost:9090/api/prom/push&amp;#34;
  }

  endpoint {
    url = &amp;#34;https://prometheus-us-central1.grafana.net/api/prom/push&amp;#34;

    // Get basic authentication based on environment variables.
    basic_auth {
      username = env(&amp;#34;REMOTE_WRITE_USERNAME&amp;#34;)
      password = env(&amp;#34;REMOTE_WRITE_PASSWORD&amp;#34;)
    }
  }
}

prometheus.scrape &amp;#34;example&amp;#34; {
  // Collect metrics from the default listen address.
  targets = [{
    __address__ = &amp;#34;127.0.0.1:12345&amp;#34;,
  }]

  forward_to = [prometheus.remote_write.default.receiver]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information on configuring metrics delivery, refer to

    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.remote_write/&#34;&gt;prometheus.remote_write&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;collect-metrics-from-kubernetes-pods&#34;&gt;Collect metrics from Kubernetes Pods&lt;/h2&gt;
&lt;p&gt;Grafana Agent Flow can be configured to collect metrics from Kubernetes Pods
by:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Discovering Kubernetes Pods to collect metrics from.&lt;/li&gt;
&lt;li&gt;Collecting metrics from those discovered Pods.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To collect metrics from Kubernetes Pods, complete the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Follow &lt;a href=&#34;#configure-metrics-delivery&#34;&gt;Configure metrics delivery&lt;/a&gt; to ensure
collected metrics can be written somewhere.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Discover Kubernetes Pods:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;discovery.kubernetes&lt;/code&gt; component to your configuration
file to discover every Pod in the cluster across all Namespaces:&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;Alloy&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-alloy&#34;&gt;discovery.kubernetes &amp;#34;DISCOVERY_LABEL&amp;#34; {
  role = &amp;#34;pod&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will generate one Prometheus target for every exposed port on every
discovered Pod.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Replace &lt;code&gt;DISCOVERY_LABEL&lt;/code&gt; with a label to use for the component, such as
&lt;code&gt;pods&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;discovery.kubernetes&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To limit the Namespaces that Pods are discovered in, add the following
block inside of the &lt;code&gt;discovery.kubernetes&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;namespaces {
  own_namespace = true
  names         = [NAMESPACE_NAMES]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If you don&amp;rsquo;t want to search for Pods in the Namespace Grafana Agent Flow is running in, set &lt;code&gt;own_namespace&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;NAMESPACE_NAMES&lt;/code&gt; with a comma-delimited list of strings
representing Namespaces to search. Each string must be wrapped in
double quotes. For example, &lt;code&gt;&amp;quot;default&amp;quot;,&amp;quot;kube-system&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To use a field selector to limit the number of discovered Pods, add the
following block inside of the &lt;code&gt;discovery.kubernetes&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;selectors {
  role  = &amp;#34;pod&amp;#34;
  field = &amp;#34;FIELD_SELECTOR&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;FIELD_SELECTOR&lt;/code&gt; with the Kubernetes field selector to use,
such as &lt;code&gt;metadata.name=my-service&lt;/code&gt;. For more information on field
selectors, refer to the Kubernetes documentation on &lt;a href=&#34;https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Field
Selectors&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create additional &lt;code&gt;selectors&lt;/code&gt; blocks for each field selector you
want to apply.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To use a label selector to limit the number of discovered Pods, add the
following block inside of the &lt;code&gt;discovery.kubernetes&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;selectors {
  role  = &amp;#34;pod&amp;#34;
  label = &amp;#34;LABEL_SELECTOR&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;LABEL_SELECTOR&lt;/code&gt; with the Kubernetes label selector to use,
such as &lt;code&gt;environment in (production, qa)&lt;/code&gt;. For more information on
label selectors, refer to the Kubernetes documentation on &lt;a href=&#34;https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#set-based-requirement&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Labels
and Selectors&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create additional &lt;code&gt;selectors&lt;/code&gt; blocks for each label selector you
want to apply.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Collect metrics from discovered Pods:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;prometheus.scrape&lt;/code&gt; component to 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;Alloy&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-alloy&#34;&gt;prometheus.scrape &amp;#34;SCRAPE_LABEL&amp;#34; {
  targets    = discovery.kubernetes.DISCOVERY_LABEL.targets
  forward_to = [prometheus.remote_write.REMOTE_WRITE_LABEL.receiver]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;SCRAPE_LABEL&lt;/code&gt; with a label to use for the component, such
as &lt;code&gt;pods&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;prometeus.scrape&lt;/code&gt; components in the same configuration file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;DISCOVERY_LABEL&lt;/code&gt; with the label chosen for the
&lt;code&gt;discovery.kubernetes&lt;/code&gt; component in step 2.1.1.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;REMOTE_WRITE_LABEL&lt;/code&gt; with the label chosen for your existing
&lt;code&gt;prometheus.remote_write&lt;/code&gt; component.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring Grafana Agent Flow to collect metrics
from running production Kubernetes Pods in the &lt;code&gt;default&lt;/code&gt; Namespace:&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;Alloy&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-alloy&#34;&gt;discovery.kubernetes &amp;#34;pods&amp;#34; {
  role = &amp;#34;pod&amp;#34;

  namespaces {
    own_namespace = false

    names = [&amp;#34;default&amp;#34;]
  }

  selectors {
    role  = &amp;#34;pod&amp;#34;
    label = &amp;#34;environment in (production)&amp;#34;
  }
}

prometheus.scrape &amp;#34;pods&amp;#34; {
  targets    = discovery.kubernetes.pods.targets
  forward_to = [prometheus.remote_write.default.receiver]
}

prometheus.remote_write &amp;#34;default&amp;#34; {
  endpoint {
    url = &amp;#34;http://localhost:9090/api/prom/push&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information on configuring Kubernetes service delivery and collecting
metrics, refer to 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/discovery.kubernetes/&#34;&gt;discovery.kubernetes&lt;/a&gt; and 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.scrape/&#34;&gt;prometheus.scrape&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;collect-metrics-from-kubernetes-services&#34;&gt;Collect metrics from Kubernetes Services&lt;/h2&gt;
&lt;p&gt;Grafana Agent Flow can be configured to collect metrics from Kubernetes Services
by:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Discovering Kubernetes Services to collect metrics from.&lt;/li&gt;
&lt;li&gt;Collecting metrics from those discovered Services.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To collect metrics from Kubernetes Services, complete the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Follow &lt;a href=&#34;#configure-metrics-delivery&#34;&gt;Configure metrics delivery&lt;/a&gt; to ensure
collected metrics can be written somewhere.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Discover Kubernetes Services:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;discovery.kubernetes&lt;/code&gt; component to your configuration
file to discover every Services in the cluster across all Namespaces:&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;Alloy&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-alloy&#34;&gt;discovery.kubernetes &amp;#34;DISCOVERY_LABEL&amp;#34; {
  role = &amp;#34;service&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will generate one Prometheus target for every exposed port on every
discovered Service.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Replace &lt;code&gt;DISCOVERY_LABEL&lt;/code&gt; with a label to use for the component, such as
&lt;code&gt;services&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;discovery.kubernetes&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To limit the Namespaces that Services are discovered in, add the following
block inside of the &lt;code&gt;discovery.kubernetes&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;namespaces {
  own_namespace = true
  names         = [NAMESPACE_NAMES]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If you do not want to search for Services in the Namespace Grafana Agent Flow is running in, set &lt;code&gt;own_namespace&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;NAMESPACE_NAMES&lt;/code&gt; with a comma-delimited list of strings
representing Namespaces to search. Each string must be wrapped in
double quotes. For example, &lt;code&gt;&amp;quot;default&amp;quot;,&amp;quot;kube-system&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To use a field selector to limit the number of discovered Services, add the
following block inside of the &lt;code&gt;discovery.kubernetes&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;selectors {
  role  = &amp;#34;service&amp;#34;
  field = &amp;#34;FIELD_SELECTOR&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;FIELD_SELECTOR&lt;/code&gt; with the Kubernetes field selector to use,
such as &lt;code&gt;metadata.name=my-service&lt;/code&gt;. For more information on field
selectors, refer to the Kubernetes documentation on &lt;a href=&#34;https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Field
Selectors&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create additional &lt;code&gt;selectors&lt;/code&gt; blocks for each field selector you
want to apply.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To use a label selector to limit the number of discovered Services, add the
following block inside of the &lt;code&gt;discovery.kubernetes&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;selectors {
  role  = &amp;#34;service&amp;#34;
  label = &amp;#34;LABEL_SELECTOR&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;LABEL_SELECTOR&lt;/code&gt; with the Kubernetes label selector to use,
such as &lt;code&gt;environment in (production, qa)&lt;/code&gt;. For more information on
label selectors, refer to the Kubernetes documentation on &lt;a href=&#34;https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#set-based-requirement&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Labels
and Selectors&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create additional &lt;code&gt;selectors&lt;/code&gt; blocks for each label selector you
want to apply.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Collect metrics from discovered Services:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;prometheus.scrape&lt;/code&gt; component to 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;Alloy&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-alloy&#34;&gt;prometheus.scrape &amp;#34;SCRAPE_LABEL&amp;#34; {
  targets    = discovery.kubernetes.DISCOVERY_LABEL.targets
  forward_to = [prometheus.remote_write.REMOTE_WRITE_LABEL.receiver]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;SCRAPE_LABEL&lt;/code&gt; with a label to use for the component, such
as &lt;code&gt;services&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;prometeus.scrape&lt;/code&gt; components in the same configuration file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;DISCOVERY_LABEL&lt;/code&gt; with the label chosen for the
&lt;code&gt;discovery.kubernetes&lt;/code&gt; component in step 2.1.1.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;REMOTE_WRITE_LABEL&lt;/code&gt; with the label chosen for your existing
&lt;code&gt;prometheus.remote_write&lt;/code&gt; component.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring Grafana Agent Flow to collect metrics
from running production Kubernetes Services in the &lt;code&gt;default&lt;/code&gt; Namespace:&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;Alloy&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-alloy&#34;&gt;discovery.kubernetes &amp;#34;services&amp;#34; {
  role = &amp;#34;service&amp;#34;

  namespaces {
    own_namespace = false

    names = [&amp;#34;default&amp;#34;]
  }

  selectors {
    role  = &amp;#34;service&amp;#34;
    label = &amp;#34;environment in (production)&amp;#34;
  }
}

prometheus.scrape &amp;#34;services&amp;#34; {
  targets    = discovery.kubernetes.services.targets
  forward_to = [prometheus.remote_write.default.receiver]
}

prometheus.remote_write &amp;#34;default&amp;#34; {
  endpoint {
    url = &amp;#34;http://localhost:9090/api/prom/push&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information on configuring Kubernetes service delivery and collecting
metrics, refer to 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/discovery.kubernetes/&#34;&gt;discovery.kubernetes&lt;/a&gt; and 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.scrape/&#34;&gt;prometheus.scrape&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;collect-metrics-from-custom-targets&#34;&gt;Collect metrics from custom targets&lt;/h2&gt;
&lt;p&gt;Grafana Agent Flow can be configured to collect metrics from a custom set of
targets without the need for service discovery.&lt;/p&gt;
&lt;p&gt;To collect metrics from a custom set of targets, complete the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Follow &lt;a href=&#34;#configure-metrics-delivery&#34;&gt;Configure metrics delivery&lt;/a&gt; to ensure
collected metrics can be written somewhere.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;prometheus.scrape&lt;/code&gt; component to 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;Alloy&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-alloy&#34;&gt;prometheus.scrape &amp;#34;SCRAPE_LABEL&amp;#34; {
  targets    = [TARGET_LIST]
  forward_to = [prometheus.remote_write.REMOTE_WRITE_LABEL.receiver]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;SCRAPE_LABEL&lt;/code&gt; with a label to use for the component, such as
&lt;code&gt;custom_targets&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;prometheus.scrape&lt;/code&gt; components in the same configuration file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;TARGET_LIST&lt;/code&gt; with a comma-delimited list of 
    &lt;a href=&#34;/docs/agent/v0.38/flow/config-language/expressions/types_and_values/#objects&#34;&gt;Objects&lt;/a&gt;
denoting the Prometheus target. Each object must conform to the
following rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;There must be an &lt;code&gt;__address__&lt;/code&gt; key denoting the &lt;code&gt;HOST:PORT&lt;/code&gt; of the
target to collect metrics from.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To explicitly specify which protocol to use, set the &lt;code&gt;__scheme__&lt;/code&gt; key
to &lt;code&gt;&amp;quot;http&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;https&amp;quot;&lt;/code&gt;. If the &lt;code&gt;__scheme__&lt;/code&gt; key is not provided,
the protocol to use is inherited by the settings of the
&lt;code&gt;prometheus.scrape&lt;/code&gt; component (default &lt;code&gt;&amp;quot;http&amp;quot;&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To explicitly specify which HTTP path to collect metrics from, set
the &lt;code&gt;__metrics_path__&lt;/code&gt; key to the HTTP path to use. If the
&lt;code&gt;__metrics_path__&lt;/code&gt; key is not provided, the path to use is
inherited by the settings of the &lt;code&gt;prometheus.scrape&lt;/code&gt; component
(default &lt;code&gt;&amp;quot;/metrics&amp;quot;&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add additional keys as desired to inject extra labels to collected
metrics. Any label starting with two underscores (&lt;code&gt;__&lt;/code&gt;) will be
dropped prior to scraping.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;REMOTE_WRITE_LABEL&lt;/code&gt; with the label chosen for your existing
&lt;code&gt;prometheus.remote_write&lt;/code&gt; component.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring &lt;code&gt;prometheus.scrape&lt;/code&gt; to collect
metrics from a custom set of endpoints:&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;Alloy&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-alloy&#34;&gt;prometheus.scrape &amp;#34;custom_targets&amp;#34; {
  targets = [
    {
      __address__ = &amp;#34;prometheus:9090&amp;#34;,
    },
    {
      __address__ = &amp;#34;mimir:8080&amp;#34;,
      __scheme__  = &amp;#34;https&amp;#34;,
    },
    {
      __address__      = &amp;#34;custom-application:80&amp;#34;,
      __metrics_path__ = &amp;#34;/custom-metrics–path&amp;#34;,
    },
    {
      __address__ = &amp;#34;grafana-agent:12345&amp;#34;,
      application = &amp;#34;grafana-agent&amp;#34;,
      environment = &amp;#34;production&amp;#34;,
    },
  ]

  forward_to = [prometheus.remote_write.default.receiver]
}

prometheus.remote_write &amp;#34;default&amp;#34; {
  endpoint {
    url = &amp;#34;http://localhost:9090/api/prom/push&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="collect-and-forward-prometheus-metrics">Collect and forward Prometheus metrics&lt;/h1>
&lt;p>Grafana Agent Flow can be configured to collect &lt;a href="https://prometheus.io" target="_blank" rel="noopener noreferrer">Prometheus&lt;/a> metrics and
forward them to any Prometheus-compatible database.&lt;/p>
&lt;p>This topic describes how to:&lt;/p></description></item><item><title>Collect OpenTelemetry data</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/collect-opentelemetry-data/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/collect-opentelemetry-data/</guid><content><![CDATA[&lt;h1 id=&#34;collect-opentelemetry-data&#34;&gt;Collect OpenTelemetry data&lt;/h1&gt;
&lt;p&gt;Grafana Agent Flow can be configured to collect &lt;a href=&#34;https://opentelemetry.io&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry&lt;/a&gt;-compatible
data and forward it to any OpenTelemetry-compatible endpoint.&lt;/p&gt;
&lt;p&gt;This topic describes how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Configure OpenTelemetry data delivery&lt;/li&gt;
&lt;li&gt;Configure batching&lt;/li&gt;
&lt;li&gt;Receive OpenTelemetry data over OTLP&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;components-used-in-this-topic&#34;&gt;Components used in this topic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.auth.basic/&#34;&gt;otelcol.auth.basic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.otlp/&#34;&gt;otelcol.exporter.otlp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.otlphttp/&#34;&gt;otelcol.exporter.otlphttp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.processor.batch/&#34;&gt;otelcol.processor.batch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.receiver.otlp/&#34;&gt;otelcol.receiver.otlp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that you have basic familiarity with instrumenting applications with
OpenTelemetry.&lt;/li&gt;
&lt;li&gt;Have a set of OpenTelemetry applications ready to push telemetry data to Grafana Agent Flow.&lt;/li&gt;
&lt;li&gt;Identify where Grafana Agent Flow will write received telemetry data.&lt;/li&gt;
&lt;li&gt;Be familiar with the concept of 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; in Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-an-opentelemetry-protocol-exporter&#34;&gt;Configure an OpenTelemetry Protocol exporter&lt;/h2&gt;
&lt;p&gt;Before components can receive OpenTelemetry data, you must have a component
responsible for exporting the OpenTelemetry data. An OpenTelemetry &lt;em&gt;exporter
component&lt;/em&gt; is responsible for writing (that is, exporting) OpenTelemetry data
to an external system.&lt;/p&gt;
&lt;p&gt;In this task, we will use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.otlp/&#34;&gt;otelcol.exporter.otlp&lt;/a&gt; component to send
OpenTelemetry data to a server using the OpenTelemetry Protocol (OTLP). Once an
exporter component is defined, other Grafana Agent Flow components can be used
to forward data to it.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Refer to the list of available 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; for the full list of
&lt;code&gt;otelcol.exporter&lt;/code&gt; components that can be used to export OpenTelemetry data.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;To configure an &lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; component for exporting OpenTelemetry
data using OTLP, complete the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; component to 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;Alloy&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-alloy&#34;&gt;otelcol.exporter.otlp &amp;#34;EXPORTER_LABEL&amp;#34; {
  client {
    url = &amp;#34;HOST:PORT&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;EXPORTER_LABEL&lt;/code&gt; with a label to use for the component, such as
&lt;code&gt;default&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; components in the same configuration file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;HOST&lt;/code&gt; with the hostname or IP address of the server to send
OTLP requests to.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;PORT&lt;/code&gt; with the port of the server to send OTLP requests to.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your server requires basic authentication, complete the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;otelcol.auth.basic&lt;/code&gt; component to 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;Alloy&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-alloy&#34;&gt;otelcol.auth.basic &amp;#34;BASIC_AUTH_LABEL&amp;#34; {
  username = &amp;#34;USERNAME&amp;#34;
  password = &amp;#34;PASSWORD&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;BASIC_AUTH_LABEL&lt;/code&gt; with a label to use for the component, such
as &lt;code&gt;default&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;otelcol.auth.basic&lt;/code&gt; components in the same configuration file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;USERNAME&lt;/code&gt; with the basic authentication username to use.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;PASSWORD&lt;/code&gt; with the basic authentication password or API key to
use.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the following line inside of the &lt;code&gt;client&lt;/code&gt; block of your
&lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;auth = otelcol.auth.basic.BASIC_AUTH_LABEL.handler&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Replace &lt;code&gt;BASIC_AUTH_LABEL&lt;/code&gt; with the label used for the
&lt;code&gt;otelcol.auth.basic&lt;/code&gt; component in step 2.1.1.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you have more than one server to export metrics to, create a new
&lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; component for each additional server.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; sends data using OTLP over gRPC (HTTP/2). To send to
a server using HTTP/1.1, follow the steps above but use the

    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.otlphttp/&#34;&gt;otelcol.exporter.otlphttp component&lt;/a&gt; instead.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The following example demonstrates configuring &lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; with
authentication and a component which forwards data to it:&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;Alloy&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-alloy&#34;&gt;otelcol.exporter.otlp &amp;#34;default&amp;#34; {
  client {
    endpoint = &amp;#34;my-otlp-grpc-server:4317&amp;#34;
    auth     = otelcol.auth.basic.credentials.handler
  }
}

otelcol.auth.basic &amp;#34;credentials&amp;#34; {
  // Retrieve credentials using environment variables.

  username = env(&amp;#34;BASIC_AUTH_USER&amp;#34;)
  password = env(&amp;#34;API_KEY&amp;#34;)
}

otelcol.receiver.otlp &amp;#34;example&amp;#34; {
  grpc {
    endpoint = &amp;#34;127.0.0.1:4317&amp;#34;
  }

  http {
    endpoint = &amp;#34;127.0.0.1:4318&amp;#34;
  }

  output {
    metrics = [otelcol.exporter.otlp.default.input]
    logs    = [otelcol.exporter.otlp.default.input]
    traces  = [otelcol.exporter.otlp.default.input]
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information on writing OpenTelemetry data using the OpenTelemetry
Protocol, refer to 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.otlp/&#34;&gt;otelcol.exporter.otlp&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;configure-batching&#34;&gt;Configure batching&lt;/h2&gt;
&lt;p&gt;Production-ready Grafana Agent Flow configurations should not send
OpenTelemetry data directly to an exporter for delivery. Instead, data is
usually sent to one or more &lt;em&gt;processor components&lt;/em&gt; that perform various
transformations on the data.&lt;/p&gt;
&lt;p&gt;Ensuring data is batched is a production-readiness step to improve the
compression of data and reduce the number of outgoing network requests to
external systems.&lt;/p&gt;
&lt;p&gt;In this task, we will configure an 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.processor.batch/&#34;&gt;otelcol.processor.batch&lt;/a&gt; component to
batch data before sending it to our exporter.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Refer to the list of available 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; for the full list of
&lt;code&gt;otelcol.processor&lt;/code&gt; components that can be used to process OpenTelemetry
data. You can chain processors by having one processor send data to another
processor.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;To configure an &lt;code&gt;otelcol.processor.batch&lt;/code&gt; component, complete the following
steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Follow &lt;a href=&#34;#configure-an-opentelemetry-protocol-exporter&#34;&gt;Configure an OpenTelemetry Protocol
exporter&lt;/a&gt; to ensure received
data can be written to an external system.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;otelcol.processor.batch&lt;/code&gt; component into 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;Alloy&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-alloy&#34;&gt;otelcol.processor.batch &amp;#34;PROCESSOR_LABEL&amp;#34; {
  output {
    metrics = [otelcol.exporter.otlp.EXPORTER_LABEL.input]
    logs    = [otelcol.exporter.otlp.EXPORTER_LABEL.input]
    traces  = [otelcol.exporter.otlp.EXPORTER_LABEL.input]
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;PROCESSOR_LABEL&lt;/code&gt; with a label to use for the component, such as
&lt;code&gt;default&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;otelcol.processor.batch&lt;/code&gt; components in the same configuration file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;EXPORTER_LABEL&lt;/code&gt; with the label for your existing
&lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; component.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To disable one of the telemetry types, set the relevant type in the
&lt;code&gt;output&lt;/code&gt; block to the empty list, such as &lt;code&gt;metrics = []&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To send batched data to another processor, replace the components in the
&lt;code&gt;output&lt;/code&gt; list with the processor components to use.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring a sequence of
&lt;code&gt;otelcol.processor&lt;/code&gt; components before ultimately being exported:&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;Alloy&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-alloy&#34;&gt;otelcol.processor.memory_limiter &amp;#34;default&amp;#34; {
  check_interval = &amp;#34;1s&amp;#34;
  limit          = &amp;#34;1GiB&amp;#34;

  output {
    metrics = [otelcol.processor.batch.default.input]
    logs    = [otelcol.processor.batch.default.input]
    traces  = [otelcol.processor.batch.default.input]
  }
}

otelcol.processor.batch &amp;#34;default&amp;#34; {
  output {
    metrics = [otelcol.exporter.otlp.default.input]
    logs    = [otelcol.exporter.otlp.default.input]
    traces  = [otelcol.exporter.otlp.default.input]
  }
}

otelcol.exporter.otlp &amp;#34;default&amp;#34; {
  client {
    endpoint = &amp;#34;my-otlp-grpc-server:4317&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information on configuring OpenTelemetry data batching, refer to

    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.processor.batch/&#34;&gt;otelcol.processor.batch&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;configure-an-opentelemetry-protocol-receiver&#34;&gt;Configure an OpenTelemetry Protocol receiver&lt;/h2&gt;
&lt;p&gt;Grafana Agent Flow can be configured to receive OpenTelemetry metrics, logs,
and traces. An OpenTelemetry &lt;em&gt;receiver&lt;/em&gt; component is responsible for receiving
OpenTelemetry data from an external system.&lt;/p&gt;
&lt;p&gt;In this task, we will use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.receiver.otlp/&#34;&gt;otelcol.receiver.otlp&lt;/a&gt; component to receive
OpenTelemetry data over the network using the OpenTelemetry Protocol (OTLP). A
receiver component can be configured to forward received data to other Grafana Agent Flow components.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Refer to the list of available 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; for the full list of
&lt;code&gt;otelcol.receiver&lt;/code&gt; components that can be used to receive
OpenTelemetry-compatible data.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;To configure an &lt;code&gt;otelcol.receiver.otlp&lt;/code&gt; component for receiving OTLP data,
complete the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Follow &lt;a href=&#34;#configure-an-opentelemetry-protocol-exporter&#34;&gt;Configure an OpenTelemetry Protocol
exporter&lt;/a&gt; to ensure received
data can be written to an external system.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Follow &lt;a href=&#34;#configure-batching&#34;&gt;Configure batching&lt;/a&gt; to improve
compression and reduce the total amount of network requests.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;otelcol.receiver.otlp&lt;/code&gt; component to 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;Alloy&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-alloy&#34;&gt;otelcol.receiver.otlp &amp;#34;LABEL&amp;#34; {
  output {
    metrics = [COMPONENT_INPUT_LIST]
    logs    = [COMPONENT_INPUT_LIST]
    traces  = [COMPONENT_INPUT_LIST]
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;LABEL&lt;/code&gt; with a label to use for the component, such as
&lt;code&gt;default&lt;/code&gt;. The label chosen must be unique across all
&lt;code&gt;otelcol.receiver.otlp&lt;/code&gt; components in the same configuration file.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Replace &lt;code&gt;COMPONENT_INPUT_LIST&lt;/code&gt; with a comma-delimited list of component
inputs to forward received data to. For example, to send data to an
existing batch processor component, use
&lt;code&gt;otelcol.processor.batch.PROCESSOR_LABEL.input&lt;/code&gt;. To send data directly
to an existing exporter component, use
&lt;code&gt;otelcol.exporter.otlp.EXPORTER_LABEL.input&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To allow applications to send OTLP data over gRPC on port &lt;code&gt;4317&lt;/code&gt;, add
the following to your &lt;code&gt;otelcol.receiver.otlp&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;grpc {
  endpoint = &amp;#34;HOST:4317&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Replace &lt;code&gt;HOST&lt;/code&gt; with a host to listen to traffic on. It is
recommended to use a narrowly-scoped listen address whenever
possible. To listen on all network interfaces, replace &lt;code&gt;HOST&lt;/code&gt; with
&lt;code&gt;0.0.0.0&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To allow applications to send OTLP data over HTTP/1.1 on port &lt;code&gt;4318&lt;/code&gt;,
add the following to your &lt;code&gt;otelcol.receiver.otlp&lt;/code&gt; component:&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;Alloy&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-alloy&#34;&gt;http {
  endpoint = &amp;#34;HOST:4318&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Replace &lt;code&gt;HOST&lt;/code&gt; with a host to listen to traffic on. It is
recommended to use a narrowly-scoped listen address whenever
possible. To listen on all network interfaces, replace &lt;code&gt;HOST&lt;/code&gt; with
&lt;code&gt;0.0.0.0&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To disable one of the telemetry types, set the relevant type in the
&lt;code&gt;output&lt;/code&gt; block to the empty list, such as &lt;code&gt;metrics = []&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring &lt;code&gt;otelcol.receiver.otlp&lt;/code&gt; and
sending it to an exporter:&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;Alloy&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-alloy&#34;&gt;otelcol.receiver.otlp &amp;#34;example&amp;#34; {
  grpc {
    endpoint = &amp;#34;127.0.0.1:4317&amp;#34;
  }

  http {
    endpoint = &amp;#34;127.0.0.1:4318&amp;#34;
  }

  output {
    metrics = [otelcol.processor.batch.example.input]
    logs    = [otelcol.processor.batch.example.input]
    traces  = [otelcol.processor.batch.example.input]
  }
}

otelcol.processor.batch &amp;#34;example&amp;#34; {
  output {
    metrics = [otelcol.exporter.otlp.default.input]
    logs    = [otelcol.exporter.otlp.default.input]
    traces  = [otelcol.exporter.otlp.default.input]
  }
}

otelcol.exporter.otlp &amp;#34;default&amp;#34; {
  client {
    endpoint = &amp;#34;my-otlp-grpc-server:4317&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information on receiving OpenTelemetry data using the OpenTelemetry
Protocol, refer to 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.receiver.otlp/&#34;&gt;otelcol.receiver.otlp&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="collect-opentelemetry-data">Collect OpenTelemetry data&lt;/h1>
&lt;p>Grafana Agent Flow can be configured to collect &lt;a href="https://opentelemetry.io" target="_blank" rel="noopener noreferrer">OpenTelemetry&lt;/a>-compatible
data and forward it to any OpenTelemetry-compatible endpoint.&lt;/p>
&lt;p>This topic describes how to:&lt;/p></description></item><item><title>Migrate from Prometheus to Grafana Agent Flow</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/migrating-from-prometheus/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/migrating-from-prometheus/</guid><content><![CDATA[&lt;h1 id=&#34;migrate-from-prometheus-to-grafana-agent-flow&#34;&gt;Migrate from Prometheus to Grafana Agent Flow&lt;/h1&gt;
&lt;p&gt;The built-in Grafana Agent convert command can migrate your &lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/configuration/configuration/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus&lt;/a&gt; configuration to a Grafana Agent Flow configuration.&lt;/p&gt;
&lt;p&gt;This topic describes how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Convert a Prometheus configuration to a Grafana Agent Flow configuration.&lt;/li&gt;
&lt;li&gt;Run a Prometheus configuration natively using Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;components-used-in-this-topic&#34;&gt;Components used in this topic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.scrape/&#34;&gt;prometheus.scrape&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.remote_write/&#34;&gt;prometheus.remote_write&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;You must have an existing Prometheus configuration.&lt;/li&gt;
&lt;li&gt;You must have a set of Prometheus applications ready to push telemetry data to Grafana Agent Flow.&lt;/li&gt;
&lt;li&gt;You must be familiar with the concept of 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; in Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;convert-a-prometheus-configuration&#34;&gt;Convert a Prometheus configuration&lt;/h2&gt;
&lt;p&gt;To fully migrate your configuration from&lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/configuration/configuration/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus&lt;/a&gt; to Grafana Agent Flow,
you must convert your Prometheus configuration into a Grafana Agent Flow configuration.
This conversion will enable you to take full advantage of the many
additional features available in Grafana Agent Flow.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In this task, we will use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/cli/convert/&#34;&gt;convert&lt;/a&gt; CLI command to output a flow
configuration from a Prometheus configuration.&lt;/p&gt;&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open a terminal window and run the following command:&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INPUT_CONFIG_PATH&lt;/code&gt;: The full path to the Prometheus configuration.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;OUTPUT_CONFIG_PATH&lt;/code&gt;: The full path to output the Grafana Agent Flow configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/setup/start-agent/&#34;&gt;Start&lt;/a&gt; Grafana Agent Flow using the new flow configuration from &lt;code&gt;OUTPUT_CONFIG_PATH&lt;/code&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;debugging&#34;&gt;Debugging&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If the convert command can&amp;rsquo;t convert a Prometheus configuration,
diagnostic information is sent to &lt;code&gt;stderr&lt;/code&gt;. You can bypass
any non-critical issues and output the flow configuration using a
best-effort conversion by including the &lt;code&gt;--bypass-errors&lt;/code&gt; flag.&lt;/p&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;pre&gt;&lt;code&gt;If you bypass the errors, the behavior of the converted configuration may not match the original Prometheus configuration.
Make sure you fully test the converted configuration before using it in a production environment.
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;/div&gt;




  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=prometheus --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=prometheus --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can also output a diagnostic report by including the &lt;code&gt;--report&lt;/code&gt; flag.&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=prometheus --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=prometheus --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Replace &lt;code&gt;OUTPUT_REPORT_PATH&lt;/code&gt; with the output path for the report.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Using the &lt;a href=&#34;#example&#34;&gt;example&lt;/a&gt; Prometheus configuration below, the diagnostic report provides the following information:&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;plaintext&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-plaintext&#34;&gt;(Info) Converted scrape_configs job_name &amp;#34;prometheus&amp;#34; into...
  A prometheus.scrape.prometheus component
(Info) Converted 1 remote_write[s] &amp;#34;grafana-cloud&amp;#34; into...
  A prometheus.remote_write.default component&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;run-a-prometheus-configuration&#34;&gt;Run a Prometheus configuration&lt;/h2&gt;
&lt;p&gt;If you’re not ready to completely switch to a flow configuration, you can run Grafana Agent using your existing Prometheus configuration.
The &lt;code&gt;--config.format=prometheus&lt;/code&gt; flag tells Grafana Agent to convert your Prometheus configuration to a Grafana Agent Flow configuration and load it directly without saving the new configuration.
This allows you to try Grafana Agent Flow without modifying your existing Prometheus configuration infrastructure.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In this task, we will use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/cli/run/&#34;&gt;run&lt;/a&gt; CLI command to run Grafana Agent Flow
using a Prometheus configuration.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/setup/start-agent/&#34;&gt;Start&lt;/a&gt; Grafana Agent Flow and include the command line flag
&lt;code&gt;--config.format=prometheus&lt;/code&gt;. Your configuration file must be a valid
Prometheus configuration file rather than a Grafana Agent Flow configuration file.&lt;/p&gt;
&lt;h3 id=&#34;debugging-1&#34;&gt;Debugging&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;You can follow the convert CLI command &lt;a href=&#34;#debugging&#34;&gt;debugging&lt;/a&gt; instructions to
generate a diagnostic report.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refer to the Grafana Agent Flow 
    &lt;a href=&#34;/docs/agent/v0.38/flow/monitoring/debugging/&#34;&gt;Debugging&lt;/a&gt; for more information about a running Grafana Agent Flow.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your Prometheus configuration can&amp;rsquo;t be converted and
loaded directly into Grafana Agent Flow, diagnostic information
is sent to &lt;code&gt;stderr&lt;/code&gt;. You can bypass any non-critical issues
and start the Agent by including the
&lt;code&gt;--config.bypass-conversion-errors&lt;/code&gt; flag in addition to
&lt;code&gt;--config.format=prometheus&lt;/code&gt;.&lt;/p&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;pre&gt;&lt;code&gt;If you bypass the errors, the behavior of the converted configuration may not match the original Prometheus configuration.
Do not use this flag in a production environment.
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;
&lt;p&gt;This example demonstrates converting a Prometheus configuration file to a Grafana Agent Flow configuration file.&lt;/p&gt;
&lt;p&gt;The following Prometheus configuration file provides the input for the conversion:&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;YAML&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-yaml&#34;&gt;global:
  scrape_timeout:    45s

scrape_configs:
  - job_name: &amp;#34;prometheus&amp;#34;
    static_configs:
      - targets: [&amp;#34;localhost:12345&amp;#34;]

remote_write:
  - name: &amp;#34;grafana-cloud&amp;#34;
    url: &amp;#34;https://prometheus-us-central1.grafana.net/api/prom/push&amp;#34;
    basic_auth:
      username: USERNAME
      password: PASSWORD&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The convert command takes the YAML file as input and outputs a 
    &lt;a href=&#34;/docs/agent/v0.38/flow/config-language/&#34;&gt;River&lt;/a&gt; file.&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=prometheus --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;The new flow configuration file looks like this:&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;Alloy&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-alloy&#34;&gt;prometheus.scrape &amp;#34;prometheus&amp;#34; {
  targets = [{
    __address__ = &amp;#34;localhost:12345&amp;#34;,
  }]
  forward_to     = [prometheus.remote_write.default.receiver]
  job_name       = &amp;#34;prometheus&amp;#34;
  scrape_timeout = &amp;#34;45s&amp;#34;
}

prometheus.remote_write &amp;#34;default&amp;#34; {
  endpoint {
    name = &amp;#34;grafana-cloud&amp;#34;
    url  = &amp;#34;https://prometheus-us-central1.grafana.net/api/prom/push&amp;#34;

    basic_auth {
      username = &amp;#34;USERNAME&amp;#34;
      password = &amp;#34;PASSWORD&amp;#34;
    }

    queue_config {
      capacity             = 2500
      max_shards           = 200
      max_samples_per_send = 500
    }

    metadata_config {
      max_samples_per_send = 500
    }
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;limitations&#34;&gt;Limitations&lt;/h2&gt;
&lt;p&gt;Configuration conversion is done on a best-effort basis. Grafana Agent will issue
warnings or errors where the conversion cannot be performed.&lt;/p&gt;
&lt;p&gt;Once the configuration is converted, we recommend that you review
the Grafana Agent Flow configuration file created and verify that it is correct
before starting to use it in a production environment.&lt;/p&gt;
&lt;p&gt;Furthermore, we recommend that you review the following checklist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The following configurations aren&amp;rsquo;t available for conversion to Grafana Agent Flow: &lt;code&gt;rule_files&lt;/code&gt;, &lt;code&gt;alerting&lt;/code&gt;, &lt;code&gt;remote_read&lt;/code&gt;, &lt;code&gt;storage&lt;/code&gt;, and &lt;code&gt;tracing&lt;/code&gt;.
Any additional unsupported features are returned as errors during conversion.&lt;/li&gt;
&lt;li&gt;Check if you are using any extra command line arguments with Prometheus that aren&amp;rsquo;t present in your configuration file. For example, &lt;code&gt;--web.listen-address&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Metamonitoring metrics exposed by Grafana Agent Flow usually match Prometheus metamonitoring metrics but will use a different name.
Make sure that you use the new metric names, for example, in your alerts and dashboards queries.&lt;/li&gt;
&lt;li&gt;The logs produced by Grafana Agent Flow differ from those produced by Prometheus.&lt;/li&gt;
&lt;li&gt;Grafana Agent exposes the Grafana Agent Flow 
    &lt;a href=&#34;/docs/agent/v0.38/flow/monitoring/debugging/#grafana-agent-flow-ui&#34;&gt;UI&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="migrate-from-prometheus-to-grafana-agent-flow">Migrate from Prometheus to Grafana Agent Flow&lt;/h1>
&lt;p>The built-in Grafana Agent convert command can migrate your &lt;a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/" target="_blank" rel="noopener noreferrer">Prometheus&lt;/a> configuration to a Grafana Agent Flow configuration.&lt;/p>
&lt;p>This topic describes how to:&lt;/p></description></item><item><title>Migrating from Grafana Agent Operator to Grafana Agent Flow</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/migrating-from-operator/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/migrating-from-operator/</guid><content><![CDATA[&lt;h1 id=&#34;migrating-from-grafana-agent-operator-to-grafana-agent-flow&#34;&gt;Migrating from Grafana Agent Operator to Grafana Agent Flow&lt;/h1&gt;
&lt;p&gt;With the release of Grafana Agent Flow, Grafana Agent Operator is no longer the recommended way to deploy Grafana Agent in Kubernetes.
Some of the Operator functionality has been moved into Grafana Agent Flow itself, and the remaining functionality has been replaced by our Helm Chart.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Monitor types (&lt;code&gt;PodMonitor&lt;/code&gt;, &lt;code&gt;ServiceMonitor&lt;/code&gt;, &lt;code&gt;Probe&lt;/code&gt;, and &lt;code&gt;LogsInstance&lt;/code&gt;) are all supported natively by Grafana Agent Flow.
You are no longer required to use the Operator to consume those CRDs for dynamic monitoring in your cluster.&lt;/li&gt;
&lt;li&gt;The parts of the Operator that deploy the Grafana Agent itself (&lt;code&gt;GrafanaAgent&lt;/code&gt;, &lt;code&gt;MetricsInstance&lt;/code&gt;, and &lt;code&gt;LogsInstance&lt;/code&gt; CRDs) are deprecated.
We now recommend operator users use the Grafana Agent &lt;a href=&#34;/docs/agent/latest/flow/setup/install/kubernetes/&#34;&gt;Helm Chart&lt;/a&gt; to deploy Grafana Agent directly to your clusters.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This guide will provide some steps to get started with Grafana Agent Flow for users coming from Grafana Agent Operator.&lt;/p&gt;
&lt;h2 id=&#34;deploy-grafana-agent-flow-with-helm&#34;&gt;Deploy Grafana Agent Flow with Helm&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;You will need to create a &lt;code&gt;values.yaml&lt;/code&gt; file, which contains options for deploying your Grafana Agent.
You may start with the &lt;a href=&#34;https://github.com/grafana/agent/blob/main/operations/helm/charts/grafana-agent/values.yaml&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;default values&lt;/a&gt; and customize as you see fit, or start with this snippet, which should be a good starting point for what the Operator does:&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;YAML&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-yaml&#34;&gt;agent:
  mode: &amp;#39;flow&amp;#39;
  configMap:
    create: true
  clustering:
    enabled: true
controller:
  type: &amp;#39;statefulset&amp;#39;
  replicas: 2
crds:
  create: false&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This configuration will deploy Grafana Agent Flow as a &lt;code&gt;StatefulSet&lt;/code&gt; using the built-in &lt;a href=&#34;/docs/agent/latest/flow/concepts/clustering/&#34;&gt;clustering&lt;/a&gt; functionality to allow distributing scrapes across all Grafana Agent Pods.&lt;/p&gt;
&lt;p&gt;This is not the only deployment mode possible. For example, you may want to use a &lt;code&gt;DaemonSet&lt;/code&gt; to collect host-level logs or metrics. See the Grafana Agent Flow &lt;a href=&#34;/docs/agent/latest/flow/setup/deploy-agent/&#34;&gt;deployment guide&lt;/a&gt; for more details about different topologies.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a Grafana Agent configuration file, &lt;code&gt;agent.river&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;We will be adding to this configuration in the next step as we convert &lt;code&gt;MetricsInstances&lt;/code&gt;. You can add any additional configuration to this file as you desire.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the Grafana Helm repository:&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;helm repo add grafana https://grafana.github.io/helm-charts
helm repo update&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a Helm release. You may name the release anything you like. Here we are installing a release named &lt;code&gt;grafana-agent-metrics&lt;/code&gt; in the &lt;code&gt;monitoring&lt;/code&gt; namespace.&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;helm upgrade grafana-agent-metrics grafana/grafana-agent -i -n monitoring -f values.yaml --set-file agent.configMap.content=agent.river&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This command uses the &lt;code&gt;--set-file&lt;/code&gt; flag to pass the configuration file as a Helm value, so that we can continue to edit it as a regular River file.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;convert-metricsintances-to-grafana-agent-flow-components&#34;&gt;Convert &lt;code&gt;MetricsIntances&lt;/code&gt; to Grafana Agent Flow components&lt;/h2&gt;
&lt;p&gt;A &lt;code&gt;MetricsInstance&lt;/code&gt; resource primarily defines:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The remote endpoint(s) Grafana Agent Flow should send metrics to.&lt;/li&gt;
&lt;li&gt;Which &lt;code&gt;PodMonitor&lt;/code&gt;, &lt;code&gt;ServiceMonitor&lt;/code&gt;, and &lt;code&gt;Probe&lt;/code&gt; resources this Grafana Agent should discover.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These functions can be done in Grafana Agent Flow with the &lt;code&gt;prometheus.remote_write&lt;/code&gt;, &lt;code&gt;prometheus.operator.podmonitors&lt;/code&gt;, &lt;code&gt;prometheus.operator.servicemonitors&lt;/code&gt;, and &lt;code&gt;prometheus.operator.probes&lt;/code&gt; components respectively.&lt;/p&gt;
&lt;p&gt;This is a River sample that is equivalent to the &lt;code&gt;MetricsInstance&lt;/code&gt; from our &lt;a href=&#34;/docs/agent/latest/operator/deploy-agent-operator-resources/#deploy-a-metricsinstance-resource&#34;&gt;operator guide&lt;/a&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;Alloy&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-alloy&#34;&gt;
// read the credentials secret for remote_write authorization
remote.kubernetes.secret &amp;#34;credentials&amp;#34; {
  namespace = &amp;#34;monitoring&amp;#34;
  name = &amp;#34;primary-credentials-metrics&amp;#34;
}

prometheus.remote_write &amp;#34;primary&amp;#34; {
    endpoint {
        url = &amp;#34;https://PROMETHEUS_URL/api/v1/push&amp;#34;
        basic_auth {
            username = nonsensitive(remote.kubernetes.secret.credentials.data[&amp;#34;username&amp;#34;])
            password = remote.kubernetes.secret.credentials.data[&amp;#34;password&amp;#34;]
        }
    }
}

prometheus.operator.podmonitors &amp;#34;primary&amp;#34; {
    forward_to = [prometheus.remote_write.primary.receiver]
    // leave out selector to find all podmonitors in the entire cluster
    selector {
        match_labels = {instance = &amp;#34;primary&amp;#34;}
    }
}

prometheus.operator.servicemonitors &amp;#34;primary&amp;#34; {
    forward_to = [prometheus.remote_write.primary.receiver]
    // leave out selector to find all servicemonitors in the entire cluster
    selector {
        match_labels = {instance = &amp;#34;primary&amp;#34;}
    }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You will need to replace &lt;code&gt;PROMETHEUS_URL&lt;/code&gt; with the actual endpoint you want to send metrics to.&lt;/p&gt;
&lt;p&gt;This configuration will discover all &lt;code&gt;PodMonitor&lt;/code&gt;, &lt;code&gt;ServiceMonitor&lt;/code&gt;, and &lt;code&gt;Probe&lt;/code&gt; resources in your cluster that match our label selector &lt;code&gt;instance=primary&lt;/code&gt;. It will then scrape metrics from their targets and forward them to your remote write endpoint.&lt;/p&gt;
&lt;p&gt;You may need to customize this configuration further if you use additional features in your &lt;code&gt;MetricsInstance&lt;/code&gt; resources. Refer to the documentation for the relevant components for additional information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;/docs/agent/latest/flow/reference/components/remote.kubernetes.secret&#34;&gt;remote.kubernetes.secret&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/agent/latest/flow/reference/components/prometheus.remote_write&#34;&gt;prometheus.remote_write&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/agent/latest/flow/reference/components/prometheus.operator.podmonitors&#34;&gt;prometheus.operator.podmonitors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/agent/latest/flow/reference/components/prometheus.operator.servicemonitors&#34;&gt;prometheus.operator.servicemonitors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/agent/latest/flow/reference/components/prometheus.operator.probes&#34;&gt;prometheus.operator.probes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/agent/latest/flow/reference/components/prometheus.scrape&#34;&gt;prometheus.scrape&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;collecting-logs&#34;&gt;Collecting Logs&lt;/h2&gt;
&lt;p&gt;Our current recommendation is to create an additional DaemonSet deployment of Grafana Agents to scrape logs.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We have components that can scrape pod logs directly from the Kubernetes API without needing a DaemonSet deployment. These are
still considered experimental, but if you would like to try them, see the documentation for &lt;a href=&#34;/docs/agent/latest/flow/reference/components/loki.source.kubernetes/&#34;&gt;loki.source.kubernetes&lt;/a&gt; and
&lt;a href=&#34;/docs/agent/latest/flow/reference/components/loki.source.podlogs/&#34;&gt;loki.source.podlogs&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;These values are close to what the Operator currently deploys for logs:&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;YAML&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-yaml&#34;&gt;agent:
  mode: &amp;#39;flow&amp;#39;
  configMap:
    create: true
  clustering:
    enabled: false
  controller:
    type: &amp;#39;daemonset&amp;#39;
  mounts:
    # -- Mount /var/log from the host into the container for log collection.
    varlog: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This command will install a release named &lt;code&gt;grafana-agent-logs&lt;/code&gt; in the &lt;code&gt;monitoring&lt;/code&gt; namespace:&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;helm upgrade grafana-agent-logs grafana/grafana-agent -i -n monitoring -f values-logs.yaml --set-file agent.configMap.content=agent-logs.river&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This simple configuration will scrape logs for every pod on each node:&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;Alloy&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-alloy&#34;&gt;// read the credentials secret for remote_write authorization
remote.kubernetes.secret &amp;#34;credentials&amp;#34; {
  namespace = &amp;#34;monitoring&amp;#34;
  name      = &amp;#34;primary-credentials-logs&amp;#34;
}

discovery.kubernetes &amp;#34;pods&amp;#34; {
  role = &amp;#34;pod&amp;#34;
  // limit to pods on this node to reduce the amount we need to filter
  selectors {
    role  = &amp;#34;pod&amp;#34;
    field = &amp;#34;spec.nodeName=&amp;#34; &amp;#43; env(&amp;#34;HOSTNAME&amp;#34;)
  }
}

discovery.relabel &amp;#34;pod_logs&amp;#34; {
  targets = discovery.kubernetes.pods.targets
  rule {
    source_labels = [&amp;#34;__meta_kubernetes_namespace&amp;#34;]
    target_label  = &amp;#34;namespace&amp;#34;
  }
  rule {
    source_labels = [&amp;#34;__meta_kubernetes_pod_name&amp;#34;]
    target_label  = &amp;#34;pod&amp;#34;
  }
  rule {
    source_labels = [&amp;#34;__meta_kubernetes_pod_container_name&amp;#34;]
    target_label  = &amp;#34;container&amp;#34;
  }
  rule {
    source_labels = [&amp;#34;__meta_kubernetes_namespace&amp;#34;, &amp;#34;__meta_kubernetes_pod_name&amp;#34;]
    separator     = &amp;#34;/&amp;#34;
    target_label  = &amp;#34;job&amp;#34;
  }
  rule {
    source_labels = [&amp;#34;__meta_kubernetes_pod_uid&amp;#34;, &amp;#34;__meta_kubernetes_pod_container_name&amp;#34;]
    separator     = &amp;#34;/&amp;#34;
    action        = &amp;#34;replace&amp;#34;
    replacement   = &amp;#34;/var/log/pods/*$1/*.log&amp;#34;
    target_label  = &amp;#34;__path__&amp;#34;
  }
}

local.file_match &amp;#34;pod_logs&amp;#34; {
  path_targets = discovery.relabel.pod_logs.output
}

loki.source.file &amp;#34;pod_logs&amp;#34; {
  targets    = local.file_match.pod_logs.targets
  forward_to = [loki.process.pod_logs.receiver]
}

// basic processing to parse the container format. You can add additional processing stages
// to match your application logs.
loki.process &amp;#34;pod_logs&amp;#34; {
  stage.match {
    selector = &amp;#34;{tmp_container_runtime=\&amp;#34;containerd\&amp;#34;}&amp;#34;
    // the cri processing stage extracts the following k/v pairs: log, stream, time, flags
    stage.cri {}
    // Set the extract flags and stream values as labels
    stage.labels {
      values = {
        flags   = &amp;#34;&amp;#34;,
        stream  = &amp;#34;&amp;#34;,
      }
    }
  }

  // if the label tmp_container_runtime from above is docker parse using docker
  stage.match {
    selector = &amp;#34;{tmp_container_runtime=\&amp;#34;docker\&amp;#34;}&amp;#34;
    // the docker processing stage extracts the following k/v pairs: log, stream, time
    stage.docker {}

    // Set the extract stream value as a label
    stage.labels {
      values = {
        stream  = &amp;#34;&amp;#34;,
      }
    }
  }

  // drop the temporary container runtime label as it is no longer needed
  stage.label_drop {
    values = [&amp;#34;tmp_container_runtime&amp;#34;]
  }

  forward_to = [loki.write.loki.receiver]
}

loki.write &amp;#34;loki&amp;#34; {
  endpoint {
    url = &amp;#34;https://LOKI_URL/loki/api/v1/push&amp;#34;
    basic_auth {
      username = nonsensitive(remote.kubernetes.secret.credentials.data[&amp;#34;username&amp;#34;])
      password = remote.kubernetes.secret.credentials.data[&amp;#34;password&amp;#34;]
    }
}
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You will need to replace &lt;code&gt;LOKI_URL&lt;/code&gt; with the actual endpoint of your Loki instance. The logging subsytem is very powerful
and has many options for processing logs. For further details see the &lt;a href=&#34;/docs/agent/latest/flow/reference/components/&#34;&gt;component documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;integrations&#34;&gt;Integrations&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;Integration&lt;/code&gt; CRD is not supported with Grafana Agent Flow, however all static mode integrations have an equivalent component in the &lt;a href=&#34;/docs/agent/latest/flow/reference/components/&#34;&gt;&lt;code&gt;prometheus.exporter&lt;/code&gt;&lt;/a&gt; namespace. The reference docs should help convert those integrations to their Flow equivalent.&lt;/p&gt;
]]></content><description>&lt;h1 id="migrating-from-grafana-agent-operator-to-grafana-agent-flow">Migrating from Grafana Agent Operator to Grafana Agent Flow&lt;/h1>
&lt;p>With the release of Grafana Agent Flow, Grafana Agent Operator is no longer the recommended way to deploy Grafana Agent in Kubernetes.
Some of the Operator functionality has been moved into Grafana Agent Flow itself, and the remaining functionality has been replaced by our Helm Chart.&lt;/p></description></item><item><title>Migrate from Promtail to Grafana Agent Flow</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/migrating-from-promtail/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/migrating-from-promtail/</guid><content><![CDATA[&lt;h1 id=&#34;migrate-from-promtail-to-grafana-agent-flow&#34;&gt;Migrate from Promtail to Grafana Agent Flow&lt;/h1&gt;
&lt;p&gt;The built-in Grafana Agent convert command can migrate your 
    &lt;a href=&#34;https://www.grafana.com/docs/loki/v0.38/clients/promtail/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Promtail&lt;/a&gt;
configuration to a Grafana Agent Flow configuration.&lt;/p&gt;
&lt;p&gt;This topic describes how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Convert a Promtail configuration to a Grafana Agent Flow configuration.&lt;/li&gt;
&lt;li&gt;Run a Promtail configuration natively using Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;components-used-in-this-topic&#34;&gt;Components used in this topic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/local.file_match/&#34;&gt;local.file_match&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.source.file/&#34;&gt;loki.source.file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.write/&#34;&gt;loki.write&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;You must have an existing Promtail configuration.&lt;/li&gt;
&lt;li&gt;You must be familiar with the concept of 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; in Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;convert-a-promtail-configuration&#34;&gt;Convert a Promtail configuration&lt;/h2&gt;
&lt;p&gt;To fully migrate from
    &lt;a href=&#34;https://www.grafana.com/docs/loki/v0.38/clients/promtail/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Promtail&lt;/a&gt; to Grafana Agent Flow, you must convert
your Promtail configuration into a Grafana Agent Flow configuration. This
conversion will enable you to take full advantage of the many additional
features available in Grafana Agent Flow.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In this task, we will use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/cli/convert/&#34;&gt;convert&lt;/a&gt; CLI command to output a flow
configuration from a Promtail configuration.&lt;/p&gt;&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open a terminal window and run the following command:&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INPUT_CONFIG_PATH&lt;/code&gt;: The full path to the Promtail configuration.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;OUTPUT_CONFIG_PATH&lt;/code&gt;: The full path to output the flow configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/setup/start-agent/&#34;&gt;Start&lt;/a&gt; Grafana Agent Flow using the new flow configuration
from &lt;code&gt;OUTPUT_CONFIG_PATH&lt;/code&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;debugging&#34;&gt;Debugging&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If the convert command cannot convert a Promtail configuration, diagnostic
information is sent to &lt;code&gt;stderr&lt;/code&gt;. You can bypass any non-critical issues and
output the flow configuration using a best-effort conversion by including
the &lt;code&gt;--bypass-errors&lt;/code&gt; flag.&lt;/p&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;If you bypass the errors, the behavior of the converted configuration may not match the original Promtail configuration.
Make sure you fully test the converted configuration before using it in a production environment.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;




  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=promtail --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=promtail --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can also output a diagnostic report by including the &lt;code&gt;--report&lt;/code&gt; flag.&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=promtail --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=promtail --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Replace &lt;code&gt;OUTPUT_REPORT_PATH&lt;/code&gt; with the output path for the report.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Using the &lt;a href=&#34;#example&#34;&gt;example&lt;/a&gt; Promtail configuration below, the diagnostic
report provides the following information:&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;plaintext&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-plaintext&#34;&gt;(Warning) If you have a tracing set up for Promtail, it cannot be migrated to Grafana Agent Flow automatically. Refer to the documentation on how to configure tracing in Grafana Agent Flow.
(Warning) The metrics from Grafana Agent Flow are different from the metrics emitted by Promtail. If you rely on Promtail&amp;#39;s metrics, you must change your configuration, for example, your alerts and dashboards.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;run-a-promtail-configuration&#34;&gt;Run a Promtail configuration&lt;/h2&gt;
&lt;p&gt;If you’re not ready to completely switch to a flow configuration, you can run
Grafana Agent using your existing Promtail configuration.
The &lt;code&gt;--config.format=promtail&lt;/code&gt; flag tells Grafana Agent to convert your Promtail
configuration to Grafana Agent Flow and load it directly without saving the new
configuration. This allows you to try Grafana Agent Flow without modifying your existing
Promtail configuration infrastructure.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In this task, we will use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/cli/run/&#34;&gt;run&lt;/a&gt; CLI command to run Grafana Agent Flow using a Promtail configuration.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/setup/start-agent/&#34;&gt;Start&lt;/a&gt; Grafana Agent Flow and include the command line flag
&lt;code&gt;--config.format=promtail&lt;/code&gt;. Your configuration file must be a valid Promtail
configuration file rather than a Flow mode configuration file.&lt;/p&gt;
&lt;h3 id=&#34;debugging-1&#34;&gt;Debugging&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;You can follow the convert CLI command &lt;a href=&#34;#debugging&#34;&gt;debugging&lt;/a&gt; instructions to generate
a diagnostic report.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refer to the Grafana Agent Flow  
    &lt;a href=&#34;/docs/agent/v0.38/flow/monitoring/debugging/&#34;&gt;Debugging&lt;/a&gt; for more information about
running Grafana Agent Flow.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your Promtail configuration can&amp;rsquo;t be converted and loaded directly into
Grafana Agent, diagnostic information is sent to &lt;code&gt;stderr&lt;/code&gt;. You can bypass any
non-critical issues and start Grafana Agent by including the
&lt;code&gt;--config.bypass-conversion-errors&lt;/code&gt; flag in addition to
&lt;code&gt;--config.format=promtail&lt;/code&gt;.&lt;/p&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;If you bypass the errors, the behavior of the converted configuration may not match the original Promtail configuration.
Do not use this flag in a production environment.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;
&lt;p&gt;This example demonstrates converting a Promtail configuration file to a Grafana Agent Flow configuration file.&lt;/p&gt;
&lt;p&gt;The following Promtail configuration file provides the input for the conversion:&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;YAML&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-yaml&#34;&gt;clients:
  - url: http://localhost/loki/api/v1/push
scrape_configs:
  - job_name: example
    static_configs:
      - targets:
          - localhost
        labels:
          __path__: /var/log/*.log&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The convert command takes the YAML file as input and outputs a 
    &lt;a href=&#34;/docs/agent/v0.38/flow/config-language/&#34;&gt;River&lt;/a&gt; file.&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=promtail --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;The new Grafana Agent Flow configuration file looks like this:&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;Alloy&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-alloy&#34;&gt;local.file_match &amp;#34;example&amp;#34; {
	path_targets = [{
		__address__ = &amp;#34;localhost&amp;#34;,
		__path__    = &amp;#34;/var/log/*.log&amp;#34;,
	}]
}

loki.source.file &amp;#34;example&amp;#34; {
	targets    = local.file_match.example.targets
	forward_to = [loki.write.default.receiver]
}

loki.write &amp;#34;default&amp;#34; {
	endpoint {
		url = &amp;#34;http://localhost/loki/api/v1/push&amp;#34;
	}
	external_labels = {}
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;limitations&#34;&gt;Limitations&lt;/h2&gt;
&lt;p&gt;Configuration conversion is done on a best-effort basis. Grafana Agent will issue
warnings or errors where the conversion can&amp;rsquo;t be performed.&lt;/p&gt;
&lt;p&gt;Once the configuration is converted, we recommend that you review
the Grafana Agent Flow configuration file created, and verify that it&amp;rsquo;s correct
before starting to use it in a production environment.&lt;/p&gt;
&lt;p&gt;Furthermore, we recommend that you review the following checklist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Check if you are using any extra command line arguments with Promtail which
aren&amp;rsquo;t present in your configuration file. For example, &lt;code&gt;-max-line-size&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Check if you are setting any environment variables,
whether 
    &lt;a href=&#34;https://www.grafana.com/docs/loki/v0.38/clients/promtail/configuration/#use-environment-variables-in-the-configuration&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;expanded in the config file&lt;/a&gt; itself or consumed directly by
Promtail, such as &lt;code&gt;JAEGER_AGENT_HOST&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;In Grafana Agent Flow, the positions file is saved at a different location.
Refer to the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.source.file/&#34;&gt;loki.source.file&lt;/a&gt; documentation for more details. Check if you have any existing
setup, for example, a Kubernetes Persistent Volume, that you must update to use the new
positions file path.&lt;/li&gt;
&lt;li&gt;Metamonitoring metrics exposed by the Flow Mode usually match Promtail
metamonitoring metrics but will use a different name. Make sure that you
use the new metric names, for example, in your alerts and dashboards queries.&lt;/li&gt;
&lt;li&gt;Note that the logs produced by Grafana Agent Flow will differ from those
produced by Promtail.&lt;/li&gt;
&lt;li&gt;Note that Grafana Agent Flow exposes the Grafana Agent Flow 
    &lt;a href=&#34;/docs/agent/v0.38/flow/monitoring/debugging/#grafana-agent-flow-ui&#34;&gt;UI&lt;/a&gt;, which differs
from Promtail&amp;rsquo;s Web UI.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="migrate-from-promtail-to-grafana-agent-flow">Migrate from Promtail to Grafana Agent Flow&lt;/h1>
&lt;p>The built-in Grafana Agent convert command can migrate your
&lt;a href="https://www.grafana.com/docs/loki/v0.38/clients/promtail/" target="_blank" rel="noopener noreferrer">Promtail&lt;/a>
configuration to a Grafana Agent Flow configuration.&lt;/p>
&lt;p>This topic describes how to:&lt;/p></description></item><item><title>Migrate Grafana Agent Static to Grafana Agent Flow</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/migrating-from-static/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/migrating-from-static/</guid><content><![CDATA[&lt;h1 id=&#34;migrate-from-grafana-agent-static-to-grafana-agent-flow&#34;&gt;Migrate from Grafana Agent Static to Grafana Agent Flow&lt;/h1&gt;
&lt;p&gt;The built-in Grafana Agent convert command can migrate your 
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; configuration to a Grafana Agent Flow configuration.&lt;/p&gt;
&lt;p&gt;This topic describes how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Convert a Grafana Agent Static configuration to a Grafana Agent Flow configuration.&lt;/li&gt;
&lt;li&gt;Run a Grafana Agent Static configuration natively using Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;components-used-in-this-topic&#34;&gt;Components used in this topic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.scrape/&#34;&gt;prometheus.scrape&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.remote_write/&#34;&gt;prometheus.remote_write&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/local.file_match/&#34;&gt;local.file_match&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.process/&#34;&gt;loki.process&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.source.file/&#34;&gt;loki.source.file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.write/&#34;&gt;loki.write&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;You must have an existing Grafana Agent Static configuration.&lt;/li&gt;
&lt;li&gt;You must be familiar with the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; concept in Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;convert-a-grafana-agent-static-configuration&#34;&gt;Convert a Grafana Agent Static configuration&lt;/h2&gt;
&lt;p&gt;To fully migrate Grafana Agent 
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; to Grafana Agent Flow, you must convert
your Static configuration into a Grafana Agent Flow configuration.
This conversion will enable you to take full advantage of the many additional
features available in Grafana Agent Flow.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In this task, we will use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/cli/convert/&#34;&gt;convert&lt;/a&gt; CLI command to output a Grafana Agent Flow
configuration from a Static configuration.&lt;/p&gt;&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open a terminal window and run the following command:&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INPUT_CONFIG_PATH&lt;/code&gt;: The full path to the 
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; configuration.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;OUTPUT_CONFIG_PATH&lt;/code&gt;: The full path to output the Grafana Agent Flow configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/setup/start-agent/&#34;&gt;Start&lt;/a&gt; Grafana Agent Flow using the new Grafana Agent Flow configuration
from &lt;code&gt;OUTPUT_CONFIG_PATH&lt;/code&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;debugging&#34;&gt;Debugging&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If the convert command cannot convert a
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; configuration, diagnostic
information is sent to &lt;code&gt;stderr&lt;/code&gt;. You can use the &lt;code&gt;--bypass-errors&lt;/code&gt; flag to
bypass any non-critical issues and output the Grafana Agent Flow configuration
using a best-effort conversion.&lt;/p&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;If you bypass the errors, the behavior of the converted configuration may not match the original
 &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; configuration. Make sure you fully test the converted configuration before using it in a production environment.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;




  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=static --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=static --bypass-errors --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can use the &lt;code&gt;--report&lt;/code&gt; flag to output a diagnostic report.&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=static --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=static --report=OUTPUT_REPORT_PATH --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH
 ```&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Replace &lt;code&gt;OUTPUT_REPORT_PATH&lt;/code&gt; with the output path for the report.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Using the &lt;a href=&#34;#example&#34;&gt;example&lt;/a&gt; Grafana Agent Static configuration below, the diagnostic
report provides the following information:&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;plaintext&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-plaintext&#34;&gt;(Warning) Please review your agent command line flags and ensure they are set in your Flow mode config file where necessary.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;run-a-static-mode-configuration&#34;&gt;Run a Static mode configuration&lt;/h2&gt;
&lt;p&gt;If you’re not ready to completely switch to a Grafana Agent Flow configuration, you can run
Grafana Agent using your existing Grafana Agent Static configuration.
The &lt;code&gt;--config.format=static&lt;/code&gt; flag tells Grafana Agent to convert your
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt;
configuration to Grafana Agent Flow and load it directly without saving the new
configuration. This allows you to try Grafana Agent Flow without modifying your existing
Grafana Agent Static configuration infrastructure.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;In this task, we will use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/cli/run/&#34;&gt;run&lt;/a&gt; CLI command to run Grafana Agent Flow using a Static configuration.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/setup/start-agent/&#34;&gt;Start&lt;/a&gt; Grafana Agent Flow and include the command line flag
&lt;code&gt;--config.format=static&lt;/code&gt;. Your configuration file must be a valid
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt;
configuration file.&lt;/p&gt;
&lt;h3 id=&#34;debugging-1&#34;&gt;Debugging&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;You can follow the convert CLI command &lt;a href=&#34;#debugging&#34;&gt;debugging&lt;/a&gt; instructions to generate
a diagnostic report.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refer to the Grafana Agent Flow 
    &lt;a href=&#34;/docs/agent/v0.38/flow/monitoring/debugging/&#34;&gt;DebuggingUI&lt;/a&gt; for more information about
running Grafana Agent Flow.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; configuration can&amp;rsquo;t be converted and loaded directly into
Grafana Agent Flow, diagnostic information is sent to &lt;code&gt;stderr&lt;/code&gt;. You can use the &lt;code&gt; --config.bypass-conversion-errors&lt;/code&gt; flag with &lt;code&gt;--config.format=static&lt;/code&gt; to bypass any
non-critical issues and start Grafana Agent Flow.&lt;/p&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;If you bypass the errors, the behavior of the converted configuration may not match the original Grafana Agent Static configuration. Do not use this flag in a production environment.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;
&lt;p&gt;This example demonstrates converting a
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; configuration file to a Grafana Agent Flow configuration file.&lt;/p&gt;
&lt;p&gt;The following
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; configuration file provides the input for the conversion:&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;YAML&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-yaml&#34;&gt;server:
  log_level: info

metrics:
  global:
    scrape_interval: 15s
    remote_write:
      - url: https://prometheus-us-central1.grafana.net/api/prom/push
        basic_auth:
          username: USERNAME
          password: PASSWORD
  configs:
    - name: test
      host_filter: false
      scrape_configs:
        - job_name: local-agent
          static_configs:
            - targets: [&amp;#39;127.0.0.1:12345&amp;#39;]
              labels:
                cluster: &amp;#39;localhost&amp;#39;

logs:
  global:
    file_watch_config:
      min_poll_frequency: 1s
      max_poll_frequency: 5s
  positions_directory: /var/lib/agent/data-agent
  configs:
    - name: varlogs
      scrape_configs:
        - job_name: varlogs
          static_configs:
            - targets:
              - localhost
              labels:
                job: varlogs
                host: mylocalhost
                __path__: /var/log/*.log
          pipeline_stages:
            - match:
                selector: &amp;#39;{filename=&amp;#34;/var/log/*.log&amp;#34;}&amp;#39;
                stages:
                - drop:
                    expression: &amp;#39;^[^0-9]{4}&amp;#39;
                - regex:
                    expression: &amp;#39;^(?P&amp;lt;timestamp&amp;gt;\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) \[(?P&amp;lt;level&amp;gt;[[:alpha:]]&amp;#43;)\] (?:\d&amp;#43;)\#(?:\d&amp;#43;): \*(?:\d&amp;#43;) (?P&amp;lt;message&amp;gt;.&amp;#43;)$&amp;#39;
                - pack:
                    labels:
                      - level
      clients:
        - url: https://USER_ID:API_KEY@logs-prod3.grafana.net/loki/api/v1/push&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The convert command takes the YAML file as input and outputs a 
    &lt;a href=&#34;/docs/agent/v0.38/flow/config-language/&#34;&gt;River&lt;/a&gt; file.&lt;/p&gt;



  

  






  

  



  &lt;div class=&#34;code&#34; x-data=&#34;app_code([&amp;#34;static-binary&amp;#34;,&amp;#34;flow-binary&amp;#34;], false)&#34; x-init=&#34;init()&#34; data-codetoggle=&#34;true&#34;&gt;
    &lt;div class=&#34;toggle-toolbar &#34;&gt;
      &lt;div&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;static-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;static-binary&#39;&#34;&gt;
              &lt;span&gt;static-binary&lt;/span&gt;
            &lt;/button&gt;&lt;button class=&#34;toggle-toolbar__item&#34; :class=&#34;{ &#39;toggle-toolbar__item-active&#39;: active === &#39;flow-binary&#39; }&#34; @click=&#34;$store.code.language = &#39;flow-binary&#39;&#34;&gt;
              &lt;span&gt;flow-binary&lt;/span&gt;
            &lt;/button&gt;&lt;/div&gt;
      &lt;div class=&#34;d-flex&#34;&gt;&lt;span class=&#34;code-clipboard&#34; x-ref=&#34;tooltip&#34;&gt;
          &lt;button @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;toggle-toolbar__border&#34;&gt;&lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&#34;code-rendered&#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;static-binary&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-static-binary&#34;&gt;AGENT_MODE=flow grafana-agent convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&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;flow-binary&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-flow-binary&#34;&gt;grafana-agent-flow convert --source-format=static --output=OUTPUT_CONFIG_PATH INPUT_CONFIG_PATH&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

    &lt;/div&gt;
  &lt;/div&gt;


&lt;p&gt;The new Grafana Agent Flow configuration file looks like this:&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;Alloy&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-alloy&#34;&gt;prometheus.scrape &amp;#34;metrics_test_local_agent&amp;#34; {
	targets = [{
		__address__ = &amp;#34;127.0.0.1:12345&amp;#34;,
		cluster     = &amp;#34;localhost&amp;#34;,
	}]
	forward_to      = [prometheus.remote_write.metrics_test.receiver]
	job_name        = &amp;#34;local-agent&amp;#34;
	scrape_interval = &amp;#34;15s&amp;#34;
}

prometheus.remote_write &amp;#34;metrics_test&amp;#34; {
	endpoint {
		name = &amp;#34;test-3a2a1b&amp;#34;
		url  = &amp;#34;https://prometheus-us-central1.grafana.net/api/prom/push&amp;#34;

		basic_auth {
			username = &amp;#34;USERNAME&amp;#34;
			password = &amp;#34;PASSWORD&amp;#34;
		}

		queue_config { }

		metadata_config { }
	}
}

local.file_match &amp;#34;logs_varlogs_varlogs&amp;#34; {
	path_targets = [{
		__address__ = &amp;#34;localhost&amp;#34;,
		__path__    = &amp;#34;/var/log/*.log&amp;#34;,
		host        = &amp;#34;mylocalhost&amp;#34;,
		job         = &amp;#34;varlogs&amp;#34;,
	}]
}

loki.process &amp;#34;logs_varlogs_varlogs&amp;#34; {
	forward_to = [loki.write.logs_varlogs.receiver]

	stage.match {
		selector = &amp;#34;{filename=\&amp;#34;/var/log/*.log\&amp;#34;}&amp;#34;

		stage.drop {
			expression = &amp;#34;^[^0-9]{4}&amp;#34;
		}

		stage.regex {
			expression = &amp;#34;^(?P&amp;lt;timestamp&amp;gt;\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}:\\d{2}) \\[(?P&amp;lt;level&amp;gt;[[:alpha:]]&amp;#43;)\\] (?:\\d&amp;#43;)\\#(?:\\d&amp;#43;): \\*(?:\\d&amp;#43;) (?P&amp;lt;message&amp;gt;.&amp;#43;)$&amp;#34;
		}

		stage.pack {
			labels           = [&amp;#34;level&amp;#34;]
			ingest_timestamp = false
		}
	}
}

loki.source.file &amp;#34;logs_varlogs_varlogs&amp;#34; {
	targets    = local.file_match.logs_varlogs_varlogs.targets
	forward_to = [loki.process.logs_varlogs_varlogs.receiver]

	file_watch {
		min_poll_frequency = &amp;#34;1s&amp;#34;
		max_poll_frequency = &amp;#34;5s&amp;#34;
	}
}

loki.write &amp;#34;logs_varlogs&amp;#34; {
	endpoint {
		url = &amp;#34;https://USER_ID:API_KEY@logs-prod3.grafana.net/loki/api/v1/push&amp;#34;
	}
	external_labels = {}
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;limitations&#34;&gt;Limitations&lt;/h2&gt;
&lt;p&gt;Configuration conversion is done on a best-effort basis. Grafana Agent will issue
warnings or errors where the conversion cannot be performed.&lt;/p&gt;
&lt;p&gt;Once the configuration is converted, we recommend that you review
the Grafana Agent Flow configuration file, and verify that it is correct
before starting to use it in a production environment.&lt;/p&gt;
&lt;p&gt;Furthermore, we recommend that you review the following checklist:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The following configuration options aren&amp;rsquo;t available for conversion to Grafana Agent Flow: 
    &lt;a href=&#34;/docs/agent/v0.38/static/configuration/integrations/integrations-next//&#34;&gt;Integrations next&lt;/a&gt;, 
    &lt;a href=&#34;/docs/agent/v0.38/static/configuration/traces-config/&#34;&gt;Traces&lt;/a&gt;, and 
    &lt;a href=&#34;/docs/agent/v0.38/static/configuration/agent-management/&#34;&gt;Agent Management&lt;/a&gt;.
Any additional unsupported features are returned as errors during conversion.&lt;/li&gt;
&lt;li&gt;There is no gRPC server to configure for Grafana Agent Flow, as any non-default configuration will show as unsupported during the conversion.&lt;/li&gt;
&lt;li&gt;Check if you are using any extra command line arguments with Static that aren&amp;rsquo;t present in your configuration file. For example, &lt;code&gt;-server.http.address&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Check if you are using any environment variables in your 
    &lt;a href=&#34;/docs/agent/v0.38/static/&#34;&gt;Static&lt;/a&gt; configuration.
These will be evaluated during conversion and you may want to replace them with the Grafana Agent Flow Standard library 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/stdlib/env/&#34;&gt;env&lt;/a&gt; function after conversion.&lt;/li&gt;
&lt;li&gt;Review additional 
    &lt;a href=&#34;/docs/agent/v0.38/flow/getting-started/migrating-from-prometheus/#limitations&#34;&gt;Prometheus Limitations&lt;/a&gt; for limitations specific to your 
    &lt;a href=&#34;/docs/agent/v0.38/static/configuration/metrics-config/&#34;&gt;Metrics&lt;/a&gt; configuration.&lt;/li&gt;
&lt;li&gt;Review additional 
    &lt;a href=&#34;/docs/agent/v0.38/flow/getting-started/migrating-from-promtail/#limitations&#34;&gt;Promtail Limitations&lt;/a&gt; for limitations specific to your 
    &lt;a href=&#34;/docs/agent/v0.38/static/configuration/logs-config/&#34;&gt;Logs&lt;/a&gt; configuration.&lt;/li&gt;
&lt;li&gt;The logs produced by Grafana Agent Flow mode will differ from those produced by Static.&lt;/li&gt;
&lt;li&gt;Grafana Agent exposes the Grafana Agent Flow 
    &lt;a href=&#34;/docs/agent/v0.38/flow/monitoring/debugging/#grafana-agent-flow-ui&#34;&gt;UI&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="migrate-from-grafana-agent-static-to-grafana-agent-flow">Migrate from Grafana Agent Static to Grafana Agent Flow&lt;/h1>
&lt;p>The built-in Grafana Agent convert command can migrate your
&lt;a href="/docs/agent/v0.38/static/">Static&lt;/a> configuration to a Grafana Agent Flow configuration.&lt;/p></description></item><item><title>OpenTelemetry to Grafana stack</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/opentelemetry-to-lgtm-stack/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/opentelemetry-to-lgtm-stack/</guid><content><![CDATA[&lt;h1 id=&#34;opentelemetry-to-grafana-stack&#34;&gt;OpenTelemetry to Grafana stack&lt;/h1&gt;
&lt;p&gt;You can configure Grafana Agent Flow to collect &lt;a href=&#34;https://opentelemetry.io&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry&lt;/a&gt;-compatible data and forward it to the Grafana stack&lt;/p&gt;
&lt;p&gt;This topic describes how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Configure Grafana Agent Flow to send your data to Loki&lt;/li&gt;
&lt;li&gt;Configure Grafana Agent Flow to send your data to Tempo&lt;/li&gt;
&lt;li&gt;Configure Grafana Agent Flow to send your data to Mimir or Prometheus Remote Write&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;components-used-in-this-topic&#34;&gt;Components used in this topic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.write/&#34;&gt;loki.write&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.auth.basic/&#34;&gt;otelcol.auth.basic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.loki/&#34;&gt;otelcol.exporter.loki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.otlp/&#34;&gt;otelcol.exporter.otlp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.prometheus/&#34;&gt;otelcol.exporter.prometheus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.processor.batch/&#34;&gt;otelcol.processor.batch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.receiver.otlp/&#34;&gt;otelcol.receiver.otlp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.remote_write/&#34;&gt;prometheus.remote_write&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that you have basic familiarity with instrumenting applications with
OpenTelemetry.&lt;/li&gt;
&lt;li&gt;Have a set of OpenTelemetry applications ready to push telemetry data to
Grafana Agent Flow.&lt;/li&gt;
&lt;li&gt;Identify where Grafana Agent Flow will write received telemetry data.&lt;/li&gt;
&lt;li&gt;Be familiar with the concept of 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; in Grafana Agent Flow.&lt;/li&gt;
&lt;li&gt;Complete the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/getting-started/collect-opentelemetry-data/&#34;&gt;Collect open telemetry data&lt;/a&gt; getting started guide. You will pick up from where that guide ended.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;the-pipeline&#34;&gt;The pipeline&lt;/h2&gt;
&lt;p&gt;You can start with the Grafana Agent Flow configuration you created in the previous getting started guide:&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;Alloy&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-alloy&#34;&gt;otelcol.receiver.otlp &amp;#34;example&amp;#34; {
  grpc {
    endpoint = &amp;#34;127.0.0.1:4317&amp;#34;
  }

  http {
    endpoint = &amp;#34;127.0.0.1:4318&amp;#34;
  }

  output {
    metrics = [otelcol.processor.batch.example.input]
    logs    = [otelcol.processor.batch.example.input]
    traces  = [otelcol.processor.batch.example.input]
  }
}

otelcol.processor.batch &amp;#34;example&amp;#34; {
  output {
    metrics = [otelcol.exporter.otlp.default.input]
    logs    = [otelcol.exporter.otlp.default.input]
    traces  = [otelcol.exporter.otlp.default.input]
  }
}

otelcol.exporter.otlp &amp;#34;default&amp;#34; {
  client {
    endpoint = &amp;#34;my-otlp-grpc-server:4317&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The pipeline currently looks like this:&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;Metrics, Logs, Traces: OTLP Receiver → batch processor → OTLP Exporter&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You will implement the following pipelines to send your data to Loki, Tempo, and Mimir or Prometheus:&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;Metrics: OTel → batch processor → Mimir or Prometheus remote write
Logs: OTel → batch processor → Loki exporter
Traces: OTel → batch processor → OTel exporter&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;grafana-loki&#34;&gt;Grafana Loki&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;/oss/loki/&#34;&gt;Grafana Loki&lt;/a&gt; is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus. Similar to Prometheus, to send from OTLP to Loki, we will do a passthrough from the
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.loki/&#34;&gt;otelcol.exporter.loki&lt;/a&gt; component to
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.write/&#34;&gt;loki.write&lt;/a&gt; component.&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;Alloy&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-alloy&#34;&gt;otelcol.exporter.loki &amp;#34;default&amp;#34; {
	forward_to = [loki.write.default.receiver]
}

loki.write &amp;#34;default&amp;#34; {
	endpoint {
		url = &amp;#34;http://loki-endpoint:8080/loki/api/v1/push&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To use Loki with basic-auth, which is required with Grafana Cloud Loki, you must configure the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/loki.write/&#34;&gt;loki.write&lt;/a&gt; component. You can get the Loki configuration from the Loki &lt;strong&gt;Details&lt;/strong&gt; page in the &lt;a href=&#34;/docs/grafana-cloud/account-management/cloud-portal/#your-grafana-cloud-stack&#34;&gt;Grafana Cloud Portal&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload&#34;
  data-src=&#34;../../../assets/getting-started/loki-config.png&#34;
  alt=&#34;&#34;/&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;Alloy&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-alloy&#34;&gt;otelcol.exporter.loki &amp;#34;grafana_cloud_loki&amp;#34; {
	forward_to = [loki.write.grafana_cloud_loki.receiver]
}

loki.write &amp;#34;grafana_cloud_loki&amp;#34; {
	endpoint {
		url = &amp;#34;https://logs-prod-us-central1.grafana.net/loki/api/v1/push&amp;#34;

		basic_auth {
			username = 5252
			password = env(&amp;#34;GRAFANA_CLOUD_API_KEY&amp;#34;)
		}
	}
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;grafana-tempo&#34;&gt;Grafana Tempo&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;/oss/tempo/&#34;&gt;Grafana Tempo&lt;/a&gt; is an open source, easy-to-use, scalable distributed tracing backend. Tempo can ingest OTLP directly, and you can use the OTLP exporter to send the traces to Tempo.&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;Alloy&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-alloy&#34;&gt;otelcol.exporter.otlp &amp;#34;default&amp;#34; {
  client {
    endpoint = &amp;#34;tempo-server:4317&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To use Tempo with basic-auth, which is required with Grafana Cloud Tempo, you must use the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.auth.basic/&#34;&gt;otelcol.auth.basic&lt;/a&gt; component. You can get the Tempo configuration from the Tempo &lt;strong&gt;Details&lt;/strong&gt; page in the &lt;a href=&#34;/docs/grafana-cloud/account-management/cloud-portal/#your-grafana-cloud-stack&#34;&gt;Grafana Cloud Portal&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload&#34;
  data-src=&#34;../../../assets/getting-started/tempo-config.png&#34;
  alt=&#34;&#34;/&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;Alloy&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-alloy&#34;&gt;otelcol.exporter.otlp &amp;#34;grafana_cloud_tempo&amp;#34; {
	client {
		endpoint = &amp;#34;tempo-us-central1.grafana.net:443&amp;#34;
		auth     = otelcol.auth.basic.grafana_cloud_tempo.handler
	}
}

otelcol.auth.basic &amp;#34;grafana_cloud_tempo&amp;#34; {
	username = 4094
	password = env(&amp;#34;GRAFANA_CLOUD_API_KEY&amp;#34;)
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;grafana-mimir-or-prometheus-remote-write&#34;&gt;Grafana Mimir or Prometheus Remote Write&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://prometheus.io/docs/operating/integrations/#remote-endpoints-and-storage&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prometheus Remote Write&lt;/a&gt; is a popular metrics transmission protocol supported by most metrics systems, including &lt;a href=&#34;/oss/mimir/&#34;&gt;Grafana Mimir&lt;/a&gt; and Grafana Cloud. To send from OTLP to Prometheus, we do a passthrough from the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/otelcol.exporter.prometheus/&#34;&gt;otelcol.exporter.prometheus&lt;/a&gt; to the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.remote_write/&#34;&gt;prometheus.remote_write&lt;/a&gt; component. The Prometheus remote write component in Grafana Agent Flow is a robust protocol implementation, including a Write Ahead Log (WAL) for resiliency.&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;Alloy&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-alloy&#34;&gt;otelcol.exporter.prometheus &amp;#34;default&amp;#34; {
	forward_to = [prometheus.remote_write.default.receiver]
}

prometheus.remote_write &amp;#34;default&amp;#34; {
	endpoint {
		url = &amp;#34;http://prometheus:9090/api/v1/write&amp;#34;
	}
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To use Prometheus with basic-auth, which is required with Grafana Cloud Prometheus, you must configure the 
    &lt;a href=&#34;/docs/agent/v0.38/flow/reference/components/prometheus.remote_write/&#34;&gt;prometheus.remote_write&lt;/a&gt; component. You can get the Prometheus configuration from the Prometheus &lt;strong&gt;Details&lt;/strong&gt; page in the &lt;a href=&#34;/docs/grafana-cloud/account-management/cloud-portal/#your-grafana-cloud-stack&#34;&gt;Grafana Cloud Portal&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload&#34;
  data-src=&#34;../../../assets/getting-started/prometheus-config.png&#34;
  alt=&#34;&#34;/&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;Alloy&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-alloy&#34;&gt;otelcol.exporter.prometheus &amp;#34;grafana_cloud_prometheus&amp;#34; {
        forward_to = [prometheus.remote_write.grafana_cloud_prometheus.receiver]
    }

prometheus.remote_write &amp;#34;grafana_cloud_prometheus&amp;#34; {
    endpoint {
        url = &amp;#34;https://prometheus-us-central1.grafana.net/api/prom/push&amp;#34;

        basic_auth {
            username = 12690
            password = env(&amp;#34;GRAFANA_CLOUD_API_KEY&amp;#34;)
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;putting-it-all-together&#34;&gt;Putting it all together&lt;/h2&gt;
&lt;p&gt;Instead of referencing &lt;code&gt;otelcol.exporter.otlp.default.input&lt;/code&gt; in the output of &lt;code&gt;otelcol.processor.batch&lt;/code&gt;, we need to reference the three exporters we set up. The final configuration becomes:&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;Alloy&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-alloy&#34;&gt;otelcol.receiver.otlp &amp;#34;example&amp;#34; {
  grpc {
    endpoint = &amp;#34;127.0.0.1:4317&amp;#34;
  }

  http {
    endpoint = &amp;#34;127.0.0.1:4318&amp;#34;
  }

  output {
    metrics = [otelcol.processor.batch.example.input]
    logs    = [otelcol.processor.batch.example.input]
    traces  = [otelcol.processor.batch.example.input]
  }
}

otelcol.processor.batch &amp;#34;example&amp;#34; {
  output {
    metrics = [otelcol.exporter.prometheus.grafana_cloud_prometheus.input]
    logs    = [otelcol.exporter.loki.grafana_cloud_loki.input]
    traces  = [otelcol.exporter.otlp.grafana_cloud_tempo.input]
  }
}

otelcol.exporter.otlp &amp;#34;grafana_cloud_tempo&amp;#34; {
	client {
		endpoint = &amp;#34;tempo-us-central1.grafana.net:443&amp;#34;
		auth     = otelcol.auth.basic.grafana_cloud_tempo.handler
	}
}

otelcol.auth.basic &amp;#34;grafana_cloud_tempo&amp;#34; {
	username = 4094
	password = env(&amp;#34;GRAFANA_CLOUD_API_KEY&amp;#34;)
}

otelcol.exporter.prometheus &amp;#34;grafana_cloud_prometheus&amp;#34; {
        forward_to = [prometheus.remote_write.grafana_cloud_prometheus.receiver]
    }

prometheus.remote_write &amp;#34;grafana_cloud_prometheus&amp;#34; {
    endpoint {
        url = &amp;#34;https://prometheus-us-central1.grafana.net/api/prom/push&amp;#34;

        basic_auth {
            username = 12690
            password = env(&amp;#34;GRAFANA_CLOUD_API_KEY&amp;#34;)
        }
    }
}

otelcol.exporter.loki &amp;#34;grafana_cloud_loki&amp;#34; {
	forward_to = [loki.write.grafana_cloud_loki.receiver]
}

loki.write &amp;#34;grafana_cloud_loki&amp;#34; {
	endpoint {
		url = &amp;#34;https://logs-prod-us-central1.grafana.net/loki/api/v1/push&amp;#34;

		basic_auth {
			username = 5252
			password = env(&amp;#34;GRAFANA_CLOUD_API_KEY&amp;#34;)
		}
	}
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Running Grafana Agent Flow now will give you the following:&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;AGENT_MODE=flow ./grafana-agent run agent-config.river
AGENT_MODE=flow ./grafana-agent run agent-config.river
ts=2023-05-09T09:37:15.300959Z level=info msg=&amp;#34;running usage stats reporter&amp;#34;
ts=2023-05-09T09:37:15.300958Z level=info msg=&amp;#34;now listening for http traffic&amp;#34; addr=127.0.0.1:12345
ts=2023-05-09T09:37:15.301104Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;starting complete graph evaluation&amp;#34;
ts=2023-05-09T09:37:15.301307Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=loki.write.grafana_cloud_loki duration=188.209µs
ts=2023-05-09T09:37:15.301334Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=otelcol.exporter.loki.grafana_cloud_loki duration=18.791µs
ts=2023-05-09T09:37:15.303138Z component=prometheus.remote_write.grafana_cloud_prometheus level=info subcomponent=wal msg=&amp;#34;replaying WAL, this may take a while&amp;#34; dir=data-agent/prometheus.remote_write.grafana_cloud_prometheus/wal
ts=2023-05-09T09:37:15.303257Z component=prometheus.remote_write.grafana_cloud_prometheus level=info subcomponent=wal msg=&amp;#34;WAL segment loaded&amp;#34; segment=0 maxSegment=1
ts=2023-05-09T09:37:15.303302Z component=prometheus.remote_write.grafana_cloud_prometheus level=info subcomponent=wal msg=&amp;#34;WAL segment loaded&amp;#34; segment=1 maxSegment=1
ts=2023-05-09T09:37:15.303507Z component=prometheus.remote_write.grafana_cloud_prometheus subcomponent=rw level=info remote_name=7f623a url=https://prometheus-us-central1.grafana.net/api/prom/push msg=&amp;#34;Starting WAL watcher&amp;#34; queue=7f623a
ts=2023-05-09T09:37:15.303515Z component=prometheus.remote_write.grafana_cloud_prometheus subcomponent=rw level=info remote_name=7f623a url=https://prometheus-us-central1.grafana.net/api/prom/push msg=&amp;#34;Starting scraped metadata watcher&amp;#34;
ts=2023-05-09T09:37:15.303522Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=prometheus.remote_write.grafana_cloud_prometheus duration=2.181958ms
ts=2023-05-09T09:37:15.303557Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=otelcol.exporter.prometheus.grafana_cloud_prometheus duration=30.083µs
ts=2023-05-09T09:37:15.303611Z component=prometheus.remote_write.grafana_cloud_prometheus subcomponent=rw level=info remote_name=7f623a url=https://prometheus-us-central1.grafana.net/api/prom/push msg=&amp;#34;Replaying WAL&amp;#34; queue=7f623a
ts=2023-05-09T09:37:15.303618Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=otelcol.auth.basic.grafana_cloud_tempo duration=52.5µs
ts=2023-05-09T09:37:15.303694Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=otelcol.exporter.otlp.grafana_cloud_tempo duration=70.375µs
ts=2023-05-09T09:37:15.303782Z component=otelcol.processor.memory_limiter.default level=info msg=&amp;#34;Memory limiter configured&amp;#34; limit_mib=150 spike_limit_mib=30 check_interval=1s
ts=2023-05-09T09:37:15.303802Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=otelcol.processor.memory_limiter.default duration=100.334µs
ts=2023-05-09T09:37:15.303853Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=otelcol.processor.batch.default duration=44.75µs
ts=2023-05-09T09:37:15.303948Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=otelcol.receiver.otlp.default duration=87.333µs
ts=2023-05-09T09:37:15.303968Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=tracing duration=10.792µs
ts=2023-05-09T09:37:15.303981Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished node evaluation&amp;#34; node_id=logging duration=9µs
ts=2023-05-09T09:37:15.303987Z level=info trace_id=6466516c9e1a556422df7a84c0ade6b0 msg=&amp;#34;finished complete graph evaluation&amp;#34; duration=2.960333ms
ts=2023-05-09T09:37:15.304Z level=info msg=&amp;#34;scheduling loaded components&amp;#34;
ts=2023-05-09T09:37:15.304109Z component=otelcol.receiver.otlp.default level=info msg=&amp;#34;Starting GRPC server&amp;#34; endpoint=0.0.0.0:4317
ts=2023-05-09T09:37:15.304234Z component=otelcol.receiver.otlp.default level=info msg=&amp;#34;Starting HTTP server&amp;#34; endpoint=0.0.0.0:4318&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can now check the pipeline graphically by visiting http://localhost:12345/graph&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload&#34;
  data-src=&#34;../../../assets/getting-started/otlp-lgtm-graph.png&#34;
  alt=&#34;&#34;/&gt;&lt;/p&gt;
]]></content><description>&lt;h1 id="opentelemetry-to-grafana-stack">OpenTelemetry to Grafana stack&lt;/h1>
&lt;p>You can configure Grafana Agent Flow to collect &lt;a href="https://opentelemetry.io" target="_blank" rel="noopener noreferrer">OpenTelemetry&lt;/a>-compatible data and forward it to the Grafana stack&lt;/p>
&lt;p>This topic describes how to:&lt;/p></description></item><item><title>Configure Grafana Agent clustering in an existing installation</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/configure-agent-clustering/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/configure-agent-clustering/</guid><content><![CDATA[&lt;h1 id=&#34;configure-grafana-agent-flow-clustering-in-an-existing-installation&#34;&gt;Configure Grafana Agent Flow clustering in an existing installation&lt;/h1&gt;
&lt;p&gt;You can configure Grafana Agent Flow to run with 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/clustering/&#34;&gt;clustering&lt;/a&gt; so that
individual Grafana Agents can work together for workload distribution and high
availability.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Clustering is a 
    &lt;a href=&#34;/docs/agent/v0.38/stability/#beta&#34;&gt;beta&lt;/a&gt; feature. Beta features are subject to breaking changes and may be
replaced with equivalent functionality that covers the same use case.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This topic describes how to add clustering to an existing installation.&lt;/p&gt;
&lt;h2 id=&#34;configure-grafana-agent-flow-clustering-with-helm-chart&#34;&gt;Configure Grafana Agent Flow clustering with Helm Chart&lt;/h2&gt;
&lt;p&gt;This section guides you through enabling clustering when Grafana Agent Flow is
installed on Kubernetes using the Grafana Agent 
    &lt;a href=&#34;/docs/agent/v0.38/flow/setup/install/kubernetes/&#34;&gt;Helm chart&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that your &lt;code&gt;values.yaml&lt;/code&gt; file has &lt;code&gt;controller.type&lt;/code&gt; set to
&lt;code&gt;statefulset&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;steps&#34;&gt;Steps&lt;/h3&gt;
&lt;p&gt;To configure clustering:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Amend your existing values.yaml file to add &lt;code&gt;clustering.enabled=true&lt;/code&gt; inside
of the &lt;code&gt;agent&lt;/code&gt; block:&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;YAML&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-yaml&#34;&gt;agent:
  clustering:
    enabled: true&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Upgrade your installation to use the new &lt;code&gt;values.yaml&lt;/code&gt; 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;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;helm upgrade RELEASE_NAME -f values.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace &lt;code&gt;RELEASE_NAME&lt;/code&gt; with the name of the installation you chose when you
installed the Helm chart.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the Grafana Agent Flow 
    &lt;a href=&#34;/docs/agent/v0.38/flow/monitoring/debugging/#component-detail-page&#34;&gt;UI&lt;/a&gt; to verify the cluster status:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Clustering&lt;/strong&gt; in the navigation bar.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Ensure that all expected nodes appear in the resulting table.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="configure-grafana-agent-flow-clustering-in-an-existing-installation">Configure Grafana Agent Flow clustering in an existing installation&lt;/h1>
&lt;p>You can configure Grafana Agent Flow to run with
&lt;a href="/docs/agent/v0.38/flow/concepts/clustering/">clustering&lt;/a> so that
individual Grafana Agents can work together for workload distribution and high
availability.&lt;/p></description></item><item><title>Distribute Prometheus metrics scrape load</title><link>https://grafana.com/docs/agent/v0.38/flow/getting-started/distribute-prometheus-scrape-load/</link><pubDate>Sun, 12 Apr 2026 09:27:09 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.38/flow/getting-started/distribute-prometheus-scrape-load/</guid><content><![CDATA[&lt;h1 id=&#34;distribute-prometheus-metrics-scrape-load&#34;&gt;Distribute Prometheus metrics scrape load&lt;/h1&gt;
&lt;p&gt;A good predictor for the size of an Grafana Agent Flow deployment is the number of
Prometheus targets each Grafana Agent scrapes. 
    &lt;a href=&#34;/docs/agent/v0.38/flow/concepts/clustering/&#34;&gt;Clustering&lt;/a&gt; with target
auto-distribution allows a fleet of Grafana Agents to work together to dynamically
distribute their scrape load, providing high-availability.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Clustering is a 
    &lt;a href=&#34;/docs/agent/v0.38/stability/#beta&#34;&gt;beta&lt;/a&gt; feature. Beta features are subject to breaking
changes and may be replaced with equivalent functionality that covers the same use case.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Familiarize yourself with how to 
    &lt;a href=&#34;/docs/agent/v0.38/flow/setup/configure/&#34;&gt;configure existing Grafana Agent Flow installations&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/getting-started/collect-prometheus-metrics/&#34;&gt;Configure Prometheus metrics collection&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.38/flow/getting-started/configure-agent-clustering/&#34;&gt;Configure clustering&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Ensure that all of your clustered Grafana Agents have the same configuration file.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;steps&#34;&gt;Steps&lt;/h2&gt;
&lt;p&gt;To distribute Prometheus metrics scrape load with clustering:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following block to all &lt;code&gt;prometheus.scrape&lt;/code&gt; components which
should use auto-distribution:&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;Alloy&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-alloy&#34;&gt;clustering {
  enabled = true
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Restart or reload Grafana Agents for them to use the new configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Validate that auto-distribution is functioning:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Using the Grafana Agent 
    &lt;a href=&#34;/docs/agent/v0.38/flow/monitoring/debugging/#component-detail-page&#34;&gt;UI&lt;/a&gt; on each Grafana Agent, navigate to the details page for one of
the &lt;code&gt;prometheus.scrape&lt;/code&gt; components you modified.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Compare the Debug Info sections between two different Grafana Agent to ensure that they&amp;rsquo;re not scraping the same sets of targets.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="distribute-prometheus-metrics-scrape-load">Distribute Prometheus metrics scrape load&lt;/h1>
&lt;p>A good predictor for the size of an Grafana Agent Flow deployment is the number of
Prometheus targets each Grafana Agent scrapes.
&lt;a href="/docs/agent/v0.38/flow/concepts/clustering/">Clustering&lt;/a> with target
auto-distribution allows a fleet of Grafana Agents to work together to dynamically
distribute their scrape load, providing high-availability.&lt;/p></description></item></channel></rss>