<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Elli (Einav Laviv)</title>
    <description>The latest articles on DEV Community by Elli (Einav Laviv) (@einavlaviv).</description>
    <link>https://dev.to/einavlaviv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F819282%2Fba03075d-2e4e-4227-b6a0-b32301228ccb.jpg</url>
      <title>DEV Community: Elli (Einav Laviv)</title>
      <link>https://dev.to/einavlaviv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/einavlaviv"/>
    <language>en</language>
    <item>
      <title>API latency in microservices – Trace-based troubleshooting</title>
      <dc:creator>Elli (Einav Laviv)</dc:creator>
      <pubDate>Sun, 16 Jul 2023 14:22:47 +0000</pubDate>
      <link>https://dev.to/einavlaviv/api-latency-in-microservices-trace-based-troubleshooting-51pm</link>
      <guid>https://dev.to/einavlaviv/api-latency-in-microservices-trace-based-troubleshooting-51pm</guid>
      <description>&lt;p&gt;Original article: &lt;a href="https://gethelios.dev/blog/api-latency-in-microservices-trace-based-troubleshooting"&gt;https://gethelios.dev/blog/api-latency-in-microservices-trace-based-troubleshooting&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In microservices architectures, apps are broken down into small, independent services that communicate with each other using APIs in a synchronous or asynchronous way.&lt;/p&gt;

&lt;p&gt;Microservices carry many advantages, such as Increased flexibility and scalability (microservices can be scaled independently of each other, and APIs help to scale microservices by adding or removing instances of the service as needed), enhanced reliability (a failure in one doesn’t effect the other microservices as in monolith apps), better security, reduced development time and more.&lt;/p&gt;

&lt;p&gt;However, microservices APIs are not problem free. API latency is a major obstacle in microservices, and it’s defined as the time it takes for an API to respond to a request. It is a critical factor in the performance of microservices applications.&lt;/p&gt;

&lt;p&gt;In this aspect, it’s important to clarify the difference between latency and response time. These are two important metrics for measuring the performance of a system. They are often confused with each other, but they are actually two different things. Response time is the time it takes for a system to respond to a request. It includes the time it takes for the system to receive the request, process the request, and generate a response. Latency. On the other hand, is the time it takes for a message to travel from one point to another. It includes the time it takes for the message to travel through the network, as well as the time it takes for the system to receive and process the message. In short, it’s the remote response time. While both should be optimized, this article looks at latency.&lt;/p&gt;

&lt;p&gt;Not surprisingly, latency is a big problem in microservices as microservices applications depend more on the communication between APIs: In a monolithic application, all of the code and data is located in a single process. This of course makes it easier to respond to requests quickly. In a microservices application, however, each service is its own individual process. This means that transaction events have to travel between processes, across different internal APIs which adds to the response time and may cause high latency. The problem worsens when scaling microservices – As the complexity of the service increases, there is a significant risk of increasing latency between microservices and application programming interfaces (APIs)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices vs monolith response time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y3xcIRmG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqy29fnzm1b2c3axc4ss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y3xcIRmG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqy29fnzm1b2c3axc4ss.png" alt="Image description" width="468" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Source&lt;/p&gt;

&lt;p&gt;Why is it such a problem? Latency is a problem due to multiple reasons, such as slow response time for users, increased load on servers, reduced scalability, and more.&lt;/p&gt;

&lt;p&gt;Moreover, debugging and troubleshooting API latency in microservices is challenging as tracking down the root cause can be a developer nightmare. After all, it can be caused by one single service, or it can be related to the communication between multiple services.&lt;/p&gt;

&lt;p&gt;This article discusses the challenges of latency in microservices as well as some strategies, best practices and examples for reducing latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Internal APIs performance issues in microservices&lt;/strong&gt;&lt;br&gt;
There are a number of performance failures or issues that can occur with APIs in microservices architectures. Some of the most common issues include:&lt;/p&gt;

&lt;p&gt;Latency: As mentioned, latency is the time it takes for an API to respond to a request.&lt;/p&gt;

&lt;p&gt;HTTP errors: HTTP errors are a common type of error that can occur with APIs. HTTP errors are returned by the API when there is a problem with the request or the response. Some common examples include 404 Not Found, 500 Internal Server Error, and 403 Forbidden.&lt;/p&gt;

&lt;p&gt;Timeouts: Timeouts can occur when the latency is just too high and an API takes too long to respond to a request. Timeouts can be caused by a variety of factors, such as network congestion, overloaded servers, or errors in the code.&lt;/p&gt;

&lt;p&gt;Connection errors: Connection errors can occur when an API is unable to connect to the server. Connection errors can be caused by a variety of factors, such as network problems, server outages, or firewall rules.&lt;/p&gt;

&lt;p&gt;Invalid data: Invalid data can be sent to an API in a request. Invalid data can cause errors in the API, such as malformed requests or invalid parameters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deep dive into API latency in microservices&lt;/strong&gt;&lt;br&gt;
API latency in microservices is defined as the time it takes for the API to receive the request, process the request, and generate a response.&lt;/p&gt;

&lt;p&gt;High API latency can occur due to multiple reasons, including:&lt;/p&gt;

&lt;p&gt;The number of microservices: The more microservices there are in an architecture, the more potential points of latency there are (therefore the problem is bigger when scaling microservices)&lt;/p&gt;

&lt;p&gt;The complexity of the microservices: The more complex the microservices are, the more time it takes for them to process requests.&lt;/p&gt;

