<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Beyla quickstart guides on Grafana Labs</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/</link><description>Recent content in Beyla quickstart guides on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/beyla/v3.9.x/quickstart/index.xml" rel="self" type="application/rss+xml"/><item><title>Quickstart: instrument a C/C++ service with Beyla</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/cpp/</link><pubDate>Wed, 15 Apr 2026 16:46:57 +0000</pubDate><guid>https://grafana.com/docs/beyla/v3.9.x/quickstart/cpp/</guid><content><![CDATA[&lt;h1 id=&#34;quickstart-instrument-a-cc-service-with-beyla&#34;&gt;Quickstart: instrument a C/C&#43;&#43; service with Beyla&lt;/h1&gt;
&lt;h2 id=&#34;1-run-an-instrumentable-cc-service&#34;&gt;1. Run an instrumentable C/C&#43;&#43; service&lt;/h2&gt;
&lt;p&gt;Run an instrumentable C/C&#43;&#43; service or download and run a simple example &lt;a href=&#34;https://github.com/grafana/beyla/tree/main/examples/quickstart/cpp&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;C&#43;&#43; HTTP service&lt;/a&gt;.&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;curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/cpp/httplib.h
curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/cpp/quickstart.cpp
g&amp;#43;&amp;#43; -std=c&amp;#43;&amp;#43;11 quickstart.cpp -o quickstart &amp;amp;&amp;amp; ./quickstart&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If necessary, replace the &lt;code&gt;g&#43;&#43;&lt;/code&gt; command by another compiler supporting C&#43;&#43;11.&lt;/p&gt;
&lt;h2 id=&#34;2-download-beyla&#34;&gt;2. Download Beyla&lt;/h2&gt;
&lt;p&gt;Download the latest Beyla executable from the &lt;a href=&#34;https://github.com/grafana/beyla/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla releases page&lt;/a&gt;. Uncompress and copy the Beyla executable to any location in your &lt;code&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;3-optional-get-grafana-cloud-credentials&#34;&gt;3. (Optional) get Grafana Cloud credentials&lt;/h2&gt;
&lt;p&gt;Beyla can export metrics and traces to any OpenTelemetry endpoint, as well as exposing metrics as a Prometheus endpoint. However, we recommend using the OpenTelemetry endpoint in Grafana Cloud. You can get a &lt;a href=&#34;/pricing/&#34;&gt;Free Grafana Cloud Account at Grafana&amp;rsquo;s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the Grafana Cloud Portal, look for the &lt;strong&gt;OpenTelemetry&lt;/strong&gt; box and click &lt;strong&gt;Configure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otel-cloud-portal-box.png&#34;
  alt=&#34;OpenTelemetry Grafana Cloud portal&#34; width=&#34;1002&#34;
     height=&#34;312&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Under &lt;strong&gt;Password / API token&lt;/strong&gt; click &lt;strong&gt;Generate now&lt;/strong&gt; and follow the instructions to create a default API token.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Environment Variables&lt;/strong&gt; will be populated with a set of standard OpenTelemetry environment variables which will provide the connection endpoint and credentials information for Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otlp-connection-headers.png&#34;
  alt=&#34;OTLP connection headers&#34; width=&#34;1592&#34;
     height=&#34;998&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Copy the &lt;strong&gt;Environment Variables&lt;/strong&gt; and keep it for the next step.&lt;/p&gt;
&lt;h2 id=&#34;4-run-beyla-with-minimal-configuration&#34;&gt;4. Run Beyla with minimal configuration&lt;/h2&gt;
&lt;p&gt;To run Beyla, first set the following environment variables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;OTEL_EXPORTER_OTLP_PROTOCOL&lt;/code&gt;, &lt;code&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/code&gt; and &lt;code&gt;OTEL_EXPORTER_OTLP_HEADERS&lt;/code&gt; variables copied from the previous step.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEYLA_OPEN_PORT&lt;/code&gt;: the port the instrumented service is using (for example, &lt;code&gt;80&lt;/code&gt; or &lt;code&gt;443&lt;/code&gt;). If using the example service in the first section of this guide, set this variable to &lt;code&gt;8080&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To facilitate local testing, set the &lt;code&gt;BEYLA_TRACE_PRINTER=text&lt;/code&gt; environment variable. When this option is set, Beyla prints traces in text format to the standard output.&lt;/p&gt;
&lt;p&gt;Notice: Beyla requires elevated privileges. Running with &lt;code&gt;sudo&lt;/code&gt; is the simplest approach. For more restrictive environments, Beyla can run with specific Linux capabilities. Refer to &lt;a href=&#34;../../security/&#34;&gt;Security, permissions and capabilities&lt;/a&gt; for details on the required capabilities for your use case.&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;sh&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-sh&#34;&gt;export BEYLA_OPEN_PORT=8080
export BEYLA_TRACE_PRINTER=text
export OTEL_EXPORTER_OTLP_PROTOCOL=&amp;#34;http/protobuf&amp;#34;
export OTEL_EXPORTER_OTLP_ENDPOINT=&amp;#34;https://otlp-gateway-prod-eu-west-0.grafana.net/otlp&amp;#34;
export OTEL_EXPORTER_OTLP_HEADERS=&amp;#34;Authorization=Basic ...your-encoded-credentials...&amp;#34;
sudo -E beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;5-test-the-service&#34;&gt;5. Test the service&lt;/h2&gt;
&lt;p&gt;With Beyla and the service running, make HTTP requests to the instrumented service:&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;curl http://localhost:8080/foo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Beyla should output traces to the standard output similar to 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;2024-01-09 10:31:33.19103133 (3.254486ms[3.254486ms]) 200 GET /foo [127.0.0.1]-&amp;gt;[127.0.0.1:8080]
size:80B svc=[{quickstart  generic lima-ubuntu-lts-5074}] traceparent=[00-46214bd23716280eef43cf798dbe5522-0000000000000000-01]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above trace shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;2024-01-09 10:31:33.19103133&lt;/code&gt;: time of the trace&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(3.254486ms[3.254486ms])&lt;/code&gt;: total response time for the request&lt;/li&gt;
&lt;li&gt;&lt;code&gt;200 GET /foo&lt;/code&gt;: response code, HTTP method, and URL path&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[127.0.0.1]-&amp;gt;[127.0.0.1:8080]&lt;/code&gt; source and destination &lt;code&gt;host:port&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;size:80B&lt;/code&gt;: size of the HTTP request (sum of the headers and the body)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;svc=[{quickstart  generic lima-ubuntu-lts-5074}]&lt;/code&gt;: &lt;code&gt;quickstart&lt;/code&gt; service, using the generic kernel-based instrumenter, with an automatically created service instance name &lt;code&gt;lima-ubuntu-lts-5074&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceparent&lt;/code&gt; as received by the parent request, or a new random one if the parent request didn&amp;rsquo;t specify it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After a few minutes traces will appear in Grafana Cloud. For example, in the traces explorer:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/trace-generic.png&#34;
  alt=&#34;Beyla traces explorer&#34; width=&#34;1298&#34;
     height=&#34;1134&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;6-configure-routing&#34;&gt;6. Configure routing&lt;/h2&gt;
