<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tasks with Grafana Agent Flow on Grafana Labs</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/</link><description>Recent content in Tasks with Grafana Agent Flow on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/agent/v0.44/flow/tasks/index.xml" rel="self" type="application/rss+xml"/><item><title>Configure Grafana Agent Flow</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/configure/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/configure/</guid><content><![CDATA[&lt;h1 id=&#34;configure-grafana-agent-flow&#34;&gt;Configure Grafana Agent Flow&lt;/h1&gt;
&lt;p&gt;You can configure Grafana Agent Flow after it is 
    &lt;a href=&#34;/docs/agent/v0.44/flow/get-started/install/&#34;&gt;installed&lt;/a&gt;.
The default River configuration file for Grafana Agent Flow is located at:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Linux: &lt;code&gt;/etc/grafana-agent-flow.river&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;macOS: &lt;code&gt;$(brew --prefix)/etc/grafana-agent-flow/config.river&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Windows: &lt;code&gt;C:\Program Files\Grafana Agent Flow\config.river&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This section includes information that helps you configure Grafana Agent Flow.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/configure/configure-kubernetes/&#34;&gt;Configure Grafana Agent Flow on Kubernetes&lt;/a&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/configure/configure-linux/&#34;&gt;Configure Grafana Agent Flow on Linux&lt;/a&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/configure/configure-macos/&#34;&gt;Configure Grafana Agent Flow on macOS&lt;/a&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/configure/configure-windows/&#34;&gt;Configure Grafana Agent Flow on Windows&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
]]></content><description>&lt;h1 id="configure-grafana-agent-flow">Configure Grafana Agent Flow&lt;/h1>
&lt;p>You can configure Grafana Agent Flow after it is
&lt;a href="/docs/agent/v0.44/flow/get-started/install/">installed&lt;/a>.
The default River configuration file for Grafana Agent Flow is located at:&lt;/p></description></item><item><title>Migrate to Grafana Agent Flow</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/migrate/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/migrate/</guid><content><![CDATA[&lt;h1 id=&#34;how-to-migrate-to-grafana-agent-flow&#34;&gt;How to migrate to Grafana Agent Flow&lt;/h1&gt;
&lt;p&gt;This section details how to migrate to Grafana Agent Flow from other
common solutions.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/migrate/from-operator/&#34;&gt;Migrate from Grafana Agent Operator to Grafana Agent Flow&lt;/a&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/migrate/from-otelcol/&#34;&gt;Migrate from OpenTelemetry Collector to Grafana Agent Flow&lt;/a&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/migrate/from-prometheus/&#34;&gt;Migrate from Prometheus to Grafana Agent Flow&lt;/a&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/migrate/from-promtail/&#34;&gt;Migrate from Promtail to Grafana Agent Flow&lt;/a&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/migrate/from-static/&#34;&gt;Migrate Grafana Agent Static to Grafana Agent Flow&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
]]></content><description>&lt;h1 id="how-to-migrate-to-grafana-agent-flow">How to migrate to Grafana Agent Flow&lt;/h1>
&lt;p>This section details how to migrate to Grafana Agent Flow from other
common solutions.&lt;/p>
&lt;ul>&lt;li>
&lt;a href="/docs/agent/v0.44/flow/tasks/migrate/from-operator/">Migrate from Grafana Agent Operator to Grafana Agent Flow&lt;/a>&lt;/li>&lt;li>
&lt;a href="/docs/agent/v0.44/flow/tasks/migrate/from-otelcol/">Migrate from OpenTelemetry Collector to Grafana Agent Flow&lt;/a>&lt;/li>&lt;li>
&lt;a href="/docs/agent/v0.44/flow/tasks/migrate/from-prometheus/">Migrate from Prometheus to Grafana Agent Flow&lt;/a>&lt;/li>&lt;li>
&lt;a href="/docs/agent/v0.44/flow/tasks/migrate/from-promtail/">Migrate from Promtail to Grafana Agent Flow&lt;/a>&lt;/li>&lt;li>
&lt;a href="/docs/agent/v0.44/flow/tasks/migrate/from-static/">Migrate Grafana Agent Static to Grafana Agent Flow&lt;/a>&lt;/li>&lt;/ul></description></item><item><title>Monitor Grafana Agent Flow</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/monitor/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/monitor/</guid><content><![CDATA[&lt;h1 id=&#34;how-to-monitor-grafana-agent-flow&#34;&gt;How to monitor Grafana Agent Flow&lt;/h1&gt;
&lt;p&gt;This section details various ways to monitor and debug Grafana Agent Flow.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/monitor/controller_metrics/&#34;&gt;Monitor controller&lt;/a&gt;&lt;/li&gt;&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/monitor/component_metrics/&#34;&gt;Monitor components&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
]]></content><description>&lt;h1 id="how-to-monitor-grafana-agent-flow">How to monitor Grafana Agent Flow&lt;/h1>
&lt;p>This section details various ways to monitor and debug Grafana Agent Flow.&lt;/p>
&lt;ul>&lt;li>
&lt;a href="/docs/agent/v0.44/flow/tasks/monitor/controller_metrics/">Monitor controller&lt;/a>&lt;/li>&lt;li>
&lt;a href="/docs/agent/v0.44/flow/tasks/monitor/component_metrics/">Monitor components&lt;/a>&lt;/li>&lt;/ul></description></item><item><title>Collect and forward Prometheus metrics</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/collect-prometheus-metrics/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/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;You can configure Grafana Agent Flow 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.44/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.44/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.44/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 can 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.44/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.44/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.
After a &lt;code&gt;prometheus.remote_write&lt;/code&gt; component is defined, you can use other Grafana Agent Flow components 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;&amp;lt;LABEL&amp;gt;&amp;#34; {
  endpoint {
    url = &amp;#34;&amp;lt;PROMETHEUS_URL&amp;gt;&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component, such as &lt;code&gt;default&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;prometheus.remote_write&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;PROMETHEUS_URL&amp;gt;&lt;/code&gt;&lt;/em&gt; 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;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If your endpoint requires basic authentication, paste the following inside 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;&amp;lt;USERNAME&amp;gt;&amp;#34;
  password = &amp;#34;&amp;lt;PASSWORD&amp;gt;&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;USERNAME&amp;gt;&lt;/code&gt;&lt;/em&gt;: The basic authentication username.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;PASSWORD&amp;gt;&lt;/code&gt;&lt;/em&gt;: The basic authentication password or API key.&lt;/li&gt;
&lt;/ul&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;&amp;lt;REMOTE_WRITE_USERNAME&amp;gt;&amp;#34;)
      password = env(&amp;#34;&amp;lt;REMOTE_WRITE_PASSWORD&amp;gt;&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.44/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;&amp;lt;DISCOVERY_LABEL&amp;gt;&amp;#34; {
  role = &amp;#34;pod&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;DISCOVERY_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component, such as &lt;code&gt;pods&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;discovery.kubernetes&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This generates one Prometheus target for every exposed port on every discovered Pod.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To limit the Namespaces that Pods are discovered in, add the following block inside 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         = [&amp;lt;NAMESPACE_NAMES&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;NAMESPACE_NAMES&amp;gt;&lt;/code&gt;&lt;/em&gt;: 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;/li&gt;
&lt;/ul&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;To use a field selector to limit the number of discovered Pods, add the following block inside 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;&amp;lt;FIELD_SELECTOR&amp;gt;&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;FIELD_SELECTOR&amp;gt;&lt;/code&gt;&lt;/em&gt;: 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;/li&gt;
&lt;/ul&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;li&gt;
&lt;p&gt;To use a label selector to limit the number of discovered Pods, add the following block inside 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;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;LABEL_SELECTOR&amp;gt;&lt;/code&gt;&lt;/em&gt;: The Kubernetes label selector, 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;/li&gt;
&lt;/ul&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;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;&amp;lt;SCRAPE_LABEL&amp;gt;&amp;#34; {
  targets    = discovery.kubernetes.&amp;lt;DISCOVERY_LABEL&amp;gt;.targets
  forward_to = [prometheus.remote_write.&amp;lt;REMOTE_WRITE_LABEL&amp;gt;.receiver]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;SCRAPE_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component, such as &lt;code&gt;pods&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;prometheus.scrape&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;DISCOVERY_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the &lt;code&gt;discovery.kubernetes&lt;/code&gt; component.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;REMOTE_WRITE_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for your existing &lt;code&gt;prometheus.remote_write&lt;/code&gt; component.&lt;/li&gt;
&lt;/ul&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.44/flow/reference/components/discovery.kubernetes/&#34;&gt;discovery.kubernetes&lt;/a&gt; and 
    &lt;a href=&#34;/docs/agent/v0.44/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;You can configure Grafana Agent Flow 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;&amp;lt;DISCOVERY_LABEL&amp;gt;&amp;#34; {
  role = &amp;#34;service&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;DISCOVERY_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: A label for the component, such as &lt;code&gt;services&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;discovery.kubernetes&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This will generate one Prometheus target for every exposed port on every discovered Service.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To limit the Namespaces that Services are discovered in, add the following block inside 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         = [&amp;lt;NAMESPACE_NAMES&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;NAMESPACE_NAMES&amp;gt;&lt;/code&gt;&lt;/em&gt;: 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;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you don&amp;rsquo;t 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;To use a field selector to limit the number of discovered Services, add the following block inside 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;&amp;lt;FIELD_SELECTOR&amp;gt;&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;FIELD_SELECTOR&amp;gt;&lt;/code&gt;&lt;/em&gt;: The Kubernetes field selector, 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;/li&gt;
&lt;/ul&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;li&gt;
&lt;p&gt;To use a label selector to limit the number of discovered Services, add the following block inside 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;&amp;lt;LABEL_SELECTOR&amp;gt;&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;LABEL_SELECTOR&amp;gt;&lt;/code&gt;&lt;/em&gt;: The Kubernetes label selector, 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;/li&gt;
&lt;/ul&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;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;&amp;lt;SCRAPE_LABEL&amp;gt;&amp;#34; {
  targets    = discovery.kubernetes.&amp;lt;DISCOVERY_LABEL&amp;gt;.targets
  forward_to = [prometheus.remote_write.&amp;lt;REMOTE_WRITE_LABEL&amp;gt;.receiver]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;SCRAPE_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component, such as &lt;code&gt;services&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;prometeus.scrape&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;DISCOVERY_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the &lt;code&gt;discovery.kubernetes&lt;/code&gt; component.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;REMOTE_WRITE_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for your existing &lt;code&gt;prometheus.remote_write&lt;/code&gt; component.&lt;/li&gt;
&lt;/ul&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.44/flow/reference/components/discovery.kubernetes/&#34;&gt;discovery.kubernetes&lt;/a&gt; and 
    &lt;a href=&#34;/docs/agent/v0.44/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;You can configure Grafana Agent Flow 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;&amp;lt;SCRAPE_LABEL&amp;gt;&amp;#34; {
  targets    = [&amp;lt;TARGET_LIST&amp;gt;]
  forward_to = [prometheus.remote_write.&amp;lt;REMOTE_WRITE_LABEL&amp;gt;.receiver]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;_&lt;code&gt;&amp;lt;SCRAPE_LABEL&amp;gt;&lt;/code&gt;: The label for the component, such as &lt;code&gt;custom_targets&lt;/code&gt;.
The label you use 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;&lt;em&gt;&lt;code&gt;&amp;lt;TARGET_LIST&amp;gt;&lt;/code&gt;&lt;/em&gt;: A comma-delimited list of 
    &lt;a href=&#34;/docs/agent/v0.44/flow/concepts/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;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;/li&gt;
&lt;li&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 isn&amp;rsquo;t provided, the protocol to use is inherited by the settings of the &lt;code&gt;prometheus.scrape&lt;/code&gt; component. The default is &lt;code&gt;&amp;quot;http&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;li&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 isn&amp;rsquo;t provided, the path to use is inherited by the settings of the &lt;code&gt;prometheus.scrape&lt;/code&gt; component. The default is &lt;code&gt;&amp;quot;/metrics&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;li&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;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;&amp;lt;REMOTE_WRITE_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for your existing &lt;code&gt;prometheus.remote_write&lt;/code&gt; component.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&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>You can configure Grafana Agent Flow 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>Set up meta-monitoring</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/metamonitoring/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/metamonitoring/</guid><content><![CDATA[&lt;h1 id=&#34;set-up-meta-monitoring&#34;&gt;Set up meta-monitoring&lt;/h1&gt;
&lt;p&gt;You can configure Grafana Agent Flow to collect its own telemetry and forward it to the backend of your choosing.&lt;/p&gt;
&lt;p&gt;This topic describes how to collect and forward Grafana Agent Flow&amp;rsquo;s metrics, logs and traces data.&lt;/p&gt;
&lt;h2 id=&#34;components-and-configuration-blocks-used-in-this-topic&#34;&gt;Components and configuration blocks used in this topic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/components/prometheus.exporter.self/&#34;&gt;prometheus.exporter.self&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/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.44/flow/reference/config-blocks/logging/&#34;&gt;logging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/config-blocks/tracing/&#34;&gt;tracing&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;Identify where to send Grafana Agent Flow&amp;rsquo;s telemetry data.&lt;/li&gt;
&lt;li&gt;Be familiar with the concept of 
    &lt;a href=&#34;/docs/agent/v0.44/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; in Grafana Agent Flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;meta-monitoring-metrics&#34;&gt;Meta-monitoring metrics&lt;/h2&gt;
&lt;p&gt;Grafana Agent Flow exposes its internal metrics using the Prometheus exposition format.&lt;/p&gt;
&lt;p&gt;In this task, you will use the 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/components/prometheus.exporter.self/&#34;&gt;prometheus.exporter.self&lt;/a&gt; and 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/components/prometheus.scrape/&#34;&gt;prometheus.scrape&lt;/a&gt; components to scrape Grafana Agent Flow&amp;rsquo;s  internal metrics and forward it to compatible Grafana Agent Flow components.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;prometheus.exporter.self&lt;/code&gt; component to your configuration. The component accepts no arguments.&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.exporter.self &amp;#34;&amp;lt;SELF_LABEL&amp;gt;&amp;#34; {
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&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;&amp;lt;SCRAPE_LABEL&amp;gt;&amp;#34; {
  targets    = prometheus.exporter.&amp;lt;SELF_LABEL&amp;gt;.default.targets
  forward_to = [&amp;lt;METRICS_RECEIVER_LIST&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;SELF_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component such as &lt;code&gt;default&lt;/code&gt; or &lt;code&gt;metamonitoring&lt;/code&gt;. The label must be unique across all &lt;code&gt;prometheus.exporter.self&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;SCRAPE_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the scrape component such as &lt;code&gt;default&lt;/code&gt;. The label must be unique across all &lt;code&gt;prometheus.scrape&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;METRICS_RECEIVER_LIST&amp;gt;&lt;/code&gt;&lt;/em&gt;: A comma-delimited list of component receivers to forward metrics to.
For example, to send to an existing remote write component, use &lt;code&gt;prometheus.remote_write.WRITE_LABEL.receiver&lt;/code&gt;.
Similarly, to send data to an existing relabeling component, use &lt;code&gt;prometheus.relabel.PROCESS_LABEL.receiver&lt;/code&gt;.
To use data in the OTLP format, you can send data to an existing converter component, like &lt;code&gt;otelcol.receiver.prometheus.OTEL.receiver&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring a possible sequence of components.&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.exporter.self &amp;#34;default&amp;#34; {
}

prometheus.scrape &amp;#34;metamonitoring&amp;#34; {
  targets    = prometheus.exporter.self.default.targets
  forward_to = [prometheus.remote_write.default.receiver]
}

prometheus.remote_write &amp;#34;default&amp;#34; {
  endpoint {
    url = &amp;#34;http://mimir:9009/api/v1/push&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;meta-monitoring-logs&#34;&gt;Meta-monitoring logs&lt;/h2&gt;
&lt;p&gt;The 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/config-blocks/logging/&#34;&gt;logging&lt;/a&gt; block defines the logging behavior of Grafana Agent Flow.&lt;/p&gt;
&lt;p&gt;In this task, you will use the 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/config-blocks/logging/&#34;&gt;logging&lt;/a&gt; block to forward Grafana Agent Flow&amp;rsquo;s logs to a compatible component.
The block is specified without a label and can only be provided once per configuration file.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;logging&lt;/code&gt; configuration block to the top level of 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;logging {
  level    = &amp;#34;&amp;lt;LOG_LEVEL&amp;gt;&amp;#34;
  format   = &amp;#34;&amp;lt;LOG_FORMAT&amp;gt;&amp;#34;
  write_to = [&amp;lt;LOGS_RECEIVER_LIST&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;LOG_LEVEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The log level to use for Grafana Agent Flow&amp;rsquo;s logs. If the attribute isn&amp;rsquo;t set, it defaults to &lt;code&gt;info&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;LOG_FORMAT&amp;gt;&lt;/code&gt;&lt;/em&gt;: The log format to use for Grafana Agent Flow&amp;rsquo;s logs. If the attribute isn&amp;rsquo;t set, it defaults to &lt;code&gt;logfmt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;LOGS_RECEIVER_LIST&amp;gt;&lt;/code&gt;&lt;/em&gt;: A comma-delimited list of component receivers to forward logs to.
For example, to send to an existing processing component, use &lt;code&gt;loki.process.PROCESS_LABEL.receiver&lt;/code&gt;.
Similarly, to send data to an existing relabeling component, use &lt;code&gt;loki.relabel.PROCESS_LABEL.receiver&lt;/code&gt;.
To use data in the OTLP format, you can send data to an existing converter component, like &lt;code&gt;otelcol.receiver.loki.OTEL.receiver&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring the logging block and sending to a compatible 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;logging {
  level    = &amp;#34;warn&amp;#34;  
  format   = &amp;#34;json&amp;#34;
  write_to = [loki.write.default.receiver]
}

loki.write &amp;#34;default&amp;#34; {
  endpoint {
    url = &amp;#34;http://loki:3100/loki/api/v1/push&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;meta-monitoring-traces&#34;&gt;Meta-monitoring traces&lt;/h2&gt;
&lt;p&gt;The 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/config-blocks/tracing/&#34;&gt;tracing&lt;/a&gt; block defines the tracing behavior of Grafana Agent Flow.&lt;/p&gt;
&lt;p&gt;In this task you will use the 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/config-blocks/tracing/&#34;&gt;tracing&lt;/a&gt; block to forward Grafana Agent Flow internal traces to a compatible component. The block is specified without a label and can only be provided once per configuration file.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Add the following &lt;code&gt;tracing&lt;/code&gt; configuration block to the top level of 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;tracing {
  sampling_fraction = &amp;lt;SAMPLING_FRACTION&amp;gt;
  write_to          = [&amp;lt;TRACES_RECEIVER_LIST&amp;gt;]
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;SAMPLING_FRACTION&amp;gt;&lt;/code&gt;&lt;/em&gt;: The fraction of traces to keep. If the attribute isn&amp;rsquo;t set, it defaults to &lt;code&gt;0.1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;TRACES_RECEIVER_LIST&amp;gt;&lt;/code&gt;&lt;/em&gt;: A comma-delimited list of component receivers to forward traces to.
For example, to send to an existing OpenTelemetry exporter component use &lt;code&gt;otelcol.exporter.otlp.EXPORT_LABEL.input&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The following example demonstrates configuring the tracing block and sending to a compatible 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;tracing {
  sampling_fraction = 0.1
  write_to          = [otelcol.exporter.otlp.default.input]
}

otelcol.exporter.otlp &amp;#34;default&amp;#34; {
    client {
        endpoint = &amp;#34;tempo:4317&amp;#34;
    }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="set-up-meta-monitoring">Set up meta-monitoring&lt;/h1>
&lt;p>You can configure Grafana Agent Flow to collect its own telemetry and forward it to the backend of your choosing.&lt;/p>
&lt;p>This topic describes how to collect and forward Grafana Agent Flow&amp;rsquo;s metrics, logs and traces data.&lt;/p></description></item><item><title>Collect OpenTelemetry data</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/collect-opentelemetry-data/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/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.44/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.44/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.44/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.44/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.44/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 writes received telemetry data.&lt;/li&gt;
&lt;li&gt;Be familiar with the concept of 
    &lt;a href=&#34;/docs/agent/v0.44/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 (exporting) OpenTelemetry data to an external system.&lt;/p&gt;
&lt;p&gt;In this task, you will use the 
    &lt;a href=&#34;/docs/agent/v0.44/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).
After an exporter component is defined, you can use other Grafana Agent Flow components 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.44/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; for the full list of
&lt;code&gt;otelcol.exporter&lt;/code&gt; components that you can use 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;&amp;lt;EXPORTER_LABEL&amp;gt;&amp;#34; {
  client {
    url = &amp;#34;&amp;lt;HOST&amp;gt;:&amp;lt;PORT&amp;gt;&amp;#34;
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;EXPORTER_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component, such as &lt;code&gt;default&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;HOST&amp;gt;&lt;/code&gt;&lt;/em&gt;: The hostname or IP address of the server to send OTLP requests to.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;PORT&amp;gt;&lt;/code&gt;&lt;/em&gt;: The port of the server to send OTLP requests to.&lt;/li&gt;
&lt;/ul&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;&amp;lt;BASIC_AUTH_LABEL&amp;gt;&amp;#34; {
  username = &amp;#34;&amp;lt;USERNAME&amp;gt;&amp;#34;
  password = &amp;#34;&amp;lt;PASSWORD&amp;gt;&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;BASIC_AUTH_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component, such as &lt;code&gt;default&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;otelcol.auth.basic&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;USERNAME&amp;gt;&lt;/code&gt;&lt;/em&gt;: The basic authentication username.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;PASSWORD&amp;gt;&lt;/code&gt;&lt;/em&gt;: The basic authentication password or API key.&lt;/li&gt;
&lt;/ul&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.&amp;lt;BASIC_AUTH_LABEL&amp;gt;.handler&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;BASIC_AUTH_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the &lt;code&gt;otelcol.auth.basic&lt;/code&gt; component.&lt;/li&gt;
&lt;/ul&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 preceding steps,
but use the 
    &lt;a href=&#34;/docs/agent/v0.44/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 that 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.44/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 shouldn&amp;rsquo;t 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 data compression and reduce the number of outgoing network requests to external systems.&lt;/p&gt;
&lt;p&gt;In this task, you will configure an 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/components/otelcol.processor.batch/&#34;&gt;otelcol.processor.batch&lt;/a&gt; component to batch data before sending it to the exporter.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Refer to the list of available 
    &lt;a href=&#34;/docs/agent/v0.44/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; for the full list of
&lt;code&gt;otelcol.processor&lt;/code&gt; components that you can use 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;&amp;lt;PROCESSOR_LABEL&amp;gt;&amp;#34; {
  output {
    metrics = [otelcol.exporter.otlp.&amp;lt;EXPORTER_LABEL&amp;gt;.input]
    logs    = [otelcol.exporter.otlp.&amp;lt;EXPORTER_LABEL&amp;gt;.input]
    traces  = [otelcol.exporter.otlp.&amp;gt;EXPORTER_LABEL&amp;gt;.input]
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;PROCESSOR_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component, such as &lt;code&gt;default&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;otelcol.processor.batch&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;EXPORTER_LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for your existing &lt;code&gt;otelcol.exporter.otlp&lt;/code&gt; component.&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&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 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.44/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;You can configure Grafana Agent Flow 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, you will use the 
    &lt;a href=&#34;/docs/agent/v0.44/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).
You can configure a receiver component 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.44/flow/concepts/components/&#34;&gt;Components&lt;/a&gt; for the full list of
&lt;code&gt;otelcol.receiver&lt;/code&gt; components that you can use 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;&amp;lt;LABEL&amp;gt;&amp;#34; {
  output {
    metrics = [&amp;lt;COMPONENT_INPUT_LIST&amp;gt;]
    logs    = [&amp;lt;COMPONENT_INPUT_LIST&amp;gt;]
    traces  = [&amp;lt;COMPONENT_INPUT_LIST&amp;gt;]
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;LABEL&amp;gt;&lt;/code&gt;&lt;/em&gt;: The label for the component, such as &lt;code&gt;default&lt;/code&gt;.
The label you use must be unique across all &lt;code&gt;otelcol.receiver.otlp&lt;/code&gt; components in the same configuration file.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;COMPONENT_INPUT_LIST&amp;gt;&lt;/code&gt;&lt;/em&gt;: 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;/li&gt;
&lt;/ul&gt;
&lt;ol&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;&amp;lt;HOST&amp;gt;:4317&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;HOST&amp;gt;&lt;/code&gt;&lt;/em&gt;: A host to listen to traffic on. Use a narrowly scoped listen address whenever possible.
To listen on all network interfaces, replace &lt;em&gt;&lt;code&gt;&amp;lt;HOST&amp;gt;&lt;/code&gt;&lt;/em&gt; with &lt;code&gt;0.0.0.0&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&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;&amp;lt;HOST&amp;gt;:4318&amp;#34;
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;HOST&amp;gt;&lt;/code&gt;&lt;/em&gt;: The host to listen to traffic on. Use a narrowly scoped listen address whenever possible.
To listen on all network interfaces, replace &lt;em&gt;&lt;code&gt;&amp;lt;HOST&amp;gt;&lt;/code&gt;&lt;/em&gt; with &lt;code&gt;0.0.0.0&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&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.44/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>OpenTelemetry to Grafana stack</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/opentelemetry-to-lgtm-stack/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/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.44/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.44/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.44/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.44/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.44/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.44/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.44/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.44/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.44/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.44/flow/tasks/collect-opentelemetry-data/&#34;&gt;Collect open telemetry data&lt;/a&gt; task. 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 
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/collect-opentelemetry-data/&#34;&gt;Collect open telemetry data&lt;/a&gt; task.&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, you can do a passthrough from the
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/components/otelcol.exporter.loki/&#34;&gt;otelcol.exporter.loki&lt;/a&gt; component to
    &lt;a href=&#34;/docs/agent/v0.44/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.44/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 d-inline-block&#34;
  data-src=&#34;/media/docs/agent/loki-config.png&#34;
  alt=&#34;The Loki Details page showing information about the Loki configuration.&#34; width=&#34;1920&#34;
     height=&#34;1024&#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.44/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 d-inline-block&#34;
  data-src=&#34;/media/docs/agent//tempo-config.png&#34;
  alt=&#34;The Tempo Details page showing information about the Tempo configuration.&#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, you can do a passthrough from the 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/components/otelcol.exporter.prometheus/&#34;&gt;otelcol.exporter.prometheus&lt;/a&gt; to the 
    &lt;a href=&#34;/docs/agent/v0.44/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.44/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 d-inline-block&#34;
  data-src=&#34;/media/docs/agent/prometheus-config.png&#34;
  alt=&#34;The Prometheus Details page showing information about the Prometheus configuration.&#34; width=&#34;1920&#34;
     height=&#34;536&#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;, you need to reference the three exporters you 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 &lt;a href=&#34;http://localhost:12345/graph&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;http://localhost:12345/graph&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/agent/otlp-lgtm-graph.png&#34;
  alt=&#34;The Graph page showing a graphical representation of the pipeline.&#34; width=&#34;1876&#34;
     height=&#34;1302&#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.44/flow/tasks/configure-agent-clustering/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/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.44/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;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.44/flow/get-started/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 &lt;code&gt;values.yaml&lt;/code&gt; file to add &lt;code&gt;clustering.enabled=true&lt;/code&gt; inside 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 &amp;lt;RELEASE_NAME&amp;gt; -f values.yaml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Replace the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;&amp;lt;RELEASE_NAME&amp;gt;&lt;/code&gt;&lt;/em&gt;: The name of the installation you chose when you installed the Helm chart.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the Grafana Agent Flow 
    &lt;a href=&#34;/docs/agent/v0.44/flow/tasks/debug/#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.44/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.44/flow/tasks/distribute-prometheus-scrape-load/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/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.44/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;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.44/flow/tasks/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.44/flow/tasks/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.44/flow/tasks/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.44/flow/tasks/debug/#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.44/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><item><title>Debug issues with Grafana Agent Flow</title><link>https://grafana.com/docs/agent/v0.44/flow/tasks/debug/</link><pubDate>Wed, 29 Jan 2025 11:00:55 +0000</pubDate><guid>https://grafana.com/docs/agent/v0.44/flow/tasks/debug/</guid><content><![CDATA[&lt;h1 id=&#34;debug-hahahugoshortcode2334s0hbhb&#34;&gt;Debug Grafana Agent Flow&lt;/h1&gt;
&lt;p&gt;Follow these steps to debug issues with Grafana Agent Flow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use the Grafana Agent Flow UI to debug issues.&lt;/li&gt;
&lt;li&gt;If the Grafana Agent Flow UI doesn&amp;rsquo;t help with debugging an issue, logs can be examined instead.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;grafana-agent-flow-ui&#34;&gt;Grafana Agent Flow UI&lt;/h2&gt;
&lt;p&gt;Grafana Agent Flow includes an embedded UI viewable from the Grafana Agent HTTP server, which defaults to listening at &lt;code&gt;http://localhost:12345&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: For security reasons, installations of Grafana Agent Flow on non-containerized platforms default to listening on &lt;code&gt;localhost&lt;/code&gt;.
This default prevents other machines on the network from being able to view the UI.&lt;/p&gt;
&lt;p&gt;To expose the UI to other machines on the network on non-containerized platforms, refer to the documentation for how you 
    &lt;a href=&#34;/docs/agent/v0.44/flow/get-started/install/&#34;&gt;installed&lt;/a&gt; Grafana Agent Flow.&lt;/p&gt;
&lt;p&gt;If you are running a custom installation of Grafana Agent Flow,
refer to the documentation for [the &lt;code&gt;grafana-agent run&lt;/code&gt; command][grafana-agent run] to learn how to change the HTTP listen address,
and pass the appropriate flag when running Grafana Agent Flow.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h3 id=&#34;home-page&#34;&gt;Home page&lt;/h3&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/agent/ui_home_page.png&#34;
  alt=&#34;The Agent UI home page showing a table of components.&#34; width=&#34;1512&#34;
     height=&#34;804&#34;/&gt;&lt;/p&gt;
&lt;p&gt;The home page shows a table of components defined in the configuration file and their health.&lt;/p&gt;
&lt;p&gt;Click &lt;strong&gt;View&lt;/strong&gt; on a row in the table to navigate to the &lt;a href=&#34;#component-detail-page&#34;&gt;Component detail page&lt;/a&gt; for that component.&lt;/p&gt;
&lt;p&gt;Click the Grafana Agent logo to navigate back to the home page.&lt;/p&gt;
&lt;h3 id=&#34;graph-page&#34;&gt;Graph page&lt;/h3&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/agent/ui_graph_page.png&#34;
  alt=&#34;The Graph page showing a graph view of components.&#34; width=&#34;1512&#34;
     height=&#34;801&#34;/&gt;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Graph&lt;/strong&gt; page shows a graph view of components defined in the configuration file and their health.
Clicking a component in the graph navigates to the &lt;a href=&#34;#component-detail-page&#34;&gt;Component detail page&lt;/a&gt; for that component.&lt;/p&gt;
&lt;h3 id=&#34;component-detail-page&#34;&gt;Component detail page&lt;/h3&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/agent/ui_component_detail_page.png&#34;
  alt=&#34;The component detail page showing detailed information about the components.&#34; width=&#34;1512&#34;
     height=&#34;801&#34;/&gt;&lt;/p&gt;
&lt;p&gt;The component detail page shows the following information for each component:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The health of the component with a message explaining the health.&lt;/li&gt;
&lt;li&gt;The current evaluated arguments for the component.&lt;/li&gt;
&lt;li&gt;The current exports for the component.&lt;/li&gt;
&lt;li&gt;The current debug info for the component (if the component has debug info).&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;Values marked as a 
    &lt;a href=&#34;/docs/agent/v0.44/flow/concepts/config-language/expressions/types_and_values/#secrets.md&#34;&gt;secret&lt;/a&gt; are obfuscated and display as the text &lt;code&gt;(secret)&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h3 id=&#34;clustering-page&#34;&gt;Clustering page&lt;/h3&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/agent/ui_clustering_page.png&#34;
  alt=&#34;The Clustering page showing detailed information about each cluster node.&#34; width=&#34;2514&#34;
     height=&#34;959&#34;/&gt;&lt;/p&gt;
&lt;p&gt;The Clustering page shows the following information for each cluster node:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The node&amp;rsquo;s name.&lt;/li&gt;
&lt;li&gt;The node&amp;rsquo;s advertised address.&lt;/li&gt;
&lt;li&gt;The node&amp;rsquo;s current state (Viewer/Participant/Terminating).&lt;/li&gt;
&lt;li&gt;The local node that serves the UI.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;debugging-using-the-ui&#34;&gt;Debugging using the UI&lt;/h2&gt;
&lt;p&gt;To debug using the UI:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that no component is reported as unhealthy.&lt;/li&gt;
&lt;li&gt;Ensure that the arguments and exports for misbehaving components appear correct.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;examining-logs&#34;&gt;Examining logs&lt;/h2&gt;
&lt;p&gt;Logs may also help debug issues with Grafana Agent Flow.&lt;/p&gt;
&lt;p&gt;To reduce logging noise, many components hide debugging info behind debug-level log lines.
It is recommended that you configure the 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/config-blocks/logging/&#34;&gt;&lt;code&gt;logging&lt;/code&gt; block&lt;/a&gt; to show debug-level log lines when debugging issues with Grafana Agent Flow.&lt;/p&gt;
&lt;p&gt;The location of Grafana Agent Flow logs is different based on how it&amp;rsquo;s deployed.
Refer to the 
    &lt;a href=&#34;/docs/agent/v0.44/flow/reference/config-blocks/logging/&#34;&gt;&lt;code&gt;logging&lt;/code&gt; block&lt;/a&gt; page to see how to find logs for your system.&lt;/p&gt;
&lt;h2 id=&#34;debugging-clustering-issues&#34;&gt;Debugging clustering issues&lt;/h2&gt;
&lt;p&gt;To debug issues when using 
    &lt;a href=&#34;/docs/agent/v0.44/flow/concepts/clustering/&#34;&gt;clustering&lt;/a&gt;, check for the following symptoms.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cluster not converging&lt;/strong&gt;: The cluster peers aren&amp;rsquo;t converging on the same view of their peers&amp;rsquo; status.
This is most likely due to network connectivity issues between the cluster nodes.
Use the Grafana Agent Flow UI of each running peer to understand which nodes aren&amp;rsquo;t being picked up correctly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cluster split brain&lt;/strong&gt;: The cluster peers aren&amp;rsquo;t aware of one another, thinking they’re the only node present.
Again, check for network connectivity issues.
Check that the addresses or DNS names given to the node to join are correctly formatted and reachable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configuration drift&lt;/strong&gt;: Clustering assumes that all nodes are running with the same configuration file at roughly the same time.
Check the logs for issues with the reloaded configuration file as well as the graph page to verify changes have been applied.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Node name conflicts&lt;/strong&gt;: Clustering assumes all nodes have unique names.
Nodes with conflicting names are rejected and won&amp;rsquo;t join the cluster.
Look at the clustering UI page for the list of current peers with their names, and check the logs for any reported name conflict events.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Node stuck in terminating state&lt;/strong&gt;: The node attempted to gracefully shut down and set its state to Terminating, but it has not completely gone away.
Check the clustering page to view the state of the peers and verify that the terminating Grafana Agent has been shut down.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Some issues that appear to be clustering issues may be symptoms of other issues,
for example, problems with scraping or service discovery can result in missing
metrics for an agent that can be interpreted as a node not joining the cluster.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

]]></content><description>&lt;h1 id="debug-hahahugoshortcode2334s0hbhb">Debug Grafana Agent Flow&lt;/h1>
&lt;p>Follow these steps to debug issues with Grafana Agent Flow:&lt;/p>
&lt;ol>
&lt;li>Use the Grafana Agent Flow UI to debug issues.&lt;/li>
&lt;li>If the Grafana Agent Flow UI doesn&amp;rsquo;t help with debugging an issue, logs can be examined instead.&lt;/li>
&lt;/ol>
&lt;h2 id="grafana-agent-flow-ui">Grafana Agent Flow UI&lt;/h2>
&lt;p>Grafana Agent Flow includes an embedded UI viewable from the Grafana Agent HTTP server, which defaults to listening at &lt;code>http://localhost:12345&lt;/code>.&lt;/p></description></item></channel></rss>