<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Elastic Observability Labs - Articles by Damien Mathieu</title>
        <link>https://www.elastic.co/observability-labs</link>
        <description>Trusted security news &amp; research from the team at Elastic.</description>
        <lastBuildDate>Fri, 10 Jul 2026 05:08:02 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>Elastic Observability Labs - Articles by Damien Mathieu</title>
            <url>https://www.elastic.co/observability-labs/assets/observability-labs-thumbnail.png</url>
            <link>https://www.elastic.co/observability-labs</link>
        </image>
        <copyright>© 2026. Elasticsearch B.V. All Rights Reserved</copyright>
        <item>
            <title><![CDATA[Auto-instrumentation of Go applications with OpenTelemetry]]></title>
            <link>https://www.elastic.co/observability-labs/blog/auto-instrumentation-go-applications-opentelemetry</link>
            <guid isPermaLink="false">auto-instrumentation-go-applications-opentelemetry</guid>
            <pubDate>Wed, 02 Oct 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[Instrumenting Go applications with OpenTelemetry provides insights into application performance, dependencies, and errors. We'll show you how to automatically instrument a Go application using Docker, with no changes to your application code.]]></description>
            <content:encoded><![CDATA[<p>In the fast-paced universe of software development, especially in the
cloud-native realm, DevOps and SRE teams are increasingly emerging as essential
partners in application stability and growth.</p>
<p>DevOps engineers continuously optimize software delivery, while SRE teams act
as the stewards of application reliability, scalability, and top-tier
performance. The challenge? These teams require a cutting-edge observability
solution, one that encompasses full-stack insights, empowering them to rapidly
manage, monitor, and rectify potential disruptions before they culminate into
operational challenges.</p>
<p>Observability in our modern distributed software ecosystem goes beyond mere
monitoring — it demands limitless data collection, precision in processing, and
the correlation of this data into actionable insights. However, the road to
achieving this holistic view is paved with obstacles, from navigating version
incompatibilities to wrestling with restrictive proprietary code.</p>
<p>Enter <a href="https://opentelemetry.io/">OpenTelemetry (OTel)</a>, with the following
benefits for those who adopt it:</p>
<ul>
<li>Escape vendor constraints with OTel, freeing yourself from vendor lock-in and
ensuring top-notch observability.</li>
<li>See the harmony of unified logs, metrics, and traces come together to provide
a complete system view.</li>
<li>Improve your application oversight through richer and enhanced
instrumentations.</li>
<li>Embrace the benefits of backward compatibility to protect your prior
instrumentation investments.</li>
<li>Embark on the OpenTelemetry journey with an easy learning curve, simplifying
onboarding and scalability.</li>
<li>Rely on a proven, future-ready standard to boost your confidence in every
investment.</li>
</ul>
<p>In this blog, we will explore how you can use <a href="https://github.com/open-telemetry/opentelemetry-go-instrumentation/">automatic instrumentation in
your Go</a>
application using Docker, without the need to refactor any part of your
application code. We will use an <a href="https://github.com/elastic/observability-examples">application called
Elastiflix</a>, which helps
highlight auto-instrumentation in a simple way.</p>
<h2>Application, prerequisites, and config</h2>
<p>The application that we use for this blog is called
<a href="https://github.com/elastic/observability-examples">Elastiflix</a>, a
movie-streaming application. It consists of several micro-services written in
.NET, NodeJS, Go, and Python.</p>
<p>Before we instrument our sample application, we will first need to understand
how Elastic can receive the telemetry data.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/auto-instrumentation-go-applications-opentelemetry/elastic-blog-1-config.png" alt="Elastic configuration options for
OpenTelemetry" /></p>
<p>All of Elastic Observability’s APM capabilities are available with OTel data.
Some of these include:</p>
<ul>
<li>Service maps</li>
<li>Service details (latency, throughput, failed transactions)</li>
<li>Dependencies between services, distributed tracing</li>
<li>Transactions (traces)</li>
<li>Machine learning (ML) correlations</li>
<li>Log correlation</li>
</ul>
<p>In addition to Elastic’s APM and a unified view of the telemetry data, you will
also be able to use Elastic’s powerful machine learning capabilities to reduce
the analysis, and alerting to help reduce MTTR.</p>
<h3>Prerequisites</h3>
<ul>
<li>An Elastic Cloud account — <a href="https://cloud.elastic.co/">sign up now</a>.</li>
<li>A clone of the <a href="https://github.com/elastic/observability-examples">Elastiflix demo application</a>, or your own Go application</li>
<li>Basic understanding of Docker — potentially install <a href="https://www.docker.com/products/docker-desktop/">Docker Desktop</a></li>
<li>Basic understanding of Go</li>
</ul>
<h3>View the example source code</h3>
<p>The full source code, including the Dockerfile used in this blog, can be found
on
<a href="https://github.com/elastic/observability-examples/tree/main/Elastiflix/go-favorite">GitHub</a>.</p>
<p>The following steps will show you how to instrument this application and run it
on the command line or in Docker. If you are interested in a more complete OTel
example, take a look at the docker-compose file
<a href="https://github.com/elastic/observability-examples/tree/main#start-the-app">here</a>,
which will bring up the full project.</p>
<h2>Step-by-step guide</h2>
<h3>Step 0. Log in to your Elastic Cloud account</h3>
<p>This blog assumes you have an Elastic Cloud account — if not, follow the
<a href="https://cloud.elastic.co/registration?elektra=en-cloud-page">instructions to get started on Elastic
Cloud</a>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/auto-instrumentation-go-applications-opentelemetry/elastic-blog-2-trial.png" alt="free trial" /></p>
<h3>Step 1. Run the Docker Image with auto-instrumentation</h3>
<p>We are going to use automatic instrumentation with the Go service from the
<a href="https://github.com/elastic/observability-examples/tree/main/Elastiflix/go-favorite">Elastiflix demo
application</a>.</p>
<p>We will be using the following service from Elastiflix:</p>
<pre><code class="language-bash">Elastiflix/go-favorite
</code></pre>
<p>Per the <a href="https://github.com/open-telemetry/opentelemetry-go-instrumentation/blob/main/docs/getting-started.md">OpenTelemetry Automatic Instrumentation for Go
documentation</a>,
you will configure the application to be auto-instrumented using
docker-compose.</p>
<p>As specified in the <a href="https://github.com/open-telemetry/opentelemetry-go-instrumentation/blob/main/docs/getting-started.md">OTEL Go
documentation</a>,
we will use environment variables and pass in the configuration values to
enable it to connect with <a href="https://www.elastic.co/guide/en/observability/current/apm-open-telemetry.html">Elastic Observability’s APM
server</a>.</p>
<p>Because Elastic accepts OTLP natively, we just need to provide the Endpoint and
authentication where the OTEL Exporter needs to send the data, as well as some
other environment variables.</p>
<p><strong>Getting Elastic Cloud variables</strong>
You can copy the endpoints and token from Kibana under the path <code>/app/apm/onboarding?agent=openTelemetry</code>.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/auto-instrumentation-go-applications-opentelemetry/elastic-blog-3-apm-agents.png" alt="apm agents" /></p>
<p>You will need to copy the following environment variables:</p>
<pre><code class="language-bash">OTEL_EXPORTER_OTLP_ENDPOINT
OTEL_EXPORTER_OTLP_HEADERS
</code></pre>
<p>Update the <code>docker-compose.yml</code> file at the top of the <code>Elastiflix</code> repository,
adding a <code>go-auto</code> service and updating the <code>favorite-go</code> one:</p>
<pre><code class="language-yaml">  favorite-go:
    build: go-favorite/.
    image: docker.elastic.co/demos/workshop/observability/elastiflix-go-favorite:${ELASTIC_VERSION}-${BUILD_NUMBER}
    depends_on:
      - redis
    networks:
      - app-network
    ports:
      - &quot;5001:5000&quot;
    environment:
      - REDIS_HOST=redis
      - TOGGLE_SERVICE_DELAY=${TOGGLE_SERVICE_DELAY:-0}
      - TOGGLE_CANARY_DELAY=${TOGGLE_CANARY_DELAY:-0}
      - TOGGLE_CANARY_FAILURE=${TOGGLE_CANARY_FAILURE:-0}
    volumes:
      - favorite-go:/app
  go-auto:
    image: otel/autoinstrumentation-go
    privileged: true
    pid: &quot;host&quot;
    networks:
      - app-network
    environment:
      OTEL_EXPORTER_OTLP_ENDPOINT: &quot;REPLACE WITH OTEL_EXPORTER_OTLP_ENDPOINT&quot;
      OTEL_EXPORTER_OTLP_HEADERS: &quot;REPLACE WITH OTEL_EXPORTER_OTLP_HEADERS&quot;
      OTEL_GO_AUTO_TARGET_EXE: &quot;/app/main&quot;
      OTEL_SERVICE_NAME: &quot;go-favorite&quot;
      OTEL_PROPAGATORS: &quot;tracecontext,baggage&quot;
    volumes:
      - favorite-go:/app
      - /proc:/host/proc
</code></pre>
<p>And, at the bottom of the file:</p>
<pre><code class="language-yaml">volumes:
  favorite-go:
networks:
  app-network:
    driver: bridge
</code></pre>
<p>Finally, in the configuration for the main node app, you will want to tell Elastiflix to call the Go favorites app by replacing the line:</p>
<pre><code class="language-yaml">environment:
  - API_ENDPOINT_FAVORITES=favorite-java:5000
</code></pre>
<p>with:</p>
<pre><code class="language-yaml">environment:
  - API_ENDPOINT_FAVORITES=favorite-go:5000
</code></pre>
<h3>Step 3: Explore traces and logs in Elastic APM</h3>
<p>Once you have this up and running, you can ping the endpoint for your
instrumented service (in our case, this is /favorites), and you should see the
app appear in Elastic APM, as shown below:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/auto-instrumentation-go-applications-opentelemetry/elastic-blog-4-services.png" alt="services" /></p>
<p>It will begin by tracking throughput and latency critical metrics for SREs to
pay attention to.</p>
<p>Digging in, we can see an overview of all our Transactions.</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/auto-instrumentation-go-applications-opentelemetry/elastic-blog-5-services2.png" alt="services-2" /></p>
<p>And look at specific transactions:</p>
<p><img src="https://www.elastic.co/observability-labs/assets/images/auto-instrumentation-go-applications-opentelemetry/elastic-blog-6-graph-colored.png" alt="graph colored lines" /></p>
<p>This gives you complete visibility across metrics, and traces!</p>
<h2>Summary</h2>
<p>With this Dockerfile, you've transformed your simple Go application into one
that's automatically instrumented with OpenTelemetry. This will aid greatly in
understanding application performance, tracing errors, and gaining insights
into how users interact with your software.</p>
<p>Remember, observability is a crucial aspect of modern application development,
especially in distributed systems. With tools like OpenTelemetry, understanding
complex systems becomes a tad bit easier.</p>
<p>In this blog, we discussed the following:</p>
<ul>
<li>How to auto-instrument Go with OpenTelemetry.</li>
<li>Using standard commands in a Docker file, auto-instrumentation was done
efficiently and without adding code in multiple places enabling
manageability.</li>
<li>Using OpenTelemetry and its support for multiple languages, DevOps and SRE
teams can auto-instrument their applications with ease gaining immediate
insights into the health of the entire application stack and reduce mean time
to resolution (MTTR).</li>
</ul>
<p>Since Elastic can support a mix of methods for ingesting data, whether it be
using auto-instrumentation of open-source OpenTelemetry or manual
instrumentation with its native APM agents, you can plan your migration to OTel
by focusing on a few applications first and then using OpenTelemety across your
applications later on in a manner that best fits your business needs.</p>
<p>Developer resources:</p>
<ul>
<li><a href="https://www.elastic.co/observability-labs/blog/getting-started-opentelemetry-instrumentation-sample-app">Elastiflix application</a>, a guide to instrument different languages with OpenTelemetry</li>
<li>Python: <a href="https://www.elastic.co/observability-labs/blog/auto-instrumentation-python-applications-opentelemetry">Auto-instrumentation</a>, <a href="https://www.elastic.co/observability-labs/blog/manual-instrumentation-python-apps-opentelemetry">Manual-instrumentation</a></li>
<li>Java: <a href="https://www.elastic.co/observability-labs/blog/auto-instrumentation-java-applications-opentelemetry">Auto-instrumentation</a>, <a href="https://www.elastic.co/observability-labs/blog/manual-instrumentation-java-apps-opentelemetry">Manual-instrumentation</a></li>
<li>Node.js: <a href="https://www.elastic.co/observability-labs/blog/auto-instrument-nodejs-apps-opentelemetry">Auto-instrumentation</a>, <a href="https://www.elastic.co/observability-labs/blog/manual-instrumentation-nodejs-apps-opentelemetry">Manual-instrumentation</a></li>
<li>.NET: <a href="https://www.elastic.co/observability-labs/blog/auto-instrumentation-net-applications-opentelemetry">Auto-instrumentation</a>, <a href="https://www.elastic.co/observability-labs/blog/manual-instrumentation-net-apps-opentelemetry">Manual-instrumentation</a></li>
<li>Go: <a href="https://www.elastic.co/observability-labs/blog/auto-instrumentation-go-applications-opentelemetry">Auto-instrumentation</a> <a href="https://www.elastic.co/observability-labs/blog/manual-instrumentation-apps-opentelemetry">Manual-instrumentation</a></li>
<li><a href="https://www.elastic.co/observability-labs/blog/best-practices-instrumenting-opentelemetry">Best practices for instrumenting OpenTelemetry</a></li>
</ul>
<p>General configuration and use case resources:</p>
<ul>
<li><a href="https://www.elastic.co/blog/opentelemetry-observability">Independence with OpenTelemetry on Elastic</a></li>
<li><a href="https://www.elastic.co/blog/implementing-kubernetes-observability-security-opentelemetry">Modern observability and security on Kubernetes with Elastic and OpenTelemetry</a></li>
<li><a href="https://www.elastic.co/blog/3-models-logging-opentelemetry-elastic">3 models for logging with OpenTelemetry and Elastic</a></li>
<li><a href="https://www.elastic.co/blog/adding-free-and-open-elastic-apm-as-part-of-your-elastic-observability-deployment">Adding free and open Elastic APM as part of your Elastic Observability deployment</a></li>
<li><a href="https://www.elastic.co/blog/custom-metrics-app-code-java-agent-plugin">Capturing custom metrics through OpenTelemetry API in code with Elastic</a></li>
<li><a href="https://www.elastic.co/virtual-events/future-proof-your-observability-platform-with-opentelemetry-and-elastic">Future-proof your observability platform with OpenTelemetry and Elastic</a></li>
<li><a href="https://www.elastic.co/blog/kubernetes-k8s-observability-elasticsearch-cncf">Elastic Observability: Built for open technologies like Kubernetes, OpenTelemetry, Prometheus, Istio, and more</a></li>
</ul>
<p>Don’t have an Elastic Cloud account yet? <a href="https://cloud.elastic.co/registration">Sign up for Elastic Cloud</a> and try out the auto-instrumentation capabilities that I discussed above. I would be interested in getting your feedback about your experience in gaining visibility into your application stack with Elastic.</p>
<p>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all._</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/auto-instrumentation-go-applications-opentelemetry/observability-launch-series-3-go-auto.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[A day in the life of an OpenTelemetry maintainer]]></title>
            <link>https://www.elastic.co/observability-labs/blog/day-opentelemetry-maintainer</link>
            <guid isPermaLink="false">day-opentelemetry-maintainer</guid>
            <pubDate>Fri, 26 Sep 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[In this article, we will discover what the role of a maintainer is about, and how they make Open Source projects alive.]]></description>
            <content:encoded><![CDATA[<p>I’m <a href="https://github.com/dmathieu">Damien</a>, I’m an engineer at Elastic, a maintainer of the OpenTelemetry Go SDK, an approver of the OpenTelemetry Collector and a member of several SIGs.
In this post, we’ll take a closer look at what it means to be a maintainer: the responsibilities they carry, the challenges they navigate, and the impact they have on both the project and the broader community.</p>
<p><a href="https://youtu.be/eZ3OrhxUAmU?t=72"><img src="https://www.elastic.co/observability-labs/assets/images/day-opentelemetry-maintainer/humans-of-otel.png" alt="Humans of OTel at KubeCon EU 2025" /></a></p>
<p>When people think about open source, they often picture lines of code, clever algorithms, or maybe a GitHub repo full of issues and pull requests.
What can be harder to see is the human side. The people who quietly keep things moving, who make sure contributions land smoothly and help the community grow in a healthy way.
That's the work of a maintainer.</p>
<p>Maintainers are more than just code reviewers. They are the stewards of the SIG's (<a href="https://github.com/open-telemetry/community#special-interest-groups">Special Interest Group</a>) health, direction, and community.
They balance technical oversight with mentorship, governance with collaboration, and long-term vision with the day-to-day realities of issues and pull requests.</p>
<h2>Open Source mentorship</h2>
<p>One of the most rewarding parts of being a maintainer is mentorship.
Every open source project depends on new contributors stepping in, learning the ropes, and eventually taking on more responsibility themselves.
As maintainers, we’re often the first point of contact for someone who’s never contributed to the project before.</p>
<p>Mentorship can look like many different things.
Sometimes it’s as simple as leaving a thoughtful code review that doesn’t just point out what’s wrong, but explains why a change matters.
Other times, it’s guiding a contributor through their first issue, helping them understand the project’s structure, or showing them how to run tests locally.
And every so often, it means stepping back to give someone room to try, even if they don’t get it right the first time.</p>
<p>The goal isn’t just to fix the immediate bug or land the pull request. It's to help contributors feel confident enough to come back again.
A healthy project grows by sharing knowledge, not hoarding it.
Mentorship is how maintainers make sure today's first-time contributor can become tomorrow's reviewer, and eventually, the next maintainer.</p>
<h2>Setting direction and priorities</h2>
<p>Another part of being a maintainer is shaping the project's roadmap.
Open source moves fast: there are always new ideas, bug reports, and feature requests.
Left unchecked, a project can easily become a grab bag of loosely connected changes.
Part of our job as maintainers is to make sure the work stays aligned with the bigger picture.</p>
<p>That means asking questions like:</p>
<ul>
<li>Does this feature fit with our long-term goals?</li>
<li>Is now the right time to tackle it?</li>
<li>Do we have the capacity to maintain it once it’s merged?</li>
</ul>
<p>Sometimes the answer is &quot;not yet&quot; or even &quot;no&quot;, and it’s on us to communicate that clearly while still encouraging contributions.</p>
<p>Roadmapping isn't about dictating every detail.
It's about setting priorities together with the community—listening to feedback, balancing what users need today with where the project should be tomorrow, and making tradeoffs that keep the project sustainable.</p>
<p>The roadmap gives everyone a shared sense of direction.
Contributors know where their work fits in, users can see what's coming next, and the project as a whole stays focused instead of scattered.</p>
<h2>Special Interest Group meetings</h2>
<p>One of the maintainer's roles is also to facilitate the frequent meetings that help their SIG communicate and plan its work.</p>
<p>Facilitating a SIG meeting isn’t about running through an agenda like a checklist.
It’s about creating space where everyone feels comfortable speaking up, from long-time contributors to someone joining their very first call.
That means keeping discussions focused, making sure quieter voices get heard, and helping the group reach consensus without letting debates drag on forever.</p>
<p>There's also a practical side: preparing the agenda ahead of time, documenting decisions so they’re visible to the wider community, and following up on action items afterward.</p>
<p>In many ways, SIG meetings are where the &quot;community&quot; part of open source really comes to life.
As maintainers, our role is to guide the conversation, not control it, making sure the project keeps moving forward while staying open and inclusive.</p>
<h2>Challenges</h2>
<p>Of course, maintaining isn’t all smooth sailing.
One of the hardest parts is balancing the constant flow of contributions with the need to keep the codebase healthy.
Every pull request represents someone's time and effort, and it’s important to honor that.
Yet, at the same time, not every change fits the project's standards or long-term goals.
Saying &quot;no&quot; gracefully is just as important as merging a great contribution.</p>
<p>Maintainers also find themselves balancing priorities that go beyond code.
Different contributors, and often the companies backing them, come with their own needs and expectations.
One team might want a new feature quickly, another might be focused on stability, while the community as a whole still needs clear direction.
Managing those competing priorities, and making decisions that serve the project rather than any single interest, is a constant challenge.</p>
<p>Conflicts are another reality. With so many people involved, it's inevitable that disagreements will happen.
Sometimes it's about technical design, sometimes about process, and occasionally about interpersonal dynamics.
Part of the maintainer role is helping to navigate those moments: keeping discussions respectful, finding common ground, and making sure decisions are made transparently.</p>
<p>And yet, despite the difficulties, the impact of this work is enormous: when maintainers succeed, the entire community thrives.</p>
<h2>The importance and impact of Open Source maintainers</h2>
<p>When maintainers do their job well, the effects ripple far beyond the codebase.
A well-tended project feels reliable and welcoming—contributors know their work will be reviewed thoughtfully, users trust the software to be stable, and the community grows because people want to come back.</p>
<p>Good project maintenance builds momentum.
A contributor who feels supported on their first pull request is more likely to return for a second.
Clear roadmaps and consistent standards give people confidence that their effort matters and will fit into the bigger picture. And when conflicts are handled with respect and transparency, it reinforces the culture of trust that makes open source sustainable.</p>
<p>The impact goes deeper than just keeping a project alive.
Effective maintainers create the conditions for others to succeed.
That's the real legacy of this role: not just code, but a thriving ecosystem and community built around it.</p>
<h2>Conclusion</h2>
<p>Being a maintainer is challenging work, but it’s also some of the most meaningful.
It’s about more than merging code. It's about stewardship, mentorship, and creating a community where people feel empowered to contribute.
Every healthy open source project owes its success to the care and commitment of its maintainers.</p>
<p>And while the challenges are real, the rewards are just as tangible: the chance to constantly learn, to collaborate on complex problems, and to connect with people from every corner of the world and every kind of background.</p>
<p>OpenTelemetry's maintainers embody this balance every day, helping the project grow while keeping its community strong.</p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/day-opentelemetry-maintainer/blog-image.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Migrating from Elastic’s Go APM agent to OpenTelemetry Go SDK]]></title>
            <link>https://www.elastic.co/observability-labs/blog/elastic-go-apm-agent-to-opentelemetry-go-sdk</link>
            <guid isPermaLink="false">elastic-go-apm-agent-to-opentelemetry-go-sdk</guid>
            <pubDate>Mon, 15 Apr 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[As OpenTelemetry is fast becoming an industry standard, Elastic is fast adopting it as well. In this post, we show you a safe and easy way to migrate your Go application from our APM agent to OpenTelemetry.]]></description>
            <content:encoded><![CDATA[<p>As <a href="https://www.elastic.co/blog/elastic-opentelemetry-sdk-distributions">we’ve already shared</a>, Elastic is committed to helping OpenTelemetry (OTel) succeed, which means, in some cases, building distributions of language SDKs.</p>
<p>Elastic is strategically standardizing on OTel for observability and security data collection. Additionally, Elastic is committed to working with the OTel community to become the best data collection infrastructure for the observability ecosystem. Elastic is deepening its relationship with OTel beyond the recent contributions of the <a href="https://www.elastic.co/blog/ecs-elastic-common-schema-otel-opentelemetry-faq">Elastic Common Schema (ECS) to OpenTelemetry</a>, <a href="https://www.elastic.co/blog/elastic-invokedynamic-opentelemetry-java-agent">invokedynamic in the OTel Java agent</a>, and the <a href="https://www.elastic.co/blog/elastic-donation-proposal-to-contribute-profiling-agent-to-opentelemetry">upcoming profiling agent donation</a>.</p>
<p>Since Elastic version 7.14, Elastic has supported OTel natively by being able to directly ingest OpenTelemetry protocol (OTLP)-based traces, metrics, and logs.</p>
<p>The Go SDK is a bit different from the other language SDKs, as the Go language inherently lacks the dynamicity that would allow building a distribution that is not a fork.</p>
<p>Nevertheless, the absence of a distribution doesn’t mean you shouldn’t use OTel for data collection from Go applications with the Elastic Stack.</p>
<p>Elastic currently has an APM Go agent, but we recommend switching to the OTel Go SDK. In this post, we cover two ways you can do that migration:</p>
<ul>
<li>
<p>By replacing all telemetry in your application’s code (a “big bang migration”) and shipping the change</p>
</li>
<li>
<p>By splitting the migration into atomic changes, to reduce the risk of regressions</p>
</li>
</ul>
<h2>A big bang migration</h2>
<p>The simplest way to migrate from our APM Go agent to the OTel SDK may be by removing all telemetry provided by the agent and replacing it all with the new one.</p>
<h3>Automatic instrumentation</h3>
<p>Most of your instrumentation may be provided automatically, as it is part of the frameworks or libraries you are using.</p>
<p>For example, if you use the Elastic Go agent, you may be using our net/http auto instrumentation module like this:</p>
<pre><code class="language-go">import (
	&quot;net/http&quot;
	&quot;go.elastic.co/apm/module/apmhttp/v2&quot;
)


func handler(w http.ResponseWriter, req *http.Request) {
	fmt.Fprintf(w, &quot;Hello World!&quot;)
}

func main() {
	http.ListenAndServe(
                  &quot;:8080&quot;,
                  apmhttp.Wrap(http.HandlerFunc(handler)),
	)
}
</code></pre>
<p>With OpenTelemetry, you would use the otelhttp module instead:</p>
<pre><code class="language-go">import (
	&quot;net/http&quot;
	&quot;go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp&quot;
)


func handler(w http.ResponseWriter, req *http.Request) {
	fmt.Fprintf(w, &quot;Hello World!&quot;)
}

func main() {
	http.ListenAndServe(
                  &quot;:8080&quot;,
                  otelhttp.NewHandler(http.HandlerFunc(handler), &quot;http&quot;),
	)
}
</code></pre>
<p>You should perform this same change for every other module you use from our agent.</p>
<h3>Manual instrumentation</h3>
<p>Your application may also have manual instrumentations, which consist of creating traces and spans directly within your application code by calling the Elastic APM agent API.</p>
<p>You may be creating transactions and spans like this with Elastic’s APM SDK:</p>
<pre><code class="language-go">import (
	&quot;go.elastic.co/apm/v2&quot;
)

func main() {
       // Create a transaction, and assign it to the context.
       tx :=  apm.DefaultTracer().StartTransaction(&quot;GET /&quot;, &quot;request&quot;)
       defer tx.End()
       ctx = apm.ContextWithTransaction(ctx, tx)

       // Create a span
       span, ctx := apm.StartSpan(ctx, &quot;span&quot;)
       defer span.End()
}
</code></pre>
<p>OpenTelemetry uses the same API for both transactions and spans — what Elastic considers “transactions” are just considered spans with no parent in OTel (“root spans”).</p>
<p>So, your instrumentation becomes the following:</p>
<pre><code class="language-go">import (
	&quot;go.opentelemetry.io/otel/trace&quot;
)

func main() {
	tracer := otel.Tracer(&quot;my library&quot;)

	// Create a root span.
	// It is assigned to the returned context automatically.
	ctx, span := tracer.Start(ctx, &quot;GET /&quot;)
	defer span.End()

	// Create a child span (as the context has a parent).
	ctx, span := tracer.Start(ctx, &quot;span&quot;)
	defer span.End()
}
</code></pre>
<p>With a big bang migration, you will need to migrate everything before shipping it to production. You cannot split the migration into smaller chunks.</p>
<p>For small applications or ones that only use automatic instrumentation, that constraint may be fine. It allows you to quickly validate the migration and move on.</p>
<p>However, if you are working on a complex set of services, a large application, or one with a lot of manual instrumentation, you probably want to be able to ship code multiple times during the migration instead of all at once.</p>
<h2>An atomic migration</h2>
<p>An atomic migration would be one where you can ship atomic changes gradually and have your application keep working normally. Then, you are able to pull the final plug only at the end, once you are ready to do so.</p>
<p>To help with atomic migrations, we provide a <a href="https://www.elastic.co/guide/en/apm/agent/go/master/opentelemetry.html">bridge between our APM Go agent and OpenTelemetry</a>.</p>
<p>This bridge allows you to run both our agent and OTel alongside each other and to have instrumentations with both libraries in the same process with the data being transmitted to the same location and in the same format.</p>
<p>You can configure the OTel bridge with our agent like this:</p>
<pre><code class="language-go">import (
	&quot;go.elastic.co/apm/v2&quot;
	&quot;go.elastic.co/apm/module/apmotel/v2&quot;

	&quot;go.opentelemetry.io/otel&quot;
)

func main() {
	provider, err := apmotel.NewTracerProvider()
	if err != nil {
		log.Fatal(err)
	}
	otel.SetTracerProvider(provider)
}
</code></pre>
<p>Once this configuration is set, every span created by OTel will be transmitted to the Elastic APM agent.</p>
<p>With this bridge, you can make your migration much safer with the following process:</p>
<ul>
<li>
<p>Add the bridge to your application.</p>
</li>
<li>
<p>Switch one instrumentation (automatic or manual) from the agent to OpenTelemetry, as you would have done for the big bang migration above but a single one at a time.</p>
</li>
<li>
<p>Remove the bridge and our agent, and configure OpenTelemetry to transmit the data via its SDK.</p>
</li>
</ul>
<p>Each of those steps can be a single change within your application and go to production right away.</p>
<p>If any issue arises during the migration process, you should then be able to see it immediately and fix it before moving on.</p>
<h2>Observability benefits from building with OTel</h2>
<p>As OTel is quickly becoming an industry standard, and Elastic is committed to making it even better, it can be very beneficial to your engineering teams to migrate to it.</p>
<p>In Go, whether you do this through a big bang migration or using Elastic’s OTel bridge, doing so will allow you to benefit from instrumentations maintained by the global community to make your observability even more effective and to better understand what’s happening within your application.</p>
<blockquote>
<ul>
<li><a href="https://www.elastic.co/blog/getting-started-opentelemetry-instrumentation-sample-app">Check out our code series on how to instrument with OpenTelemetry</a></li>
<li><a href="https://www.elastic.co/blog/manual-instrumentation-of-go-applications-opentelemetry">Go manual instrumentation with OpenTelemetry</a></li>
<li><a href="https://www.elastic.co/blog/best-practices-instrumenting-opentelemetry">Best practices for instrumenting with OpenTelemetry</a></li>
<li><a href="https://www.elastic.co/blog/analyzing-opentelemetry-apps-elastic-ai-assistant-apm">Using AI to analyze OpenTelemetry issues</a></li>
</ul>
</blockquote>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>
]]></content:encoded>
            <category>observability-labs</category>
            <enclosure url="https://www.elastic.co/observability-labs/assets/images/elastic-go-apm-agent-to-opentelemetry-go-sdk/elastic-de-136675-V1_V1_(1).jpg" length="0" type="image/jpg"/>
        </item>
    </channel>
</rss>