&lt;p&gt;The network infrastructure: The quality of the network infrastructure can also impact latency.&lt;/p&gt;

&lt;p&gt;Network latency: The time it takes for a message to travel from one point to another can be a major factor in latency. This can be caused by factors such as distance, network congestion, and packet loss.&lt;/p&gt;

&lt;p&gt;Server latency: The time it takes for a server to process a request can also contribute to latency. This can be caused by factors such as server load, server resources, and the complexity of the request.&lt;/p&gt;

&lt;p&gt;Database latency: The time it takes for a database to return data can also be a factor in latency. This can be caused by factors such as database size, database load, and the complexity of the query.&lt;/p&gt;

&lt;p&gt;API design: The design of the API can also impact latency. For example, if the API is not designed to be efficient, it may require more round trips between the client and the server, which can increase latency.&lt;/p&gt;

&lt;p&gt;Caching: Not using caching can cause the API to fetch data from a slower storage medium, such as a database, every time a request is made.&lt;/p&gt;

&lt;p&gt;Load balancing: If load balancing is not implemented correctly, requests may be routed to overloaded servers.&lt;/p&gt;

&lt;p&gt;Service mesh: If a service mesh is not used, there will be no central point for managing and monitoring microservices.&lt;/p&gt;

&lt;p&gt;Observability: in microservices, If latency is not properly observed, it can lead to performance problems and outages.&lt;br&gt;
**&lt;br&gt;
Troubleshooting high API latency in microservices**&lt;br&gt;
Why do traditional monitoring methods fail?&lt;br&gt;
Traditional monitoring methods fail to troubleshoot API latency in microservices architectures because they were not designed to handle the complexity of such architectures. They typically focus on monitoring individual servers and they alone can’t connect dependencies and performance across the entire customer journey through distributed architecture.&lt;/p&gt;

&lt;p&gt;While monitoring is important, cloud-native application architectures require observability instead. As detailed in our article about API observability versus monitoring, API observability views much wider performance data compared to monitoring, in one place and in real-time, through observing individual services and the dependencies between them. It uses logs, metrics, and tracing to create a holistic strategy for monitoring.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Troubleshooting API latency effectively&lt;/strong&gt;&lt;br&gt;
To troubleshoot API latency in microservices architectures, it is important to use an observability solution that is designed for this type of architecture. These solutions typically provide features such as:&lt;/p&gt;

&lt;p&gt;Distributed tracing: Distributed tracing allows you to see the path that a request takes through a microservices architecture. This can help you to identify the source of latency problems.&lt;/p&gt;

&lt;p&gt;Service level objectives (SLOs): SLOs allow you to define acceptable levels of performance for your microservices. This can help you to identify and troubleshoot latency problems before they impact your users.&lt;/p&gt;

&lt;p&gt;Alerting: Alerting allows you to be notified when there are latency problems in your microservices architecture. This can help you to quickly identify and troubleshoot problems before they impact your users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debugging API latency with distributed tracing and OpenTelemtry&lt;/strong&gt;&lt;br&gt;
Distributed tracing is a way of tracking requests as they travel through a distributed system in order to identify and resolve performance bottlenecks and other problems. The most powerful tool to implement distributed tracing is OpenTelemetry, an OSS observability framework that collects and exports telemetry data from a variety of sources including apps, services, and infrastructure, through data instrumentation. OpenTelemetry can be used to collect data about the request, including the time it took to complete. This data can be used to identify performance bottlenecks and other issues. It’s a great tool as it’s vendor-neutral, and not tied to any specific vendor, technology, language or framework.&lt;/p&gt;

&lt;p&gt;While no doubt that OTel is a life-changing tool, it has a few disadvantages that can be dealt with by using 3rd party tools that are based on this OSS. The main issues include implementation and maintenance complexity, lack of backend storage, lack of a visualization layer, and no actionable insights based on the data it collects.&lt;br&gt;
**&lt;br&gt;
E2E trace-based observability: Visualization and error insights**&lt;br&gt;
For effective troubleshooting of distributed systems and API latency in microservices, in particular, developers need an E2E observability solution that visualizes traces and spans, as well as collects granular error and performance-related data.&lt;/p&gt;

&lt;p&gt;Helios is an OTel-based tool that helps Dev and Ops teams minimize MTTR in distributed applications. It helps developers install and maintain OpenTelemetry in no time, collect the full payload data, store telemetry data, visualize traces and spans, correlate them with logs and metrics, and enable error insights and alerts.&lt;/p&gt;

&lt;p&gt;The tool provides a dashboard for each specific API in the catalog. This includes trends of the recent spans, duration distribution, HTTP response status code, errors and failures, and more. It lets developers filter APIs by errors with the full E2E context of each API call, enabling them to investigate what happened with the most relevant context and flow-drive mindset.&lt;/p&gt;

&lt;p&gt;An example: Root cause analysis of the increase in API latency&lt;br&gt;
This example is also shared in this article: API observability: Leveraging OTel to improve developer experience.&lt;/p&gt;

&lt;p&gt;In this example, the flow showing the visualization is composed of various endpoints and involves several services.&lt;/p&gt;

&lt;p&gt;Here’s the first entry point of the visualization’s API in the app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v5U0jdfj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oikq20eqvv1twczl2532.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v5U0jdfj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oikq20eqvv1twczl2532.png" alt="Image description" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inspecting the API calls with the largest latency based on instrumented data&lt;/p&gt;