&lt;p&gt;The exposed span name in Grafana Cloud is a generic &lt;code&gt;GET /**&lt;/code&gt;, where it should say something like &lt;code&gt;GET /foo&lt;/code&gt; (the path of the
test request URL).&lt;/p&gt;
&lt;p&gt;Beyla groups any unknown URL path as &lt;code&gt;/**&lt;/code&gt; to avoid unexpected cardinality explosions.&lt;/p&gt;
&lt;p&gt;Configure routing to tell Beyla about expected routes.&lt;/p&gt;
&lt;p&gt;For this quickstart, let Beyla to heuristically group the routes.&lt;/p&gt;
&lt;p&gt;First, create a &lt;code&gt;config.yml&lt;/code&gt; file with the following content:&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;yml&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-yml&#34;&gt;routes:
  unmatched: heuristic&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Then, run Beyla with the &lt;code&gt;-config&lt;/code&gt; argument (or use the &lt;code&gt;BEYLA_CONFIG_PATH&lt;/code&gt; environment variable instead):&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;sudo -E beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Finally, make HTTP requests:&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;curl http://localhost:8080/foo
curl http://localhost:8080/user/1234
curl http://localhost:8080/user/5678&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana will now heuristically assign a route to each trace. &lt;code&gt;/foo&lt;/code&gt; got its own route while &lt;code&gt;/user/1234&lt;/code&gt; and
&lt;code&gt;/user/5678&lt;/code&gt; were grouped into the &lt;code&gt;/user/*&lt;/code&gt; route.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/grouped-traces.png&#34;
  alt=&#34;Beyla grouped traces&#34; width=&#34;1476&#34;
     height=&#34;346&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Get more details of the different &lt;a href=&#34;../../configure/&#34;&gt;Beyla configuration options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn how to deploy Beyla as a &lt;a href=&#34;../../setup/docker/&#34;&gt;Docker container&lt;/a&gt; or as a &lt;a href=&#34;../../setup/kubernetes/&#34;&gt;Kubernetes DaemonSet or sidecar&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="quickstart-instrument-a-cc-service-with-beyla">Quickstart: instrument a C/C++ service with Beyla&lt;/h1>
&lt;h2 id="1-run-an-instrumentable-cc-service">1. Run an instrumentable C/C++ service&lt;/h2>
&lt;p>Run an instrumentable C/C++ service or download and run a simple example &lt;a href="https://github.com/grafana/beyla/tree/main/examples/quickstart/cpp" target="_blank" rel="noopener noreferrer">C++ HTTP service&lt;/a>.&lt;/p></description></item><item><title>Quickstart: instrument a Go service with Beyla</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/golang/</link><pubDate>Wed, 15 Apr 2026 16:46:57 +0000</pubDate><guid>https://grafana.com/docs/beyla/v3.9.x/quickstart/golang/</guid><content><![CDATA[&lt;h1 id=&#34;quickstart-instrument-a-go-service-with-beyla&#34;&gt;Quickstart: instrument a Go service with Beyla&lt;/h1&gt;
&lt;h2 id=&#34;1-run-an-instrumentable-go-service&#34;&gt;1. Run an instrumentable Go service&lt;/h2&gt;
&lt;p&gt;Run an instrumentable Go service or download and run a simple example &lt;a href=&#34;https://github.com/grafana/beyla/tree/main/examples/quickstart/golang&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go HTTP service&lt;/a&gt;.&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;curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/golang/quickstart.go
go run quickstart.go&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;2-download-beyla&#34;&gt;2. Download Beyla&lt;/h2&gt;
&lt;p&gt;Download the latest Beyla executable from the &lt;a href=&#34;https://github.com/grafana/beyla/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla releases page&lt;/a&gt;.
Uncompress and copy the Beyla executable to any location in your &lt;code&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As an alternative (if your host has the Go toolset installed), you can directly download the
Beyla executable with the &lt;code&gt;go install&lt;/code&gt; command:&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;sh&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-sh&#34;&gt;go install github.com/grafana/beyla/cmd/beyla@latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;3-optional-get-grafana-cloud-credentials&#34;&gt;3. (Optional) get Grafana Cloud credentials&lt;/h2&gt;
&lt;p&gt;Beyla can export metrics and traces to any OpenTelemetry endpoint, as well as exposing metrics as a Prometheus endpoint. However, we recommend using the OpenTelemetry endpoint in Grafana Cloud. You can get a &lt;a href=&#34;/pricing/&#34;&gt;Free Grafana Cloud Account at Grafana&amp;rsquo;s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the Grafana Cloud Portal, look for the &lt;strong&gt;OpenTelemetry&lt;/strong&gt; box and click &lt;strong&gt;Configure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otel-cloud-portal-box.png&#34;
  alt=&#34;OpenTelemetry Grafana Cloud portal&#34; width=&#34;1002&#34;
     height=&#34;312&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Under &lt;strong&gt;Password / API token&lt;/strong&gt; click &lt;strong&gt;Generate now&lt;/strong&gt; and follow the instructions to create a default API token.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Environment Variables&lt;/strong&gt; will be populated with a set of standard OpenTelemetry environment variables which will provide the connection endpoint and credentials information for Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otlp-connection-headers.png&#34;
  alt=&#34;OTLP connection headers&#34; width=&#34;1592&#34;
     height=&#34;998&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Copy the &lt;strong&gt;Environment Variables&lt;/strong&gt; and keep it for the next step.&lt;/p&gt;
&lt;h2 id=&#34;4-run-beyla-with-minimal-configuration&#34;&gt;4. Run Beyla with minimal configuration&lt;/h2&gt;
&lt;p&gt;To run Beyla, first set the following environment variables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;OTEL_EXPORTER_OTLP_PROTOCOL&lt;/code&gt;, &lt;code&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/code&gt; and &lt;code&gt;OTEL_EXPORTER_OTLP_HEADERS&lt;/code&gt;
variables copied from the previous step.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEYLA_OPEN_PORT&lt;/code&gt;: the port the instrumented service is using
(for example, &lt;code&gt;80&lt;/code&gt; or &lt;code&gt;443&lt;/code&gt;). If using the example service in the
first section of this guide, set this variable to &lt;code&gt;8080&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To facilitate local testing, set the &lt;code&gt;BEYLA_TRACE_PRINTER=text&lt;/code&gt; environment variable. When this option is set, Beyla prints traces in text format to the standard output.&lt;/p&gt;
&lt;p&gt;Notice: Beyla requires elevated privileges. Running with &lt;code&gt;sudo&lt;/code&gt; is the simplest approach. For more restrictive environments, Beyla can run with specific Linux capabilities. Refer to &lt;a href=&#34;../../security/&#34;&gt;Security, permissions and capabilities&lt;/a&gt; for details on the required capabilities for your use case.&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;sh&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-sh&#34;&gt;export BEYLA_OPEN_PORT=8080
export BEYLA_TRACE_PRINTER=text
export OTEL_EXPORTER_OTLP_PROTOCOL=&amp;#34;http/protobuf&amp;#34;
export OTEL_EXPORTER_OTLP_ENDPOINT=&amp;#34;https://otlp-gateway-prod-eu-west-0.grafana.net/otlp&amp;#34;
export OTEL_EXPORTER_OTLP_HEADERS=&amp;#34;Authorization=Basic ...your-encoded-credentials...&amp;#34;
sudo -E beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;5-test-the-service&#34;&gt;5. Test the service&lt;/h2&gt;
&lt;p&gt;With Beyla and the service running, make HTTP requests to the instrumented service:&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;curl http://localhost:8080/foo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Beyla should output traces to the standard output similar to 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;2024-01-08 14:06:14.182614 (432.191µs[80.421µs]) 200 GET /foo [127.0.0.1]-&amp;gt;[localhost:8080]
size:0B svc=[{quickstart  go lima-ubuntu-lts-8222}] traceparent=[00-0f82735dab5798dfbf7f7a26d5df827b-0000000000000000-01]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above trace shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;2024-01-08 14:06:14.182614&lt;/code&gt;: time of the trace&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(432.191µs[80.421µs])&lt;/code&gt;: total response time for the request, with the actual internal execution
time of the request (not counting the request enqueuing time)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;200 GET /foo&lt;/code&gt;: response code, HTTP method, and URL path&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[127.0.0.1]-&amp;gt;[localhost:8080]&lt;/code&gt; source and destination host:port&lt;/li&gt;
&lt;li&gt;&lt;code&gt;size:0B&lt;/code&gt;: size of the HTTP request body (0 bytes, as it was a &lt;code&gt;GET&lt;/code&gt; request).
For non-go programs, this size would also include the size of the request headers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;svc=[{quickstart  go lima-ubuntu-lts-8222}]&lt;/code&gt;: &lt;code&gt;quickstart&lt;/code&gt; service, written
in Go, with an automatically created service instance name &lt;code&gt;lima-ubuntu-lts-8222&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceparent&lt;/code&gt; as received by the parent request, or a new random one if the parent request didn&amp;rsquo;t specify it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After a few minutes traces will appear in Grafana Cloud. For example, in the traces explorer:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/trace.png&#34;
  alt=&#34;Beyla traces explorer&#34; width=&#34;1372&#34;
     height=&#34;1246&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;6-configure-routing&#34;&gt;6. Configure routing&lt;/h2&gt;
&lt;p&gt;The exposed span name in Grafana Cloud is a generic &lt;code&gt;GET /**&lt;/code&gt;, where it should say something like &lt;code&gt;GET /foo&lt;/code&gt; (the path of the
test request URL).&lt;/p&gt;
&lt;p&gt;Beyla groups any unknown URL path as &lt;code&gt;/**&lt;/code&gt; to avoid unexpected cardinality explosions.&lt;/p&gt;
&lt;p&gt;Configure routing to tell Beyla about expected routes.&lt;/p&gt;
&lt;p&gt;For this quickstart, let Beyla to heuristically group the routes.&lt;/p&gt;
&lt;p&gt;First, create a &lt;code&gt;config.yml&lt;/code&gt; file with the following content:&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;yml&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-yml&#34;&gt;routes:
  unmatched: heuristic&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Then, run Beyla with the &lt;code&gt;-config&lt;/code&gt; argument (or use the &lt;code&gt;BEYLA_CONFIG_PATH&lt;/code&gt; environment variable instead):&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;sudo -E beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Finally, make HTTP requests:&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;curl http://localhost:8080/foo
curl http://localhost:8080/user/1234
curl http://localhost:8080/user/5678&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana will now heuristically assign a route to each trace. &lt;code&gt;/foo&lt;/code&gt; got its own route while &lt;code&gt;/user/1234&lt;/code&gt; and
&lt;code&gt;/user/5678&lt;/code&gt; were grouped into the &lt;code&gt;/user/*&lt;/code&gt; route.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/grouped-traces.png&#34;
  alt=&#34;Beyla grouped traces&#34; width=&#34;1476&#34;
     height=&#34;346&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Get more details of the different &lt;a href=&#34;../../configure/&#34;&gt;Beyla configuration options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn how to deploy Beyla as a &lt;a href=&#34;../../setup/docker/&#34;&gt;Docker container&lt;/a&gt; or as a &lt;a href=&#34;../../setup/kubernetes/&#34;&gt;Kubernetes DaemonSet or sidecar&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="quickstart-instrument-a-go-service-with-beyla">Quickstart: instrument a Go service with Beyla&lt;/h1>
&lt;h2 id="1-run-an-instrumentable-go-service">1. Run an instrumentable Go service&lt;/h2>
&lt;p>Run an instrumentable Go service or download and run a simple example &lt;a href="https://github.com/grafana/beyla/tree/main/examples/quickstart/golang" target="_blank" rel="noopener noreferrer">Go HTTP service&lt;/a>.&lt;/p></description></item><item><title>Quickstart: instrument a Java service with Beyla</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/java/</link><pubDate>Wed, 15 Apr 2026 16:46:57 +0000</pubDate><guid>https://grafana.com/docs/beyla/v3.9.x/quickstart/java/</guid><content><![CDATA[&lt;h1 id=&#34;quickstart-instrument-a-java-service-with-beyla&#34;&gt;Quickstart: instrument a Java service with Beyla&lt;/h1&gt;
&lt;h2 id=&#34;1-run-an-instrumentable-java-service&#34;&gt;1. Run an instrumentable Java service&lt;/h2&gt;
&lt;p&gt;Run an instrumentable Java service or download and run a simple example &lt;a href=&#34;https://github.com/grafana/beyla/tree/main/examples/quickstart/java&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Java HTTP service&lt;/a&gt;.&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;curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/java/Quickstart.java
javac Quickstart.java &amp;amp;&amp;amp; java Quickstart&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;2-download-beyla&#34;&gt;2. Download Beyla&lt;/h2&gt;
&lt;p&gt;Download the latest Beyla executable from the &lt;a href=&#34;https://github.com/grafana/beyla/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla releases page&lt;/a&gt;. Uncompress and copy the Beyla executable to any location in your &lt;code&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;3-optional-get-grafana-cloud-credentials&#34;&gt;3. (Optional) get Grafana Cloud credentials&lt;/h2&gt;
&lt;p&gt;Beyla can export metrics and traces to any OpenTelemetry endpoint, as well as exposing metrics as a Prometheus endpoint. However, we recommend using the OpenTelemetry endpoint in Grafana Cloud. You can get a &lt;a href=&#34;/pricing/&#34;&gt;Free Grafana Cloud Account at Grafana&amp;rsquo;s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the Grafana Cloud Portal, look for the &lt;strong&gt;OpenTelemetry&lt;/strong&gt; box and click &lt;strong&gt;Configure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otel-cloud-portal-box.png&#34;
  alt=&#34;OpenTelemetry Grafana Cloud portal&#34; width=&#34;1002&#34;
     height=&#34;312&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Under &lt;strong&gt;Password / API token&lt;/strong&gt; click &lt;strong&gt;Generate now&lt;/strong&gt; and follow the instructions to create a default API token.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Environment Variables&lt;/strong&gt; will be populated with a set of standard OpenTelemetry environment variables which will provide the connection endpoint and credentials information for Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otlp-connection-headers.png&#34;
  alt=&#34;OTLP connection headers&#34; width=&#34;1592&#34;
     height=&#34;998&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Copy the &lt;strong&gt;Environment Variables&lt;/strong&gt; and keep it for the next step.&lt;/p&gt;
&lt;h2 id=&#34;4-run-beyla-with-minimal-configuration&#34;&gt;4. Run Beyla with minimal configuration&lt;/h2&gt;
&lt;p&gt;To run Beyla, first set the following environment variables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;OTEL_EXPORTER_OTLP_PROTOCOL&lt;/code&gt;, &lt;code&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/code&gt; and &lt;code&gt;OTEL_EXPORTER_OTLP_HEADERS&lt;/code&gt; variables copied from the previous step.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEYLA_OPEN_PORT&lt;/code&gt;: the port the instrumented service is using (for example, &lt;code&gt;80&lt;/code&gt; or &lt;code&gt;443&lt;/code&gt;). If using the example service in the first section of this guide, set this variable to &lt;code&gt;8080&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To facilitate local testing, set the &lt;code&gt;BEYLA_TRACE_PRINTER=text&lt;/code&gt; environment variable. When this option is set, Beyla prints traces in text format to the standard output.&lt;/p&gt;
&lt;p&gt;Notice: Beyla requires elevated privileges. Running with &lt;code&gt;sudo&lt;/code&gt; is the simplest approach. For more restrictive environments, Beyla can run with specific Linux capabilities. Refer to &lt;a href=&#34;../../security/&#34;&gt;Security, permissions and capabilities&lt;/a&gt; for details on the required capabilities for your use case.&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;sh&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-sh&#34;&gt;export BEYLA_OPEN_PORT=8080
export BEYLA_TRACE_PRINTER=text
export OTEL_EXPORTER_OTLP_PROTOCOL=&amp;#34;http/protobuf&amp;#34;
export OTEL_EXPORTER_OTLP_ENDPOINT=&amp;#34;https://otlp-gateway-prod-eu-west-0.grafana.net/otlp&amp;#34;
export OTEL_EXPORTER_OTLP_HEADERS=&amp;#34;Authorization=Basic ...your-encoded-credentials...&amp;#34;
sudo -E beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;5-test-the-service&#34;&gt;5. Test the service&lt;/h2&gt;
&lt;p&gt;With Beyla and the service running, make HTTP requests to the instrumented service:&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;curl http://localhost:8080/foo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Beyla should output traces to the standard output similar to 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;2024-01-09 10:31:33.19103133 (3.254486ms[3.254486ms]) 200 GET /foo [127.0.0.1]-&amp;gt;[127.0.0.1:8080]
size:80B svc=[{quickstart java lima-ubuntu-lts-5074}] traceparent=[00-46214bd23716280eef43cf798dbe5522-0000000000000000-01]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above trace shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;2024-01-09 10:31:33.19103133&lt;/code&gt;: time of the trace&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(3.254486ms[3.254486ms])&lt;/code&gt;: total response time for the request&lt;/li&gt;
&lt;li&gt;&lt;code&gt;200 GET /foo&lt;/code&gt;: response code, HTTP method, and URL path&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[127.0.0.1]-&amp;gt;[127.0.0.1:8080]&lt;/code&gt; source and destination &lt;code&gt;host:port&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;size:80B&lt;/code&gt;: size of the HTTP request (sum of the headers and the body)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;svc=[{quickstart java lima-ubuntu-lts-5074}]&lt;/code&gt;: &lt;code&gt;quickstart&lt;/code&gt; service, running in a &lt;code&gt;java&lt;/code&gt; VM, with an automatically created service instance name &lt;code&gt;lima-ubuntu-lts-5074&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceparent&lt;/code&gt; as received by the parent request, or a new random one if the parent request didn&amp;rsquo;t specify it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After a few minutes traces will appear in Grafana Cloud. For example, in the traces explorer:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/trace-generic.png&#34;
  alt=&#34;Beyla traces explorer&#34; width=&#34;1298&#34;
     height=&#34;1134&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;6-configure-routing&#34;&gt;6. Configure routing&lt;/h2&gt;
&lt;p&gt;The exposed span name in Grafana Cloud is a generic &lt;code&gt;GET /**&lt;/code&gt;, where it should say something like &lt;code&gt;GET /foo&lt;/code&gt; (the path of the
test request URL).&lt;/p&gt;
&lt;p&gt;Beyla groups any unknown URL path as &lt;code&gt;/**&lt;/code&gt; to avoid unexpected cardinality explosions.&lt;/p&gt;
&lt;p&gt;Configure routing to tell Beyla about expected routes.&lt;/p&gt;
&lt;p&gt;For this quickstart, let Beyla to heuristically group the routes.&lt;/p&gt;
&lt;p&gt;First, create a &lt;code&gt;config.yml&lt;/code&gt; file with the following content:&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;yml&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-yml&#34;&gt;routes:
  unmatched: heuristic&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Then, run Beyla with the &lt;code&gt;-config&lt;/code&gt; argument:&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;sudo -E beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Finally, make HTTP requests:&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;curl http://localhost:8080/foo
curl http://localhost:8080/user/1234
curl http://localhost:8080/user/5678&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana will now heuristically assign a route to each trace. &lt;code&gt;/foo&lt;/code&gt; got its own route while &lt;code&gt;/user/1234&lt;/code&gt; and
&lt;code&gt;/user/5678&lt;/code&gt; were grouped into the &lt;code&gt;/user/*&lt;/code&gt; route.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/grouped-traces.png&#34;
  alt=&#34;Beyla grouped traces&#34; width=&#34;1476&#34;
     height=&#34;346&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Get more details of the different &lt;a href=&#34;../../configure/&#34;&gt;Beyla configuration options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn how to deploy Beyla as a &lt;a href=&#34;../../setup/docker/&#34;&gt;Docker container&lt;/a&gt; or as a &lt;a href=&#34;../../setup/kubernetes/&#34;&gt;Kubernetes DaemonSet or sidecar&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="quickstart-instrument-a-java-service-with-beyla">Quickstart: instrument a Java service with Beyla&lt;/h1>
&lt;h2 id="1-run-an-instrumentable-java-service">1. Run an instrumentable Java service&lt;/h2>
&lt;p>Run an instrumentable Java service or download and run a simple example &lt;a href="https://github.com/grafana/beyla/tree/main/examples/quickstart/java" target="_blank" rel="noopener noreferrer">Java HTTP service&lt;/a>.&lt;/p></description></item><item><title>Quickstart: instrument a Node.js service with Beyla</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/nodejs/</link><pubDate>Wed, 15 Apr 2026 16:46:57 +0000</pubDate><guid>https://grafana.com/docs/beyla/v3.9.x/quickstart/nodejs/</guid><content><![CDATA[&lt;h1 id=&#34;quickstart-instrument-a-nodejs-service-with-beyla&#34;&gt;Quickstart: instrument a Node.js service with Beyla&lt;/h1&gt;
&lt;h2 id=&#34;1-run-an-instrumentable-nodejs-service&#34;&gt;1. Run an instrumentable Node.js service&lt;/h2&gt;
&lt;p&gt;Run an instrumentable Node.js service or download and run a simple example &lt;a href=&#34;https://github.com/grafana/beyla/tree/main/examples/quickstart/nodejs&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Node.js HTTP service&lt;/a&gt;.&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;curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/nodejs/package.json
curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/nodejs/quickstart.js
npm install &amp;amp;&amp;amp; npm start&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;2-download-beyla&#34;&gt;2. Download Beyla&lt;/h2&gt;
&lt;p&gt;Download the latest Beyla executable from the &lt;a href=&#34;https://github.com/grafana/beyla/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla releases page&lt;/a&gt;.
Uncompress and copy the Beyla executable to any location in your &lt;code&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;3-optional-get-grafana-cloud-credentials&#34;&gt;3. (Optional) get Grafana Cloud credentials&lt;/h2&gt;
&lt;p&gt;Beyla can export metrics and traces to any OpenTelemetry endpoint, as well as exposing metrics as a Prometheus endpoint. However, we recommend using the OpenTelemetry endpoint in Grafana Cloud. You can get a &lt;a href=&#34;/pricing/&#34;&gt;Free Grafana Cloud Account at Grafana&amp;rsquo;s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the Grafana Cloud Portal, look for the &lt;strong&gt;OpenTelemetry&lt;/strong&gt; box and click &lt;strong&gt;Configure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otel-cloud-portal-box.png&#34;
  alt=&#34;OpenTelemetry Grafana Cloud portal&#34; width=&#34;1002&#34;
     height=&#34;312&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Under &lt;strong&gt;Password / API token&lt;/strong&gt; click &lt;strong&gt;Generate now&lt;/strong&gt; and follow the instructions to create a default API token.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Environment Variables&lt;/strong&gt; will be populated with a set of standard OpenTelemetry environment variables which will provide the connection endpoint and credentials information for Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otlp-connection-headers.png&#34;
  alt=&#34;OTLP connection headers&#34; width=&#34;1592&#34;
     height=&#34;998&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Copy the &lt;strong&gt;Environment Variables&lt;/strong&gt; and keep it for the next step.&lt;/p&gt;
&lt;h2 id=&#34;4-run-beyla-with-minimal-configuration&#34;&gt;4. Run Beyla with minimal configuration&lt;/h2&gt;
&lt;p&gt;To run Beyla, first set the following environment variables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;OTEL_EXPORTER_OTLP_PROTOCOL&lt;/code&gt;, &lt;code&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/code&gt; and &lt;code&gt;OTEL_EXPORTER_OTLP_HEADERS&lt;/code&gt;
variables copied from the previous step.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEYLA_OPEN_PORT&lt;/code&gt;: the port the instrumented service is using
(for example, &lt;code&gt;80&lt;/code&gt; or &lt;code&gt;443&lt;/code&gt;). If using the example service in the
first section of this guide, set this variable to &lt;code&gt;8080&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To facilitate local testing, set the &lt;code&gt;BEYLA_TRACE_PRINTER=text&lt;/code&gt; environment variable. When this option is set, Beyla prints traces in text format to the standard output.&lt;/p&gt;
&lt;p&gt;Beyla automatically reports the name of the process executable as service name: &lt;code&gt;node&lt;/code&gt;.
To override it, refer to the &lt;a href=&#34;../configure/service-discovery#override-service-name-and-namespace&#34;&gt;override service name and namespace&lt;/a&gt;
documentation section.&lt;/p&gt;
&lt;p&gt;Notice: Beyla requires elevated privileges. Running with &lt;code&gt;sudo&lt;/code&gt; is the simplest approach. For more restrictive environments, Beyla can run with specific Linux capabilities. Refer to &lt;a href=&#34;../../security/&#34;&gt;Security, permissions and capabilities&lt;/a&gt; for details on the required capabilities for your use case.&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;sh&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-sh&#34;&gt;export BEYLA_OPEN_PORT=8080
export BEYLA_TRACE_PRINTER=text
export OTEL_EXPORTER_OTLP_PROTOCOL=&amp;#34;http/protobuf&amp;#34;
export OTEL_EXPORTER_OTLP_ENDPOINT=&amp;#34;https://otlp-gateway-prod-eu-west-0.grafana.net/otlp&amp;#34;
export OTEL_EXPORTER_OTLP_HEADERS=&amp;#34;Authorization=Basic ...your-encoded-credentials...&amp;#34;
sudo -E beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;5-test-the-service&#34;&gt;5. Test the service&lt;/h2&gt;
&lt;p&gt;With Beyla and the service running, make HTTP requests to the instrumented service:&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;curl http://localhost:8080/foo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Beyla should output traces to the standard output similar to 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;2024-01-09 10:31:33.19103133 (3.254486ms[3.254486ms]) 200 GET /foo [127.0.0.1]-&amp;gt;[127.0.0.1:8080]
size:80B svc=[{quickstart nodejs lima-ubuntu-lts-5074}] traceparent=[00-46214bd23716280eef43cf798dbe5522-0000000000000000-01]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above trace shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;2024-01-09 10:31:33.19103133&lt;/code&gt;: time of the trace&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(3.254486ms[3.254486ms])&lt;/code&gt;: total response time for the request&lt;/li&gt;
&lt;li&gt;&lt;code&gt;200 GET /foo&lt;/code&gt;: response code, HTTP method, and URL path&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[127.0.0.1]-&amp;gt;[127.0.0.1:8080]&lt;/code&gt; source and destination host:port&lt;/li&gt;
&lt;li&gt;&lt;code&gt;size:80B&lt;/code&gt;: size of the HTTP request (sum of the headers and the body)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;svc=[{quickstart nodejs lima-ubuntu-lts-5074}]&lt;/code&gt;: &lt;code&gt;quickstart&lt;/code&gt; service, running in
Node.js, with an automatically created service instance name
&lt;code&gt;lima-ubuntu-lts-5074&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceparent&lt;/code&gt; as received by the parent request, or a new random one if the parent request
didn&amp;rsquo;t specify it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After a few minutes traces will appear in Grafana Cloud. For example, in the traces explorer:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/trace-generic.png&#34;
  alt=&#34;Beyla traces explorer&#34; width=&#34;1298&#34;
     height=&#34;1134&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;6-configure-routing&#34;&gt;6. Configure routing&lt;/h2&gt;
&lt;p&gt;The exposed span name in Grafana Cloud is a generic &lt;code&gt;GET /**&lt;/code&gt;, where it should say something like &lt;code&gt;GET /foo&lt;/code&gt; (the path of the
test request URL).&lt;/p&gt;
&lt;p&gt;Beyla groups any unknown URL path as &lt;code&gt;/**&lt;/code&gt; to avoid unexpected cardinality explosions.&lt;/p&gt;
&lt;p&gt;Configure routing to tell Beyla about expected routes.&lt;/p&gt;
&lt;p&gt;For this quickstart, let Beyla to heuristically group the routes.&lt;/p&gt;
&lt;p&gt;First, create a &lt;code&gt;config.yml&lt;/code&gt; file with the following content:&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;yml&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-yml&#34;&gt;routes:
  unmatched: heuristic&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Then, run Beyla with the &lt;code&gt;-config&lt;/code&gt; argument (or use the &lt;code&gt;BEYLA_CONFIG_PATH&lt;/code&gt; environment variable instead):&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;sudo -E beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Finally, make HTTP requests:&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;curl http://localhost:8080/foo
curl http://localhost:8080/user/1234
curl http://localhost:8080/user/5678&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana will now heuristically assign a route to each trace. &lt;code&gt;/foo&lt;/code&gt; got its own route while &lt;code&gt;/user/1234&lt;/code&gt; and
&lt;code&gt;/user/5678&lt;/code&gt; were grouped into the &lt;code&gt;/user/*&lt;/code&gt; route.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/grouped-traces.png&#34;
  alt=&#34;Beyla grouped traces&#34; width=&#34;1476&#34;
     height=&#34;346&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Get more details of the different &lt;a href=&#34;../../configure/&#34;&gt;Beyla configuration options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn how to deploy Beyla as a &lt;a href=&#34;../../setup/docker/&#34;&gt;Docker container&lt;/a&gt; or as a &lt;a href=&#34;../../setup/kubernetes/&#34;&gt;Kubernetes DaemonSet or sidecar&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="quickstart-instrument-a-nodejs-service-with-beyla">Quickstart: instrument a Node.js service with Beyla&lt;/h1>
&lt;h2 id="1-run-an-instrumentable-nodejs-service">1. Run an instrumentable Node.js service&lt;/h2>
&lt;p>Run an instrumentable Node.js service or download and run a simple example &lt;a href="https://github.com/grafana/beyla/tree/main/examples/quickstart/nodejs" target="_blank" rel="noopener noreferrer">Node.js HTTP service&lt;/a>.&lt;/p></description></item><item><title>Quickstart: instrument a Python service with Beyla</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/python/</link><pubDate>Wed, 15 Apr 2026 16:46:57 +0000</pubDate><guid>https://grafana.com/docs/beyla/v3.9.x/quickstart/python/</guid><content><![CDATA[&lt;h1 id=&#34;quickstart-instrument-a-python-service-with-beyla&#34;&gt;Quickstart: instrument a Python service with Beyla&lt;/h1&gt;
&lt;h2 id=&#34;1-run-an-instrumentable-python-service&#34;&gt;1. Run an instrumentable Python service&lt;/h2&gt;
&lt;p&gt;Run an instrumentable Python service or download and run a simple example &lt;a href=&#34;https://github.com/grafana/beyla/tree/main/examples/quickstart/python&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Python HTTP service&lt;/a&gt;.&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;curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/python/quickstart.py
python3 quickstart.py&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;2-download-beyla&#34;&gt;2. Download Beyla&lt;/h2&gt;
&lt;p&gt;Download the latest Beyla executable from the &lt;a href=&#34;https://github.com/grafana/beyla/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla releases page&lt;/a&gt;.
Uncompress and copy the Beyla executable to any location in your &lt;code&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;3-optional-get-grafana-cloud-credentials&#34;&gt;3. (Optional) get Grafana Cloud credentials&lt;/h2&gt;
&lt;p&gt;Beyla can export metrics and traces to any OpenTelemetry endpoint, as well as exposing metrics as a Prometheus endpoint. However, we recommend using the OpenTelemetry endpoint in Grafana Cloud. You can get a &lt;a href=&#34;/pricing/&#34;&gt;Free Grafana Cloud Account at Grafana&amp;rsquo;s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the Grafana Cloud Portal, look for the &lt;strong&gt;OpenTelemetry&lt;/strong&gt; box and click &lt;strong&gt;Configure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otel-cloud-portal-box.png&#34;
  alt=&#34;OpenTelemetry Grafana Cloud portal&#34; width=&#34;1002&#34;
     height=&#34;312&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Under &lt;strong&gt;Password / API token&lt;/strong&gt; click &lt;strong&gt;Generate now&lt;/strong&gt; and follow the instructions to create a default API token.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Environment Variables&lt;/strong&gt; will be populated with a set of standard OpenTelemetry environment variables which will provide the connection endpoint and credentials information for Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otlp-connection-headers.png&#34;
  alt=&#34;OTLP connection headers&#34; width=&#34;1592&#34;
     height=&#34;998&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Copy the &lt;strong&gt;Environment Variables&lt;/strong&gt; and keep it for the next step.&lt;/p&gt;
&lt;h2 id=&#34;4-run-beyla-with-minimal-configuration&#34;&gt;4. Run Beyla with minimal configuration&lt;/h2&gt;
&lt;p&gt;To run Beyla, first set the following environment variables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;OTEL_EXPORTER_OTLP_PROTOCOL&lt;/code&gt;, &lt;code&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/code&gt; and &lt;code&gt;OTEL_EXPORTER_OTLP_HEADERS&lt;/code&gt;
variables copied from the previous step.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEYLA_OPEN_PORT&lt;/code&gt;: the port the instrumented service is using
(for example, &lt;code&gt;80&lt;/code&gt; or &lt;code&gt;443&lt;/code&gt;). If using the example service in the
first section of this guide, set this variable to &lt;code&gt;8080&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To facilitate local testing, set the &lt;code&gt;BEYLA_TRACE_PRINTER=text&lt;/code&gt; environment variable. When this option is set, Beyla prints traces in text format to the standard output.&lt;/p&gt;
&lt;p&gt;Beyla automatically reports the name of the process executable as service name: &lt;code&gt;python3&lt;/code&gt;.
To override it, refer to the &lt;a href=&#34;../configure/service-discovery#override-service-name-and-namespace&#34;&gt;override service name and namespace&lt;/a&gt;
documentation section.&lt;/p&gt;
&lt;p&gt;Notice: Beyla requires elevated privileges. Running with &lt;code&gt;sudo&lt;/code&gt; is the simplest approach. For more restrictive environments, Beyla can run with specific Linux capabilities. Refer to &lt;a href=&#34;../../security/&#34;&gt;Security, permissions and capabilities&lt;/a&gt; for details on the required capabilities for your use case.&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;sh&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-sh&#34;&gt;export BEYLA_OPEN_PORT=8080
export BEYLA_TRACE_PRINTER=text
export OTEL_EXPORTER_OTLP_PROTOCOL=&amp;#34;http/protobuf&amp;#34;
export OTEL_EXPORTER_OTLP_ENDPOINT=&amp;#34;https://otlp-gateway-prod-eu-west-0.grafana.net/otlp&amp;#34;
export OTEL_EXPORTER_OTLP_HEADERS=&amp;#34;Authorization=Basic ...your-encoded-credentials...&amp;#34;
sudo -E beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;5-test-the-service&#34;&gt;5. Test the service&lt;/h2&gt;
&lt;p&gt;With Beyla and the service running, make HTTP requests to the instrumented service:&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;curl http://localhost:8080/foo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Beyla should output traces to the standard output similar to 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;2024-01-09 10:31:33.19103133 (3.254486ms[3.254486ms]) 200 GET /foo [127.0.0.1]-&amp;gt;[127.0.0.1:8080]
size:80B svc=[{quickstart python lima-ubuntu-lts-5074}] traceparent=[00-46214bd23716280eef43cf798dbe5522-0000000000000000-01]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above trace shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;2024-01-09 10:31:33.19103133&lt;/code&gt;: time of the trace&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(3.254486ms[3.254486ms])&lt;/code&gt;: total response time for the request&lt;/li&gt;
&lt;li&gt;&lt;code&gt;200 GET /foo&lt;/code&gt;: response code, HTTP method, and URL path&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[127.0.0.1]-&amp;gt;[127.0.0.1:8080]&lt;/code&gt; source and destination host:port&lt;/li&gt;
&lt;li&gt;&lt;code&gt;size:80B&lt;/code&gt;: size of the HTTP request (sum of the headers and the body)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;svc=[{quickstart python lima-ubuntu-lts-5074}]&lt;/code&gt;: &lt;code&gt;quickstart&lt;/code&gt; service, running in
Python, with an automatically created service instance name
&lt;code&gt;lima-ubuntu-lts-5074&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceparent&lt;/code&gt; as received by the parent request, or a new random one if the parent request
didn&amp;rsquo;t specify it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After a few minutes traces will appear in Grafana Cloud. For example, in the traces explorer:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/trace-generic.png&#34;
  alt=&#34;Beyla traces explorer&#34; width=&#34;1298&#34;
     height=&#34;1134&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;6-configure-routing&#34;&gt;6. Configure routing&lt;/h2&gt;
&lt;p&gt;The exposed span name in Grafana Cloud is a generic &lt;code&gt;GET /**&lt;/code&gt;, where it should say something like &lt;code&gt;GET /foo&lt;/code&gt; (the path of the
test request URL).&lt;/p&gt;
&lt;p&gt;Beyla groups any unknown URL path as &lt;code&gt;/**&lt;/code&gt; to avoid unexpected cardinality explosions.&lt;/p&gt;
&lt;p&gt;Configure routing to tell Beyla about expected routes.&lt;/p&gt;
&lt;p&gt;For this quickstart, let Beyla to heuristically group the routes.&lt;/p&gt;
&lt;p&gt;First, create a &lt;code&gt;config.yml&lt;/code&gt; file with the following content:&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;yml&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-yml&#34;&gt;routes:
  unmatched: heuristic&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Then, run Beyla with the &lt;code&gt;-config&lt;/code&gt; argument (or use the &lt;code&gt;BEYLA_CONFIG_PATH&lt;/code&gt; environment variable instead):&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;sudo -E beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Finally, make HTTP requests:&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;curl http://localhost:8080/foo
curl http://localhost:8080/user/1234
curl http://localhost:8080/user/5678&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana will now heuristically assign a route to each trace. &lt;code&gt;/foo&lt;/code&gt; got its own route while &lt;code&gt;/user/1234&lt;/code&gt; and
&lt;code&gt;/user/5678&lt;/code&gt; were grouped into the &lt;code&gt;/user/*&lt;/code&gt; route.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/grouped-traces.png&#34;
  alt=&#34;Beyla grouped traces&#34; width=&#34;1476&#34;
     height=&#34;346&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Get more details of the different &lt;a href=&#34;../../configure/&#34;&gt;Beyla configuration options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn how to deploy Beyla as a &lt;a href=&#34;../../setup/docker/&#34;&gt;Docker container&lt;/a&gt; or as a &lt;a href=&#34;../../setup/kubernetes/&#34;&gt;Kubernetes DaemonSet or sidecar&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="quickstart-instrument-a-python-service-with-beyla">Quickstart: instrument a Python service with Beyla&lt;/h1>
&lt;h2 id="1-run-an-instrumentable-python-service">1. Run an instrumentable Python service&lt;/h2>
&lt;p>Run an instrumentable Python service or download and run a simple example &lt;a href="https://github.com/grafana/beyla/tree/main/examples/quickstart/python" target="_blank" rel="noopener noreferrer">Python HTTP service&lt;/a>.&lt;/p></description></item><item><title>Quickstart: instrument a Ruby service with Beyla</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/ruby/</link><pubDate>Wed, 15 Apr 2026 16:46:57 +0000</pubDate><guid>https://grafana.com/docs/beyla/v3.9.x/quickstart/ruby/</guid><content><![CDATA[&lt;h1 id=&#34;quickstart-instrument-a-ruby-service-with-beyla&#34;&gt;Quickstart: instrument a Ruby service with Beyla&lt;/h1&gt;
&lt;h2 id=&#34;1-run-an-instrumentable-ruby-service&#34;&gt;1. Run an instrumentable Ruby service&lt;/h2&gt;
&lt;p&gt;Run an instrumentable Ruby service or download and run a simple example &lt;a href=&#34;https://github.com/grafana/beyla/tree/main/examples/quickstart/ruby&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Ruby HTTP service&lt;/a&gt;.&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;curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/ruby/quickstart.rb
ruby quickstart.rb&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;2-download-beyla&#34;&gt;2. Download Beyla&lt;/h2&gt;
&lt;p&gt;Download the latest Beyla executable from the &lt;a href=&#34;https://github.com/grafana/beyla/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla releases page&lt;/a&gt;.
Uncompress and copy the Beyla executable to any location in your &lt;code&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;3-optional-get-grafana-cloud-credentials&#34;&gt;3. (Optional) get Grafana Cloud credentials&lt;/h2&gt;
&lt;p&gt;Beyla can export metrics and traces to any OpenTelemetry endpoint, as well as exposing metrics as a Prometheus endpoint. However, we recommend using the OpenTelemetry endpoint in Grafana Cloud. You can get a &lt;a href=&#34;/pricing/&#34;&gt;Free Grafana Cloud Account at Grafana&amp;rsquo;s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the Grafana Cloud Portal, look for the &lt;strong&gt;OpenTelemetry&lt;/strong&gt; box and click &lt;strong&gt;Configure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otel-cloud-portal-box.png&#34;
  alt=&#34;OpenTelemetry Grafana Cloud portal&#34; width=&#34;1002&#34;
     height=&#34;312&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Under &lt;strong&gt;Password / API token&lt;/strong&gt; click &lt;strong&gt;Generate now&lt;/strong&gt; and follow the instructions to create a default API token.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Environment Variables&lt;/strong&gt; will be populated with a set of standard OpenTelemetry environment variables which will provide the connection endpoint and credentials information for Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otlp-connection-headers.png&#34;
  alt=&#34;OTLP connection headers&#34; width=&#34;1592&#34;
     height=&#34;998&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Copy the &lt;strong&gt;Environment Variables&lt;/strong&gt; and keep it for the next step.&lt;/p&gt;
&lt;h2 id=&#34;4-run-beyla-with-minimal-configuration&#34;&gt;4. Run Beyla with minimal configuration&lt;/h2&gt;
&lt;p&gt;To run Beyla, first set the following environment variables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;OTEL_EXPORTER_OTLP_PROTOCOL&lt;/code&gt;, &lt;code&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/code&gt; and &lt;code&gt;OTEL_EXPORTER_OTLP_HEADERS&lt;/code&gt;
variables copied from the previous step.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEYLA_OPEN_PORT&lt;/code&gt;: the port the instrumented service is using
(for example, &lt;code&gt;80&lt;/code&gt; or &lt;code&gt;443&lt;/code&gt;). If using the example service in the
first section of this guide, set this variable to &lt;code&gt;8080&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To facilitate local testing, set the &lt;code&gt;BEYLA_TRACE_PRINTER=text&lt;/code&gt; environment variable. When this option is set, Beyla prints traces in text format to the standard output.&lt;/p&gt;
&lt;p&gt;Beyla automatically reports the name of the process executable as service name: &lt;code&gt;ruby&lt;/code&gt;.
To override it, refer to the &lt;a href=&#34;../configure/service-discovery#override-service-name-and-namespace&#34;&gt;override service name and namespace&lt;/a&gt;
documentation section.&lt;/p&gt;
&lt;p&gt;Notice: Beyla requires elevated privileges. Running with &lt;code&gt;sudo&lt;/code&gt; is the simplest approach. For more restrictive environments, Beyla can run with specific Linux capabilities. Refer to &lt;a href=&#34;../../security/&#34;&gt;Security, permissions and capabilities&lt;/a&gt; for details on the required capabilities for your use case.&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;sh&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-sh&#34;&gt;export BEYLA_OPEN_PORT=8080
export BEYLA_TRACE_PRINTER=text
export OTEL_EXPORTER_OTLP_PROTOCOL=&amp;#34;http/protobuf&amp;#34;
export OTEL_EXPORTER_OTLP_ENDPOINT=&amp;#34;https://otlp-gateway-prod-eu-west-0.grafana.net/otlp&amp;#34;
export OTEL_EXPORTER_OTLP_HEADERS=&amp;#34;Authorization=Basic ...your-encoded-credentials...&amp;#34;
sudo -E beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;5-test-the-service&#34;&gt;5. Test the service&lt;/h2&gt;
&lt;p&gt;With Beyla and the service running, make HTTP requests to the instrumented service:&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;curl http://localhost:8080/foo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Beyla should output traces to the standard output similar to 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;2024-01-09 10:31:33.19103133 (3.254486ms[3.254486ms]) 200 GET /foo [127.0.0.1]-&amp;gt;[127.0.0.1:8080]
size:80B svc=[{quickstart ruby lima-ubuntu-lts-5074}] traceparent=[00-46214bd23716280eef43cf798dbe5522-0000000000000000-01]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above trace shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;2024-01-09 10:31:33.19103133&lt;/code&gt;: time of the trace&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(3.254486ms[3.254486ms])&lt;/code&gt;: total response time for the request&lt;/li&gt;
&lt;li&gt;&lt;code&gt;200 GET /foo&lt;/code&gt;: response code, HTTP method, and URL path&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[127.0.0.1]-&amp;gt;[127.0.0.1:8080]&lt;/code&gt; source and destination host:port&lt;/li&gt;
&lt;li&gt;&lt;code&gt;size:80B&lt;/code&gt;: size of the HTTP request (sum of the headers and the body)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;svc=[{quickstart ruby lima-ubuntu-lts-5074}]&lt;/code&gt;: &lt;code&gt;quickstart&lt;/code&gt; service, running in
Ruby, with an automatically created service instance name
&lt;code&gt;lima-ubuntu-lts-5074&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceparent&lt;/code&gt; as received by the parent request, or a new random one if the parent request
didn&amp;rsquo;t specify it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After a few minutes traces will appear in Grafana Cloud. For example, in the traces explorer:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/trace-generic.png&#34;
  alt=&#34;Beyla traces explorer&#34; width=&#34;1298&#34;
     height=&#34;1134&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;6-configure-routing&#34;&gt;6. Configure routing&lt;/h2&gt;
&lt;p&gt;The exposed span name in Grafana Cloud is a generic &lt;code&gt;GET /**&lt;/code&gt;, where it should say something like &lt;code&gt;GET /foo&lt;/code&gt; (the path of the
test request URL).&lt;/p&gt;
&lt;p&gt;Beyla groups any unknown URL path as &lt;code&gt;/**&lt;/code&gt; to avoid unexpected cardinality explosions.&lt;/p&gt;
&lt;p&gt;Configure routing to tell Beyla about expected routes.&lt;/p&gt;
&lt;p&gt;For this quickstart, let Beyla to heuristically group the routes.&lt;/p&gt;
&lt;p&gt;First, create a &lt;code&gt;config.yml&lt;/code&gt; file with the following content:&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;yml&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-yml&#34;&gt;routes:
  unmatched: heuristic&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Then, run Beyla with the &lt;code&gt;-config&lt;/code&gt; argument (or use the &lt;code&gt;BEYLA_CONFIG_PATH&lt;/code&gt; environment variable instead):&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;sudo -E beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Finally, make HTTP requests:&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;curl http://localhost:8080/foo
curl http://localhost:8080/user/1234
curl http://localhost:8080/user/5678&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana will now heuristically assign a route to each trace. &lt;code&gt;/foo&lt;/code&gt; got its own route while &lt;code&gt;/user/1234&lt;/code&gt; and
&lt;code&gt;/user/5678&lt;/code&gt; were grouped into the &lt;code&gt;/user/*&lt;/code&gt; route.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/grouped-traces.png&#34;
  alt=&#34;Beyla grouped traces&#34; width=&#34;1476&#34;
     height=&#34;346&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Get more details of the different &lt;a href=&#34;../../configure/&#34;&gt;Beyla configuration options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn how to deploy Beyla as a &lt;a href=&#34;../../setup/docker/&#34;&gt;Docker container&lt;/a&gt; or as a &lt;a href=&#34;../../setup/kubernetes/&#34;&gt;Kubernetes DaemonSet or sidecar&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="quickstart-instrument-a-ruby-service-with-beyla">Quickstart: instrument a Ruby service with Beyla&lt;/h1>
&lt;h2 id="1-run-an-instrumentable-ruby-service">1. Run an instrumentable Ruby service&lt;/h2>
&lt;p>Run an instrumentable Ruby service or download and run a simple example &lt;a href="https://github.com/grafana/beyla/tree/main/examples/quickstart/ruby" target="_blank" rel="noopener noreferrer">Ruby HTTP service&lt;/a>.&lt;/p></description></item><item><title>Quickstart: instrument a Rust service with Beyla</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/rust/</link><pubDate>Wed, 15 Apr 2026 16:46:57 +0000</pubDate><guid>https://grafana.com/docs/beyla/v3.9.x/quickstart/rust/</guid><content><![CDATA[&lt;h1 id=&#34;quickstart-instrument-a-rust-service-with-beyla&#34;&gt;Quickstart: instrument a Rust service with Beyla&lt;/h1&gt;
&lt;h2 id=&#34;1-run-an-instrumentable-rust-service&#34;&gt;1. Run an instrumentable Rust service&lt;/h2&gt;
&lt;p&gt;Run an instrumentable Rust service or download and run a simple example &lt;a href=&#34;https://github.com/grafana/beyla/tree/main/examples/quickstart/rust&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Rust HTTP service&lt;/a&gt;.&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;curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/rust/quickstart.rs
rustc quickstart.rs &amp;amp;&amp;amp; ./quickstart&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;2-download-beyla&#34;&gt;2. Download Beyla&lt;/h2&gt;
&lt;p&gt;Download the latest Beyla executable from the &lt;a href=&#34;https://github.com/grafana/beyla/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Beyla releases page&lt;/a&gt;. Uncompress and copy the Beyla executable to any location in your &lt;code&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;3-optional-get-grafana-cloud-credentials&#34;&gt;3. (Optional) get Grafana Cloud credentials&lt;/h2&gt;
&lt;p&gt;Beyla can export metrics and traces to any OpenTelemetry endpoint, as well as exposing metrics as a Prometheus endpoint. However, we recommend using the OpenTelemetry endpoint in Grafana Cloud. You can get a &lt;a href=&#34;/pricing/&#34;&gt;Free Grafana Cloud Account at Grafana&amp;rsquo;s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the Grafana Cloud Portal, look for the &lt;strong&gt;OpenTelemetry&lt;/strong&gt; box and click &lt;strong&gt;Configure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otel-cloud-portal-box.png&#34;
  alt=&#34;OpenTelemetry Grafana Cloud portal&#34; width=&#34;1002&#34;
     height=&#34;312&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Under &lt;strong&gt;Password / API token&lt;/strong&gt; click &lt;strong&gt;Generate now&lt;/strong&gt; and follow the instructions to create a default API token.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Environment Variables&lt;/strong&gt; will be populated with a set of standard OpenTelemetry environment variables which will provide the connection endpoint and credentials information for Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otlp-connection-headers.png&#34;
  alt=&#34;OTLP connection headers&#34; width=&#34;1592&#34;
     height=&#34;998&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Copy the &lt;strong&gt;Environment Variables&lt;/strong&gt; and keep it for the next step.&lt;/p&gt;
&lt;h2 id=&#34;4-run-beyla-with-minimal-configuration&#34;&gt;4. Run Beyla with minimal configuration&lt;/h2&gt;
&lt;p&gt;To run Beyla, first set the following environment variables:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;OTEL_EXPORTER_OTLP_PROTOCOL&lt;/code&gt;, &lt;code&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/code&gt; and &lt;code&gt;OTEL_EXPORTER_OTLP_HEADERS&lt;/code&gt; variables copied from the previous step.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;BEYLA_OPEN_PORT&lt;/code&gt;: the port the instrumented service is using (for example, &lt;code&gt;80&lt;/code&gt; or &lt;code&gt;443&lt;/code&gt;). If using the example service in the first section of this guide, set this variable to &lt;code&gt;8080&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To facilitate local testing, set the &lt;code&gt;BEYLA_TRACE_PRINTER=text&lt;/code&gt; environment variable. When this option is set, Beyla prints traces in text format to the standard output.&lt;/p&gt;
&lt;p&gt;Notice: Beyla requires elevated privileges. Running with &lt;code&gt;sudo&lt;/code&gt; is the simplest approach. For more restrictive environments, Beyla can run with specific Linux capabilities. Refer to &lt;a href=&#34;../../security/&#34;&gt;Security, permissions and capabilities&lt;/a&gt; for details on the required capabilities for your use case.&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;sh&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-sh&#34;&gt;export BEYLA_OPEN_PORT=8080
export BEYLA_TRACE_PRINTER=text
export OTEL_EXPORTER_OTLP_PROTOCOL=&amp;#34;http/protobuf&amp;#34;
export OTEL_EXPORTER_OTLP_ENDPOINT=&amp;#34;https://otlp-gateway-prod-eu-west-0.grafana.net/otlp&amp;#34;
export OTEL_EXPORTER_OTLP_HEADERS=&amp;#34;Authorization=Basic ...your-encoded-credentials...&amp;#34;
sudo -E beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;5-test-the-service&#34;&gt;5. Test the service&lt;/h2&gt;
&lt;p&gt;With Beyla and the service running, make HTTP requests to the instrumented service:&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;curl http://localhost:8080/foo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Beyla should output traces to the standard output similar to 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;2024-01-09 10:31:33.19103133 (3.254486ms[3.254486ms]) 200 GET /foo [127.0.0.1]-&amp;gt;[127.0.0.1:8080]
size:80B svc=[{quickstart  rust lima-ubuntu-lts-5074}] traceparent=[00-46214bd23716280eef43cf798dbe5522-0000000000000000-01]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above trace shows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;2024-01-09 10:31:33.19103133&lt;/code&gt;: time of the trace&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(3.254486ms[3.254486ms])&lt;/code&gt;: total response time for the request&lt;/li&gt;
&lt;li&gt;&lt;code&gt;200 GET /foo&lt;/code&gt;: response code, HTTP method, and URL path&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[127.0.0.1]-&amp;gt;[127.0.0.1:8080]&lt;/code&gt; source and destination &lt;code&gt;host:port&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;size:80B&lt;/code&gt;: size of the HTTP request (sum of the headers and the body)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;svc=[{quickstart rust lima-ubuntu-lts-5074}]&lt;/code&gt;: &lt;code&gt;quickstart&lt;/code&gt; service, written in &lt;code&gt;rust&lt;/code&gt;, with an automatically created service instance name &lt;code&gt;lima-ubuntu-lts-5074&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traceparent&lt;/code&gt; as received by the parent request, or a new random one if the parent request didn&amp;rsquo;t specify it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After a few minutes traces will appear in Grafana Cloud. For example, in the traces explorer:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/trace-generic.png&#34;
  alt=&#34;Beyla traces explorer&#34; width=&#34;1298&#34;
     height=&#34;1134&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;6-configure-routing&#34;&gt;6. Configure routing&lt;/h2&gt;
&lt;p&gt;The exposed span name in Grafana Cloud is a generic &lt;code&gt;GET /**&lt;/code&gt;, where it should say something like &lt;code&gt;GET /foo&lt;/code&gt; (the path of the
test request URL).&lt;/p&gt;
&lt;p&gt;Beyla groups any unknown URL path as &lt;code&gt;/**&lt;/code&gt; to avoid unexpected cardinality explosions.&lt;/p&gt;
&lt;p&gt;Configure routing to tell Beyla about expected routes.&lt;/p&gt;
&lt;p&gt;For this quickstart, let Beyla to heuristically group the routes.&lt;/p&gt;
&lt;p&gt;First, create a &lt;code&gt;config.yml&lt;/code&gt; file with the following content:&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;yml&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-yml&#34;&gt;routes:
  unmatched: heuristic&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Then, run Beyla with the &lt;code&gt;-config&lt;/code&gt; argument (or use the &lt;code&gt;BEYLA_CONFIG_PATH&lt;/code&gt; environment variable instead):&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;sudo -E beyla -config config.yml&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Finally, make HTTP requests:&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;curl http://localhost:8080/foo
curl http://localhost:8080/user/1234
curl http://localhost:8080/user/5678&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Grafana will now heuristically assign a route to each trace. &lt;code&gt;/foo&lt;/code&gt; got its own route while &lt;code&gt;/user/1234&lt;/code&gt; and
&lt;code&gt;/user/5678&lt;/code&gt; were grouped into the &lt;code&gt;/user/*&lt;/code&gt; route.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/grouped-traces.png&#34;
  alt=&#34;Beyla grouped traces&#34; width=&#34;1476&#34;
     height=&#34;346&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Get more details of the different &lt;a href=&#34;../../configure/&#34;&gt;Beyla configuration options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Learn how to deploy Beyla as a &lt;a href=&#34;../../setup/docker/&#34;&gt;Docker container&lt;/a&gt; or as a &lt;a href=&#34;../../setup/kubernetes/&#34;&gt;Kubernetes DaemonSet or sidecar&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="quickstart-instrument-a-rust-service-with-beyla">Quickstart: instrument a Rust service with Beyla&lt;/h1>
&lt;h2 id="1-run-an-instrumentable-rust-service">1. Run an instrumentable Rust service&lt;/h2>
&lt;p>Run an instrumentable Rust service or download and run a simple example &lt;a href="https://github.com/grafana/beyla/tree/main/examples/quickstart/rust" target="_blank" rel="noopener noreferrer">Rust HTTP service&lt;/a>.&lt;/p></description></item><item><title>Beyla and Kubernetes quickstart</title><link>https://grafana.com/docs/beyla/v3.9.x/quickstart/kubernetes/</link><pubDate>Wed, 15 Apr 2026 16:46:57 +0000</pubDate><guid>https://grafana.com/docs/beyla/v3.9.x/quickstart/kubernetes/</guid><content><![CDATA[&lt;h1 id=&#34;beyla-and-kubernetes-quickstart&#34;&gt;Beyla and Kubernetes quickstart&lt;/h1&gt;
&lt;p&gt;Kubernetes is fully integrated into the Beyla operation mode.&lt;/p&gt;
&lt;p&gt;On one side, metrics and traces can be decorated
with the metadata of the Kubernetes entities running the automatically instrumented
services.&lt;/p&gt;
&lt;p&gt;On the other side, DaemonSet has become the preferred deployment
mode for Beyla: thanks to the versatility of the new service selectors,
a user can precisely define which services need to be instrumented and which
don&amp;rsquo;t. A single instance of Beyla will be able to instrument the selected
group of services within a single Kubernetes node.&lt;/p&gt;
&lt;h2 id=&#34;beyla-service-selectors&#34;&gt;Beyla service selectors&lt;/h2&gt;
&lt;p&gt;A service selector is a set of properties that let Beyla to query which processes need
to be instrumented.&lt;/p&gt;
&lt;p&gt;When Beyla is deployed as a regular operating system process that instrument other processes,
the unique service selectors are the network port where the instrumented process should
be listening to (can be specified with the &lt;code&gt;BEYLA_OPEN_PORT&lt;/code&gt; environment variable) or
a &lt;a href=&#34;https://en.wikipedia.org/wiki/Glob_%28programming%29&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Glob&lt;/a&gt; to match against the executable filename of the process to
instrument (&lt;code&gt;BEYLA_AUTO_TARGET_EXE&lt;/code&gt; environment variable).&lt;/p&gt;
&lt;p&gt;To select multiple groups of processes, the Beyla YAML configuration file format
provides a &lt;code&gt;discovery.instrument&lt;/code&gt; section that accepts multiple selector groups:&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;discovery:
  instrument:
    # Instrument any process using the ports from 8080 to 8089
    - open_ports: 8080-8089
    # Instrument any process whose command line path contains &amp;#34;http&amp;#34;
    - exe_path: &amp;#34;*http*&amp;#34;
    # Instrument any process with a command line path containing &amp;#34;nginx&amp;#34;
    # and using the port 443 (both conditions must be fulfilled)
    - open_ports: 443
      exe_path: &amp;#34;*nginx*&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The above criteria are insufficient for Kubernetes pods where the ports are ephemeral
and internal to the pods. Also, pods are a level of abstraction that should hide
details such as the name of their executables.
For that reason, Beyla makes it possible to use Kubernetes attributes in the service instrumentation
selection criteria. All of them accept a &lt;a href=&#34;https://en.wikipedia.org/wiki/Glob_%28programming%29&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;glob&lt;/a&gt;
as value:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;k8s_namespace&lt;/code&gt;: only instrument applications in the
namespace matching the provided glob.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k8s_deployment_name&lt;/code&gt;: only instrument Pods that belong to
a Deployment with a name matching the provided glob.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k8s_replicaset_name&lt;/code&gt;: only instrument Pods that belong to
a ReplicaSet with a name matching the provided glob.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k8s_pod_name&lt;/code&gt;: only instrument Pods with a name matching the provided glob.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;example-scenario&#34;&gt;Example scenario&lt;/h2&gt;
&lt;h3 id=&#34;1-deploy-testing-instrumentable-services&#34;&gt;1. Deploy testing instrumentable services&lt;/h3&gt;
&lt;p&gt;You can instrument any HTTP or HTTPS service in your Kubernetes cluster. If you prefer, you
can first try instrumenting the dummy services provided in this example.&lt;/p&gt;
&lt;p&gt;The following Kubernetes example file contains two Apache HTTP servers: one pretends to be
a company &lt;code&gt;website&lt;/code&gt; and the other pretends to be a documentation site (&lt;code&gt;docs&lt;/code&gt;).
Let&amp;rsquo;s ignore that both servers will just return an &amp;ldquo;It Works!&amp;rdquo; string when the root directory
is requested and a 404 error if any other path is requested.&lt;/p&gt;
&lt;p&gt;Copy the following contents into a file (for example, &lt;code&gt;sampleapps.yml&lt;/code&gt;) and deploy it with
the command &lt;code&gt;kubectl apply -f sampleapps.yml&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;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;kind: Deployment
apiVersion: apps/v1
metadata:
  name: docs
spec:
  replicas: 2
  selector:
    matchLabels:
      app: docs
  template:
    metadata:
      labels:
        app: docs
    spec:
      containers:
        - name: docs-server
          image: httpd:latest
          ports:
            - containerPort: 80
              protocol: TCP
              name: http
---
apiVersion: v1
kind: Service
metadata:
  name: docs
spec:
  selector:
    app: docs
  ports:
    - protocol: TCP
      port: 80
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: website
spec:
  replicas: 2
  selector:
    matchLabels:
      app: website
  template:
    metadata:
      labels:
        app: website
    spec:
      containers:
        - name: website-server
          image: httpd:latest
          ports:
            - containerPort: 80
              protocol: TCP
              name: http
---
apiVersion: v1
kind: Service
metadata:
  name: website
spec:
  selector:
    app: website
  ports:
    - protocol: TCP
      port: 80&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To test that they are up and running, open two terminal sessions and run one of
each command below on a different session:&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;# Redirect website to local port 8080
kubectl port-forward services/website 8080:80

# Redirect docs site to local port 8081
kubectl port-forward services/docs 8081:80&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;From your computer, each request to &lt;code&gt;http://localhost:8080&lt;/code&gt; will be a
hypothetical request to the company website and each request to &lt;code&gt;http://localhost:8081&lt;/code&gt;
will be a hypothetical request to the documentation website.&lt;/p&gt;
&lt;h3 id=&#34;2-create-beyla-namespace&#34;&gt;2. Create &lt;code&gt;beyla&lt;/code&gt; namespace&lt;/h3&gt;
&lt;p&gt;Before configuring and deploying Beyla, let&amp;rsquo;s create a &lt;code&gt;beyla&lt;/code&gt; namespace.
We will group there all the permissions, configurations and deployments
related to it:&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;kubectl create namespace beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;3-get-grafana-cloud-credentials&#34;&gt;3. Get Grafana Cloud credentials&lt;/h3&gt;
&lt;p&gt;Beyla can export metrics and traces to any OpenTelemetry endpoint, as well as exposing metrics as a Prometheus endpoint. However, we recommend using the OpenTelemetry endpoint in Grafana Cloud. You can get a &lt;a href=&#34;/pricing/&#34;&gt;Free Grafana Cloud Account at Grafana&amp;rsquo;s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the Grafana Cloud Portal, look for the &lt;strong&gt;OpenTelemetry&lt;/strong&gt; box and click &lt;strong&gt;Configure&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otel-cloud-portal-box.png&#34;
  alt=&#34;OpenTelemetry Grafana Cloud portal&#34; width=&#34;1002&#34;
     height=&#34;312&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Under &lt;strong&gt;Password / API token&lt;/strong&gt; click &lt;strong&gt;Generate now&lt;/strong&gt; and follow the instructions to create a default API token.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Environment Variables&lt;/strong&gt; will be populated with a set of standard OpenTelemetry environment variables which will provide the connection endpoint and credentials information for Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/quickstart/otlp-connection-headers.png&#34;
  alt=&#34;OTLP connection headers&#34; width=&#34;1592&#34;
     height=&#34;998&#34;/&gt;&lt;/p&gt;
&lt;p&gt;From the &lt;strong&gt;Environment Variables&lt;/strong&gt; section, copy the &lt;code&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/code&gt; and &lt;code&gt;OTEL_EXPORTER_OTLP_HEADERS&lt;/code&gt;
values and create a new secret from them. For example, create the following secret file and apply 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;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;apiVersion: v1
kind: Secret
metadata:
  namespace: beyla
  name: grafana-credentials
type: Opaque
stringData:
  otlp-endpoint: &amp;#34;https://otlp-gateway-prod-eu-west-0.grafana.net/otlp&amp;#34;
  otlp-headers: &amp;#34;Authorization=Basic ...rest of the secret header value...&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;3-configure-and-run-beyla&#34;&gt;3. Configure and run Beyla&lt;/h3&gt;
&lt;p&gt;Next, you need to provide Beyla with permissions to watch and inspect the metadata of the
diverse Kubernetes resources that Beyla&amp;rsquo;s discovery mechanism requires. You must create
the following YAML file and apply 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;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;apiVersion: v1
kind: ServiceAccount
metadata:
  namespace: beyla
  name: beyla
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: beyla
rules:
  - apiGroups: [ &amp;#34;apps&amp;#34; ]
    resources: [ &amp;#34;replicasets&amp;#34; ]
    verbs: [ &amp;#34;list&amp;#34;, &amp;#34;watch&amp;#34; ]
  - apiGroups: [ &amp;#34;&amp;#34; ]
    resources: [ &amp;#34;pods&amp;#34;, &amp;#34;services&amp;#34;, &amp;#34;nodes&amp;#34; ]
    verbs: [ &amp;#34;list&amp;#34;, &amp;#34;watch&amp;#34; ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: beyla
subjects:
  - kind: ServiceAccount
    name: beyla
    namespace: beyla
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: beyla&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;And now, deploy Beyla by creating the following Kubernetes entities:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;ConfigMap&lt;/code&gt; storing the &lt;code&gt;beyla-config.yml&lt;/code&gt; Beyla configuration file, which defines
the service discovery criteria. To verify that Beyla is able to discriminate
by service instance even if they run the same image and executable,
Beyla is configured to select ONLY the &lt;code&gt;docs&lt;/code&gt; Apache web server.&lt;/li&gt;
&lt;li&gt;A Beyla &lt;code&gt;DaemonSet&lt;/code&gt; providing the Beyla pod and its configuration:
&lt;ul&gt;
&lt;li&gt;Loads the &lt;code&gt;beyla-config.yml&lt;/code&gt; file from the &lt;code&gt;ConfigMap&lt;/code&gt;, as specified in the &lt;code&gt;BEYLA_CONFIG_PATH&lt;/code&gt;
environment variable.&lt;/li&gt;
&lt;li&gt;References to the &lt;code&gt;grafana-secrets&lt;/code&gt; values for the endpoint and credentials.&lt;/li&gt;
&lt;li&gt;Uses the &lt;code&gt;beyla&lt;/code&gt; &lt;code&gt;ServiceAccount&lt;/code&gt; to get all the permissions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Copy and deploy the following YAML 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;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;apiVersion: v1
kind: ConfigMap
metadata:
  namespace: beyla
  name: beyla-config
data:
  beyla-config.yml: |
    # this is required to enable kubernetes discovery and metadata
    attributes:
      kubernetes:
        enable: true
    # this will provide automatic routes report while minimizing cardinality
    routes:
      unmatched: heuristic
    # let&amp;#39;s instrument only the docs server
    discovery:
      instrument:
        - k8s_deployment_name: &amp;#34;docs&amp;#34;
        # uncomment the following line to also instrument the website server
        # - k8s_deployment_name: &amp;#34;website&amp;#34;
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  namespace: beyla
  name: beyla
spec:
  selector:
    matchLabels:
      instrumentation: beyla
  template:
    metadata:
      labels:
        instrumentation: beyla
    spec:
      serviceAccountName: beyla
      hostPID: true # mandatory!
      containers:
        - name: beyla
          image: grafana/beyla:latest
          imagePullPolicy: IfNotPresent
          securityContext:
            privileged: true # mandatory!
            readOnlyRootFilesystem: true
          volumeMounts:
            - mountPath: /config
              name: beyla-config
            - mountPath: /var/run/beyla
              name: var-run-beyla
          env:
            - name: BEYLA_CONFIG_PATH
              value: &amp;#34;/config/beyla-config.yml&amp;#34;
            - name: OTEL_EXPORTER_OTLP_ENDPOINT
              valueFrom:
                secretKeyRef:
                  name: grafana-credentials
                  key: otlp-endpoint
            - name: OTEL_EXPORTER_OTLP_HEADERS
              valueFrom:
                secretKeyRef:
                  name: grafana-credentials
                  key: otlp-headers
      volumes:
        - name: beyla-config
          configMap:
            name: beyla-config
        - name: var-run-beyla
          emptyDir: {}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Also notice:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To run in DaemonSet mode, Beyla requires to have access to all the
processes in the node. Then the Beyla Pod requires to run with &lt;code&gt;hostPID: true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The Beyla container needs to run with &lt;code&gt;privileged: true&lt;/code&gt;, as it requires
to perform privileged actions such as loading BPF programs and creating
BPF maps. For running Beyla as &lt;code&gt;unprivileged&lt;/code&gt; container, i.e. without the
&lt;code&gt;privileged: true&lt;/code&gt; option, visit the
&lt;a href=&#34;../../setup/kubernetes/#deploy-beyla-unprivileged&#34;&gt;Deploy Beyla unprivileged&lt;/a&gt;
guide.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;4-test-your-instrumented-services-and-see-the-results-in-grafana&#34;&gt;4. Test your instrumented services and see the results in Grafana&lt;/h3&gt;
&lt;p&gt;With the &lt;code&gt;kubectl port-forward&lt;/code&gt; commands from the firs step still running,
test both web server instances. For example:&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;curl http://localhost:8080
curl http://localhost:8080/foo
curl http://localhost:8081
curl http://localhost:8081/foo&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Some requests will return 404 error, but it&amp;rsquo;s OK because they are also instrumented.&lt;/p&gt;
&lt;p&gt;Now, go to the instance in Grafana Cloud, and from the &lt;strong&gt;Explore&lt;/strong&gt; section in the left panel, select the data source for the traces (usually named &lt;code&gt;grafanacloud-&amp;lt;your user name&amp;gt;-traces&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/tutorial/k8s/select-traces.png&#34;
  alt=&#34;Select the traces data source&#34; width=&#34;1896&#34;
     height=&#34;440&#34;/&gt;&lt;/p&gt;
&lt;p&gt;To search for all the traces, select the &lt;strong&gt;Search&lt;/strong&gt; box in the Query bar, leave the form empty, and click &lt;strong&gt;Run query&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/tutorial/k8s/run-query.png&#34;
  alt=&#34;Searching for all the traces in the system&#34; width=&#34;1766&#34;
     height=&#34;904&#34;/&gt;&lt;/p&gt;
&lt;p&gt;This will show the traces for the &lt;code&gt;docs&lt;/code&gt; instance (port 8081). You might see traces from your own services, but shouldn&amp;rsquo;t see traces from the &lt;code&gt;website&lt;/code&gt; service, as it has not been instrumented by Beyla.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/tutorial/k8s/tut-traces-list.png&#34;
  alt=&#34;Grafana Cloud list of traces&#34; width=&#34;1614&#34;
     height=&#34;316&#34;/&gt;&lt;/p&gt;
&lt;p&gt;In the trace details, the resource attributes of the traces are decorated with the metadata of the Kubernetes Pod running the instrumented service:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/grafana-cloud/beyla/tutorial/k8s/tut-trace-details.png&#34;
  alt=&#34;Details of the trace&#34; width=&#34;1630&#34;
     height=&#34;1470&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;links&#34;&gt;Links&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../configure/options/&#34;&gt;Documentation: Beyla configuration options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;../../setup/kubernetes/&#34;&gt;Documentation: run Beyla as Kubernetes DaemonSet&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="beyla-and-kubernetes-quickstart">Beyla and Kubernetes quickstart&lt;/h1>
&lt;p>Kubernetes is fully integrated into the Beyla operation mode.&lt;/p>
&lt;p>On one side, metrics and traces can be decorated
with the metadata of the Kubernetes entities running the automatically instrumented
services.&lt;/p></description></item></channel></rss>