&lt;p&gt;Using the API overview for analyzing &amp;amp; troubleshooting latency reported by customers – by quickly identifying the outlier long spans&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--b4mwUlYo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03sv1hn5ck9w7e0ipjbb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b4mwUlYo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03sv1hn5ck9w7e0ipjbb.png" alt="Image description" width="800" height="262"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zeroing in on the API calls and spans that represent the increased latency&lt;/p&gt;

&lt;p&gt;The investigation continues towards a minimal subset of traces, done by clicking on their visualizations and drilling down into the details (through the duration feature that pinpoints the bottlenecks):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Laz0cRxk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/er9hk4wewdkoa8k2n3w8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Laz0cRxk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/er9hk4wewdkoa8k2n3w8.png" alt="Image description" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Analyzing bottlenecks in the E2E flow using trace visualization&lt;/p&gt;

&lt;p&gt;Investigating other spans can reveal a trend and see if the issue occurs in all other traces and if bottlenecks exist in all of them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
In conclusion, API latency poses a major challenge to microservice architectures. It can be caused by a variety of factors, including the number of microservices, their complexity, the network infrastructure, and the design of the API.&lt;/p&gt;

&lt;p&gt;To troubleshoot API latency, it is important to use an observability solution that is specifically designed for microservices architectures. However, not all observability solutions provide all of the features that are needed to troubleshoot API latency in microservice architectures.&lt;/p&gt;

&lt;p&gt;For example, some solutions do not collect data from all of the microservices in an architecture. Others do not provide trace-based visualization, which can make it difficult to identify the source of latency problems. Others still do not provide error insights and alerts, which can make it difficult to take action to resolve latency problems.&lt;/p&gt;

&lt;p&gt;In order to make the most out of OpenTelemetry, you should use a solution that includes both visualization, granular data of the payloads, insights and error alerts.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;About Helios&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Helios is a dev-first observability platform that helps Dev and Ops teams shorten the time to find and fix issues in distributed applications. Built on OpenTelemetry, Helios provides traces and correlates them with logs and metrics, enabling end-to-end app visibility and faster troubleshooting.&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>api</category>
      <category>devops</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>API monitoring vs. observability- Debugging microservices efficiently</title>
      <dc:creator>Elli (Einav Laviv)</dc:creator>
      <pubDate>Mon, 05 Jun 2023 11:17:48 +0000</pubDate>
      <link>https://dev.to/einavlaviv/api-monitoring-vs-observability-debugging-microservices-efficiently-5c6d</link>
      <guid>https://dev.to/einavlaviv/api-monitoring-vs-observability-debugging-microservices-efficiently-5c6d</guid>
      <description>&lt;p&gt;As microservices architecture has become more popular, there has been a growing need for API observability. This is because microservices applications are made up of many small, independent services that communicate with each other through APIs. This can make it difficult to track the performance and health of an application, as well as identify and troubleshoot problems.&lt;/p&gt;

&lt;p&gt;API observability is a broader term than API monitoring. Monitoring focuses on tracking known metrics, such as request latency and response time. Observability, on the other hand, also includes tracking unknown metrics, such as error rates and resource utilization. This allows developers to get a more complete picture of how an API is performing, and to identify problems before they impact users.&lt;/p&gt;

&lt;p&gt;There are a number of tools that can be used to implement API observability. Some popular options include:&lt;/p&gt;

&lt;p&gt;Prometheus: A popular open-source monitoring system that can be used to collect metrics from APIs.&lt;/p&gt;

&lt;p&gt;Grafana: A visualization tool that can be used to display Prometheus metrics.&lt;/p&gt;

&lt;p&gt;Jaeger: A distributed tracing tool that can be used to track requests as they flow through an application.&lt;/p&gt;

&lt;p&gt;By implementing API observability, developers can gain a deeper understanding of how their applications are performing. This can help them to identify and troubleshoot problems more quickly, and to improve the overall performance and reliability of their applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gethelios.dev/blog/api-monitoring-vs-observability-in-microservices-troubleshooting-guide/"&gt;Continue reading&lt;/a&gt; to learn more about:&lt;/p&gt;

&lt;p&gt;-The advantages of observability compared to monitoring&lt;/p&gt;

&lt;p&gt;-The pillars of API observability (functional test automation, performance management, security and analytics)&lt;/p&gt;

&lt;p&gt;-Metrics (API dependencies, API stats, Api spec&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Benefits and examples&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use cases&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;-Evaluating 3rd party tools&lt;/p&gt;

&lt;p&gt;-API observability with openTelemetry and distributed tracing&lt;/p&gt;

&lt;p&gt;-How to make it actionable: Visualization, granular error data and insights&lt;/p&gt;

</description>
      <category>devops</category>
      <category>microservices</category>
      <category>observability</category>
      <category>programming</category>
    </item>
    <item>
      <title>What is OpenTelemetry Tracing: Observability for troubleshooting microservices</title>
      <dc:creator>Elli (Einav Laviv)</dc:creator>
      <pubDate>Sun, 30 Apr 2023 15:54:07 +0000</pubDate>
      <link>https://dev.to/einavlaviv/what-is-opentelemetry-tracing-observability-for-troubleshooting-microservices-4f60</link>
      <guid>https://dev.to/einavlaviv/what-is-opentelemetry-tracing-observability-for-troubleshooting-microservices-4f60</guid>
      <description>&lt;p&gt;OpenTelemetry is buzzing lately and everybody is speaking about distributed tracing as a mean to solve microservices debugging hell and minimize MTTR. &lt;/p&gt;

&lt;p&gt;Developers want to spend less time on debugging and have a better expeirence. Dev leaders need to ensure velocity and quality, lower the cost of the engineeering unit and find creative ways to deliver at scale (especially in today's atmosphere, when saving costs are a main KPI in the tech ecosystem. &lt;/p&gt;

&lt;p&gt;Debugging in microservices is a big pain. huge. &lt;/p&gt;

&lt;p&gt;Dependencies, complexities, endless components- these aspects make route cause analysis extreamly complex and traditional monitoring methods, that are built on statistical analysis, such as logging, can't offer a reasnable solution. &lt;/p&gt;

&lt;p&gt;Microservices observabiity, which differs from monitoring as it is built on data instrumentation and recording events, is needed. &lt;/p&gt;

&lt;p&gt;OPenTelemetry (OSS project) distributed tracing capabilities compensate for traditional observability methods, that master monolith apps but are hardly sufficient in observing and debugging distributed environments. &lt;/p&gt;

&lt;p&gt;OTel allows developers to instrument their microservices apps with the standard instrumentation library that generates telemetry data from various sources, such as logs, metrics, and traces. &lt;/p&gt;

&lt;p&gt;OpenTelemetry agents can then collect and export this telemetry data to multiple systems for logging, tracing, and monitoring. A main advantage of OpenTelemetry is that it aims to be vendor-agnostic, meaning that the data collected can be sent to any backend and moving between them doesn't require any client-side changes. Instrumentation allows deep dive into contextual error data that is needed for fast root cause analysis. &lt;/p&gt;

&lt;p&gt;In order to make OpenTelemetry actionable, there's a need to export the data to a 3rd party tool that can help generating insights, such as Jaeger or alike. &lt;/p&gt;

&lt;p&gt;Some of these tools are better than others, easier to maintain, offer advanced trace based visualization and highlight granular payload data that is critical to understand and solve issues such as bottlenecks, latency, and more. &lt;/p&gt;

&lt;p&gt;Overview this article about OTel specifics as well as best practices and tools to minimize overhead and maximize the value &amp;gt;&amp;gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://gethelios.dev/blog/opentelemetry-tracing/"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>OpenTelemetry Python – Walkthrough and Examples</title>
      <dc:creator>Elli (Einav Laviv)</dc:creator>
      <pubDate>Mon, 10 Apr 2023 11:50:16 +0000</pubDate>
      <link>https://dev.to/einavlaviv/opentelemetry-python-walkthrough-and-examples-1b9b</link>
      <guid>https://dev.to/einavlaviv/opentelemetry-python-walkthrough-and-examples-1b9b</guid>
      <description>&lt;p&gt;Visit the original article that includes videos &amp;gt; &lt;a href="https://gethelios.dev/blog/opentelemetry-python/"&gt;OpenTelemetry Python – Walkthrough and Examples&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OpenTelemetry in a Nutshell: &lt;/p&gt;

&lt;p&gt;Microservices architecture has become the new norm for modern applications due to its numerous advantages compared to traditional monolithic architecture. However, microservices also come with several challenges. Especially when it comes to observability, traditional monitoring tools and techniques can no longer handle microservices’ distributed and dynamic nature.&lt;/p&gt;

&lt;p&gt;This is where OpenTelemetry distributed tracing comes in. It’s an open-source observability framework that allows developers to capture telemetry data from distributed cloud-native applications. It provides APIs, tools, and SDKs to collect and generate traces, metrics, and logs. OpenTelemetry can be used with multiple programming languages, including Python, Java, JavaScript, Go, Ruby, and C++.&lt;/p&gt;

&lt;p&gt;One of its key features is its ability to capture and propagate distributed traces and spans across different services and components. It also supports capturing and exporting metrics like request latency, error rates, and resource usage that can be used to monitor and generate alerts on various aspects of the system.&lt;/p&gt;

&lt;p&gt;Compared to traditional monitoring approaches, OpenTelemetry has many advantages and resolves several pain points.&lt;/p&gt;

&lt;p&gt;OpenTelemetry provides a unified and standardized method for collecting telemetry data, simplifying the correlation and analysis of data from various sources.&lt;br&gt;
It supports multiple export formats, including popular observability platforms like Prometheus, Jaeger, and Zipkin.&lt;br&gt;
It’s a vendor-agnostic, future-proof, and community-driven solution that ensures interoperability and extensibility.&lt;br&gt;
In this article, we will guide you through the process of python tracing by using OpenTelemetry with Python to capture and export traces and metrics from your applications. We will discuss the essential components of OpenTelemetry and provide examples of integrating it with popular observability platforms.&lt;/p&gt;

&lt;p&gt;Python OpenTelemetry Tutorial – Installation Walkthrough&lt;br&gt;
Installing OTel in Python enables Python monitoring and tracking (I will later on also share some info about Python monitoring tools that offer additional value on top of OTel). As you will see now, it is pretty straightforward. You can either use the OpenTelemetry manual instrumentation approach or the OpenTelemetry auto instrumentation approach. Here, I will walk you through both methods using a simple Flask application and OpenTelemetry Python SDK&lt;/p&gt;

&lt;p&gt;Prerequisite – Creating the Python application&lt;br&gt;
Install the Flask framework using pip3 install flask command, and create a file named server.py. Then, update it with the code below.&lt;/p&gt;

&lt;p&gt;from flask import Flask&lt;br&gt;
import random&lt;br&gt;
app = Flask(name)&lt;br&gt;
@app.route('/random')&lt;br&gt;
def index():&lt;br&gt;
  number = random.randint(0,100)&lt;br&gt;
  return 'Random Number : %d' % number&lt;br&gt;
app.run(host='0.0.0.0', port=8000)&lt;br&gt;
The above code will return a random number between 0 and 100 when the endpoint is called. You can test it by running the project using the flask run –app server.py command.&lt;/p&gt;

&lt;p&gt;OpenTelemetry Manual Instrumentation&lt;br&gt;
First, I will take you through the sets of OTel manual instrumentation.&lt;/p&gt;

&lt;p&gt;Step 1 – Installing OpenTelemetry libraries&lt;br&gt;
Install opentelemetry-api and opentelemetry-sdk libraries to start instrumenting your Python applications with OpenTelemetry.&lt;/p&gt;

&lt;p&gt;pip install opentelemetry-api &lt;br&gt;
pip install opentelemetry-sdk&lt;/p&gt;

&lt;p&gt;Once the libraries are installed, you can add a tracer object to your server.py file using the following code:&lt;/p&gt;

&lt;p&gt;from opentelemetry import trace&lt;br&gt;
from opentelemetry.sdk.resources import Resource&lt;br&gt;
from opentelemetry.sdk.trace import TracerProvider&lt;br&gt;
from opentelemetry.sdk.trace.export import BatchSpanProcessor&lt;br&gt;
from opentelemetry.sdk.trace.export import ConsoleSpanExporter&lt;br&gt;
provider = TracerProvider() &lt;br&gt;
processor = BatchSpanProcessor(ConsoleSpanExporter()) # &lt;br&gt;
provider.add_span_processor(processor)&lt;br&gt;
trace.set_tracer_provider(provider)&lt;br&gt;
tracer = trace.get_tracer(name)&lt;/p&gt;

&lt;p&gt;The above configuration includes a provider, a processor, and a tracer. The provider (TracingProvider), serves as the API entry point that holds the configuration. The processor specifies how to send the created spans forward. The tracer, on the other hand, is the actual object that generates the spans.&lt;/p&gt;

&lt;p&gt;Step 2 – Adding a tracer to the Flask route&lt;/p&gt;

&lt;p&gt;Then, you can add a tracer object to the Flask route like the below:&lt;/p&gt;

&lt;p&gt;@app.route('/random')&lt;br&gt;
def index():&lt;br&gt;
  with tracer.start_as_current_span("server_request"):&lt;br&gt;
   number = random.randint(0,100)&lt;br&gt;
   return 'Random Number : %d' % number&lt;/p&gt;

&lt;p&gt;app.run(host='0.0.0.0', port=8000)&lt;/p&gt;

&lt;p&gt;Then, restart the application and call the route to see the tracing information in the console.&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
    "name": "server_request",&lt;br&gt;
    "context": {&lt;br&gt;
        "trace_id": "0x9f1bcbe7c34237ead06a35162f37dc83",&lt;br&gt;
        "span_id": "0x2d42807b6e77dbe4",&lt;br&gt;
        "trace_state": "[]"&lt;br&gt;
    },&lt;br&gt;
    "kind": "SpanKind.INTERNAL",&lt;br&gt;
    "parent_id": null,&lt;br&gt;
    "start_time": "2023-03-16T17:24:07.025035Z",&lt;br&gt;
    "end_time": "2023-03-16T17:24:07.025035Z",&lt;br&gt;
    "status": {&lt;br&gt;
        "status_code": "UNSET"&lt;br&gt;
    },&lt;br&gt;
    "attributes": {},&lt;br&gt;
    "events": [],&lt;br&gt;
    "links": [],&lt;br&gt;
    "resource": {&lt;br&gt;
        "attributes": {&lt;br&gt;
            "telemetry.sdk.language": "python",&lt;br&gt;
            "telemetry.sdk.name": "opentelemetry",&lt;br&gt;
            "telemetry.sdk.version": "1.15.0",&lt;br&gt;
            "service.name": "unknown_service"&lt;br&gt;
        },&lt;br&gt;
        "schema_url": ""&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;However, the above tracing information does not provide much information besides the span ID, trace ID, and start and end times. So, let’s see how we can get more insights.&lt;/p&gt;

&lt;p&gt;Step 3 – Updating the span to get more insights&lt;/p&gt;

&lt;p&gt;We can get more details by adding an event to the random number generation function.&lt;/p&gt;

&lt;p&gt;@app.route('/random')&lt;br&gt;
def index():&lt;br&gt;
  with tracer.start_as_current_span(&lt;br&gt;
    "server_request", &lt;br&gt;
    attributes={ "endpoint": "/random" &lt;br&gt;
  }):&lt;br&gt;
   span = trace.get_current_span()&lt;br&gt;
   number = random.randint(0,100)&lt;br&gt;
   span.add_event( "log", {&lt;br&gt;
      "random number": number&lt;br&gt;
    })&lt;br&gt;
   return 'Random Number : %d' % number &lt;/p&gt;

&lt;p&gt;app.run(host='0.0.0.0', port=8000)&lt;/p&gt;

&lt;p&gt;In the above example, we start by adding an attribute to the span in the tracing start method. Then, we retrieve the current span and add an event to be triggered with each API call.&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
   "name": "server_request",&lt;br&gt;
    "context": {&lt;br&gt;
        "trace_id": "0x9f0f2b9c658a1dba5ab169a19c4c226b",&lt;br&gt;
        "span_id": "0x9d18fdc373ae912a",&lt;br&gt;
        "trace_state": "[]"&lt;br&gt;
    },&lt;br&gt;
    "kind": "SpanKind.INTERNAL",&lt;br&gt;
    "parent_id": null,&lt;br&gt;
    "start_time": "2023-03-17T18:17:39.626005Z",&lt;br&gt;
    "end_time": "2023-03-17T18:17:39.626005Z",&lt;br&gt;
    "status": {&lt;br&gt;
        "status_code": "UNSET"&lt;br&gt;
    },&lt;br&gt;
    "attributes": {&lt;br&gt;
        "endpoint": "/random"&lt;br&gt;
    },&lt;br&gt;
    "events": [&lt;br&gt;
        {&lt;br&gt;
            "name": "log",&lt;br&gt;
            "timestamp": "2023-03-17T18:17:39.626005Z",&lt;br&gt;
            "attributes": {&lt;br&gt;
                "random number": 64&lt;br&gt;
            }&lt;br&gt;
        }&lt;br&gt;
    ],&lt;br&gt;
    "links": [],&lt;br&gt;
    "resource": {&lt;br&gt;
        "attributes": {&lt;br&gt;
            "telemetry.sdk.language": "python",&lt;br&gt;
            "telemetry.sdk.name": "opentelemetry",&lt;br&gt;
            "telemetry.sdk.version": "1.15.0",&lt;br&gt;
            "service.name": "unknown_service"&lt;br&gt;
        },&lt;br&gt;
        "schema_url": ""&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;As you can see, now, the tracing log provides more insights, including the endpoint, timestamp of the API call, and the result.&lt;/p&gt;

&lt;p&gt;OpenTelemetry Automatic Instrumentation for Python&lt;/p&gt;

&lt;p&gt;Instead of manually configuring attributes and events, you can use OpenTelemetry automatic instrumentation to standardize the process and enable &lt;a href="https://gethelios.dev/python-observability/"&gt;Python observability&lt;/a&gt; without the manual load. It allows instrumenting your application without code modifications using monkey patching or bytecode injection.&lt;/p&gt;

&lt;p&gt;However, automatic OTel instrumentation has limitations and is not as straightforward as a span per function. Instead, it is custom-implemented for several frameworks in a significant manner. Hence, it is necessary to check the supported frameworks before you start.&lt;/p&gt;

&lt;p&gt;Step 1 – Installing OpenTelemetry libraries&lt;/p&gt;

&lt;p&gt;First, you need to install opentelemetry-instrumentation-flask using the below command.&lt;/p&gt;

&lt;p&gt;pip install opentelemetry-instrumentation-flask&lt;/p&gt;

&lt;p&gt;Else, you can use opentelemetry-bootstrap -a install command to install auto instrumentation packages for all Python frameworks.&lt;/p&gt;

&lt;p&gt;Step 2 – Running the application&lt;/p&gt;

&lt;p&gt;Now, you do not need any code modifications. You can simply run the application with a few additional command line arguments.&lt;/p&gt;

&lt;p&gt;opentelemetry-instrument –traces_exporter console flask run&lt;/p&gt;

&lt;p&gt;The above command uses –traces_exporter flag to export the traces to the console. You can find more on other configuration options here.&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
    "name": "/random",&lt;br&gt;
    "context": {&lt;br&gt;
        "trace_id": "0x541995dffa03529463f2885661ba2550",&lt;br&gt;
        "span_id": "0xde86468a94d54239",&lt;br&gt;
        "trace_state": "[]"&lt;br&gt;
    },&lt;br&gt;
    "kind": "SpanKind.SERVER",&lt;br&gt;
    "parent_id": null,&lt;br&gt;
    "start_time": "2023-03-18T16:43:57.553799Z",&lt;br&gt;
    "end_time": "2023-03-18T16:43:57.554797Z",&lt;br&gt;
    "status": {&lt;br&gt;
        "status_code": "UNSET"&lt;br&gt;
    },&lt;br&gt;
    "attributes": {&lt;br&gt;
        "http.method": "GET",&lt;br&gt;
        "http.server_name": "127.0.0.1",&lt;br&gt;
        "http.scheme": "http",&lt;br&gt;
        "net.host.port": 5000,&lt;br&gt;
        "http.host": "127.0.0.1:5000",&lt;br&gt;
        "http.target": "/random",&lt;br&gt;
        "net.peer.ip": "127.0.0.1",&lt;br&gt;
        "http.user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",&lt;br&gt;
        "net.peer.port": 56717,&lt;br&gt;
        "http.flavor": "1.1",&lt;br&gt;
        "http.route": "/random",&lt;br&gt;
        "http.status_code": 200&lt;br&gt;
    },&lt;br&gt;
    "events": [],&lt;br&gt;
    "links": [],&lt;br&gt;
    "resource": {&lt;br&gt;
        "attributes": {&lt;br&gt;
            "telemetry.sdk.language": "python",&lt;br&gt;
            "telemetry.sdk.name": "opentelemetry",&lt;br&gt;
            "telemetry.sdk.version": "1.15.0",&lt;br&gt;
            "telemetry.auto.version": "0.36b0",&lt;br&gt;
            "service.name": "unknown_service"&lt;br&gt;
        },&lt;br&gt;
        "schema_url": ""&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;As you can see, the above trace log shows more details than the manual instrumentation process, and we didn’t have to make any manual code modifications.&lt;/p&gt;

&lt;p&gt;Adding Advanced Visualization and Context for Python Spans and Traces&lt;/p&gt;

&lt;p&gt;Tools like Jaeger offer visibility into spans and traces by providing basic visualization to see each span’s start and end times, relationships, and contextual information, such as the span ID and trace ID. However, these tools do not fully leverage the potential of OpenTelemetry. They have some significant limitations, like the lack of advanced visualization options, providing limited context, and missing data on the calls. Hence, we need tools with more advanced visualization and context support to get the maximum from the OTel Python instrumentation.&lt;/p&gt;

&lt;p&gt;That’s where tools like Helios come in. It is a developer-observability solution built on OpenTelemetry that provides actionable insight into the end-to-end application flow. Recently, I used Helios with a Python (Flask) application, and it provided some amazing features like advanced visualizations, bottleneck identification, workflow reproduction, trace-based test generation, and end-to-end visibility.&lt;/p&gt;

&lt;p&gt;So, let’s see how to integrate Helios with Python – OpenTelemetry instrumentation to increase observability while reducing the troubleshooting and debugging time.&lt;/p&gt;

&lt;p&gt;Step 1 – Create a Helios Account&lt;/p&gt;

&lt;p&gt;First, create a new Helios account.&lt;/p&gt;

&lt;p&gt;Helios distrbuted tracing signin screen&lt;/p&gt;

&lt;p&gt;Once the account is created, you will get a UI like the one below with installation commands and configurations for all the languages supported by Helios.&lt;/p&gt;

&lt;p&gt;Multi lang and environments support - Helios distributed tracing &lt;/p&gt;

&lt;p&gt;Step 2 – Installing Helios Python SDK&lt;/p&gt;

&lt;p&gt;Install Helios SDK for your Python application with the below code:&lt;/p&gt;

&lt;p&gt;pip install helios-opentelemetry-sdk&lt;/p&gt;

&lt;p&gt;Then, all you need to do is set the environment variables, as in the screenshot from step 1.&lt;/p&gt;

&lt;p&gt;export AUTOWRAPT_BOOTSTRAP="helios" # TODO: Variable should be set before process starts.&lt;br&gt;
export HS_TOKEN="6ec524268408451d9854"&lt;br&gt;
export HS_SERVICE_NAME="" # TODO: Replace value with service name.&lt;br&gt;
export HS_ENVIRONMENT="" # TODO: Replace value with service environment.&lt;/p&gt;

&lt;p&gt;If not, you can import Helios and initialize a connection using the token. But the recommended way is to use environment variables.&lt;/p&gt;

&lt;p&gt;from flask import Flask&lt;br&gt;
import random&lt;br&gt;
from helios import initialize&lt;br&gt;
initialize(&lt;br&gt;
  api_token='f1e8b1f587cebd6e45e8', # Insert API Token here.&lt;br&gt;
  service_name='my-python-service', # Insert service name.&lt;br&gt;
  enabled=True,        # Defaults to False if omitted.&lt;br&gt;
  environment='DEPLOYMENT_ENV',  # Defaults to os.environ.get('DEPLOYMENT_ENV') if omitted.&lt;br&gt;
  commit_hash='COMMIT_HASH',  # Defaults to os.environ.get('COMMIT_HASH') if omitted.&lt;br&gt;
)&lt;br&gt;
app = Flask(name)&lt;/p&gt;

&lt;p&gt;@app.route('/random')&lt;br&gt;
def index():&lt;br&gt;
  number = random.randint(0,100)&lt;br&gt;
  return 'Random Number : %d' % number &lt;/p&gt;

&lt;p&gt;app.run(host='0.0.0.0', port=8000)&lt;/p&gt;

&lt;p&gt;Step 3 – Observe the Trace Visualizations&lt;/p&gt;

&lt;p&gt;Now, restart the application and refresh the Helios dashboard to get the actionable data of your application.&lt;/p&gt;

&lt;p&gt;Helios dashboard - get the actionable data of your application.&lt;/p&gt;

&lt;p&gt;As you can see, Helios provides more advanced visualization and context for spans and traces in your Python application compared to stand-alone OTel or Jaeger.&lt;/p&gt;

&lt;p&gt;The API tab lists all the API endpoints of the applications, and you can get trace and span data on each API by clicking on them.&lt;/p&gt;

&lt;p&gt;The Traces tab will list all the traces, and you can get trace visualizations and timelines by clicking on them.&lt;/p&gt;

&lt;p&gt;As the number of services and endpoints increase, visualizations and insights provided by OpenTelemetry can be incredibly helpful in troubleshooting and debugging your applications. Most importantly, the entire process only requires two simple steps.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
This article discussed the importance of OpenTemeletry in modern microservices architecture and the step to manually and automatically instrument your Python applications with OpenTelemetry, it also shares OpenTelemetry python examples. However, troubleshooting modern distributed applications requires more insights and actionable data to identify the issues to reduce the MTTR. Hence, getting familiar with advanced visualization and context tools like Helios is important to make your work much easier.&lt;/p&gt;

&lt;p&gt;Thank you for Reading.&lt;/p&gt;

</description>
      <category>python</category>
      <category>microservices</category>
      <category>opentelemetry</category>
    </item>
    <item>
      <title>OTel for the rescue - dev first API observability</title>
      <dc:creator>Elli (Einav Laviv)</dc:creator>
      <pubDate>Wed, 29 Mar 2023 10:36:45 +0000</pubDate>
      <link>https://dev.to/einavlaviv/otel-for-the-rescue-dev-first-api-observability-14k9</link>
      <guid>https://dev.to/einavlaviv/otel-for-the-rescue-dev-first-api-observability-14k9</guid>
      <description>&lt;p&gt;This article discusses how API observability powered by OTel distrubted tracing and instrumented data helps developers debug issues much faster and minimize MTTR in microservices. &lt;/p&gt;

&lt;p&gt;We all know the davatages of APIs, today's SW developement pretty much relaes on them. But, here as well, distributed architectures make it hard to have control and visibility over all APIs across all microservices, and know where exactly they are used and how. &lt;/p&gt;

&lt;p&gt;Actual instrumentated data improves the developer experience by providing API observability and troubleshooting capabilities. In short, it enables visibility into API inventory, specs &amp;amp; runs and therefore is helping identify and debug issues instantly and minimize MTTR. This article is written by a developer at Helios, using API observability features in the platform to monitor and troubleshoot the app she works on. &lt;/p&gt;

&lt;p&gt;Specifically, she talks about applying API observability in the following ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using an auto-generated API catalog, enabling discovery of the entire API inventory used by an application&lt;/li&gt;
&lt;li&gt;Using API overview and spec tools, providing access to API documentation and performance as calculated automatically based on instrumented API calls&lt;/li&gt;
&lt;li&gt;API troubleshooting, allowing immediate access to different kinds of API errors and failures – including the full E2E context coming from distributed tracing and context propagation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Continue to the full article to learn more and review examples: &lt;br&gt;
&lt;a href="https://gethelios.dev/blog/api-observability-leveraging-otel-to-improve-developer-experience/"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opentelemetry</category>
      <category>api</category>
      <category>microservices</category>
      <category>observability</category>
    </item>
    <item>
      <title>Jaeger Tracing - Theory and practice</title>
      <dc:creator>Elli (Einav Laviv)</dc:creator>
      <pubDate>Sun, 26 Mar 2023 09:13:24 +0000</pubDate>
      <link>https://dev.to/einavlaviv/jaeger-tracing-theory-and-practice-3ggl</link>
      <guid>https://dev.to/einavlaviv/jaeger-tracing-theory-and-practice-3ggl</guid>
      <description>&lt;p&gt;For the full article, visit:(&lt;a href="https://gethelios.dev/blog/jaeger-vs-helios-which-one-should-you-choose/"&gt;https://gethelios.dev/blog/jaeger-vs-helios-which-one-should-you-choose/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;OpenTelemetry (OTel), is an OSs that provides tools, APIs and SDKs for microservices observability based data collection (i.e, logs, metrics and traces) and therefore it's tailored to cloud native apps. &lt;/p&gt;

&lt;p&gt;Developers use the data collected by OTel for monitoring apps health and performance and debugging and testing microservices. The data can be exported externally to tools, like APMs, open source Jaeger and Zipkin, Helios, and others. &lt;/p&gt;

&lt;p&gt;In this article, we’ll explain Jaeger tracing compared to  OpenTelemetry, and demonstrate how they can be enriched with advanced observability and insights for troubleshooting microservices &amp;gt;&amp;gt; &lt;a href="https://gethelios.dev/blog/jaeger-vs-helios-which-one-should-you-choose/"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opentelemetry</category>
      <category>microservices</category>
      <category>devops</category>
      <category>otel</category>
    </item>
    <item>
      <title>Golang Distributed Tracing with OpenTelemetry - Solving the Challenge</title>
      <dc:creator>Elli (Einav Laviv)</dc:creator>
      <pubDate>Sun, 05 Mar 2023 12:07:09 +0000</pubDate>
      <link>https://dev.to/einavlaviv/golang-distributed-tracing-with-opentelemetry-solving-the-challenge-3h5a</link>
      <guid>https://dev.to/einavlaviv/golang-distributed-tracing-with-opentelemetry-solving-the-challenge-3h5a</guid>
      <description>&lt;p&gt;This is a preview - LInk to the full article is provided below&lt;/p&gt;

&lt;p&gt;OpenTelemetry (OTel ) an open-source framework for trace based observability, provides a standard set of vendor-agonistic SDKs, APIs, and variety of tools to connect with observability backends. It supports all major programming languages, including Java, Python, Node.js, dotnet and Go.&lt;/p&gt;

&lt;p&gt;However, Golang distributed tracing (for observability, debugging and testing), through integrating OTel with Go is challenging due to several reasons. &lt;/p&gt;

&lt;p&gt;This article demonstrates the biggest challenges and it offers a new approach instead, for compile-time auto-instrumentation makes the process of tracing Golang faster and with much less friction.&lt;/p&gt;

&lt;p&gt;Read on how Golang tracing is executed today, and view an example of the exact steps to simplify it&lt;/p&gt;

&lt;p&gt;Read more - Golang Distributed Tracing with OpenTelemetry - Solving the Challenge - &lt;a href="https://gethelios.dev/blog/golang-distributed-tracing-opentelemetry-based-observability/"&gt;https://gethelios.dev/blog/golang-distributed-tracing-opentelemetry-based-observability/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>go</category>
      <category>distributedsystems</category>
      <category>devops</category>
      <category>microservices</category>
    </item>
  </channel>
</rss>
