SlideShare a Scribd company logo
1
Distributed Tracing using
OpenTelemetry and Jaeger
1
Prepared by: AJ
2
2
● Several years ago when you had a monolithic application, it was
fairly easy to debug and diagnose since there was probably only
one service with a couple of users.
● Nowadays systems are broken up into smaller microservices
deployed in containers on top of Kubernetes in multiple clusters
across different cloud environments.
● In these kinds of distributed environments, there is a need to
observe it all, both the overall picture, and, if need be, at a more
granular level.
3
3
● Observability can be roughly divided into three sub-categories:
logging, metrics, and tracing.
● Tracing is the term used to describe the activity of recording and
observing requests made by an application, and how those
requests propagate through a system.
● When systems are set up in a distributed fashion, we call this
distributed tracing as it involves observing the application and its
interactions through multiple systems.
● For example, as a developer your code probably includes multiple
functions, but you are more interested in how long the functions
take to execute and the interdependency of those functions as they
are used in the application.
4
4
Tracing will give the necessary insights by
● Identifying performance and latency bottlenecks
● Finding root cause analysis after major incidents
● Determining dependencies in multi-service
architecture
● Monitoring transactions within your application
5
5
● Let’s start by taking a look where it makes
sense to add tracing.
● Here we’ll get started with a small Python
application that will show a couple of
simple operations.
● We’ll then later add the code for tracing to
measure the time it takes for our code to
execute.
6
6
Initially the code would look something like this
minio_client.fput_object(config["dest_bucket"],
file_path, file_path)
7
7
8
8
Install OpenTelemetry…
$ pip install opentelemetry-api
$ pip install opentelemetry-sdk
and import Trace
from opentelemetry import trace
9
9
Initialize the trace…
resource = Resource(attributes={
SERVICE_NAME: "my-minio"
})
provider = TracerProvider(resource=resource)
processor = BatchSpanProcessor(ConsoleSpanExporter())
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)
tracer = trace.get_tracer(__name__)
and create a Span
with tracer.start_as_current_span("check if
bucket exist"):
10
10
You can create additional multiple spans
with tracer.start_as_current_span("create object to add"):
with tracer.start_as_current_span("add created object to bucket"):
with tracer.start_as_current_span("fetch object from bucket"):
with tracer.start_as_current_span("remove object from bucket"):
with tracer.start_as_current_span("check if bucket exists"):
11
11
Once a span is created you can add custom attributes
● Adding a function name
current_span.set_attribute("function.name", "CHECK_BUCKET")
● Adding a Span event
current_span.add_event("Checking if bucket exists.")
if not minio_client.bucket_exists(config["dest_bucket"]):
current_span.add_event("Bucket does not exist, going to create it.")
minio_client.make_bucket(config["dest_bucket"])
12
12
You can create multiple span events
current_span.add_event("Test object has been placed in bucket.")
current_span.add_event("Test object has been fetched from
bucket.")
current_span.add_event("Test object has been removed from
bucket.")
current_span.add_event("Bucket exists, going to remove it.")
13
13
Configuring Jaeger
● Install Jaeger package
pip install opentelemetry-exporter-jaeger
● Import and Configure Jaeger
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
jaeger_exporter = JaegerExporter(
agent_host_name="localhost",
agent_port=6831,
)
14
14
Go to http://localhost:16686/ to access the Jaeger UI
15
15
Using Jaeger UI find the traces
16
16
So far we’ve only made one request, and there should
be a couple of traces from the few spans we created.
17
17
Click on one of the traces which shows 2 Spans; let's
choose the one that says “check if bucket exists”.
18
18
After running the script five to six times, we can start
to see patterns emerge.
19
19
Is tracing the only option?
● Tracing is just one of the pieces in the path
towards observability.
● Generally when incidents happen it's not just
one trace or one log or one metric that we use to
determine and resolve the issue.
● Often it is understanding the combination of
these things that is required to get to the root
cause.
20
Thank You
LinkedIn: aj-jester
https://www.linkedin.com/in/aj-jester/

More Related Content

Similar to stackconf 2024 | Ignite: Distributed Tracing using OpenTelemetry and Jaeger by AJ Jester.pdf

Guray Yildirim "Tooling and Managing Docker Containers With Python: Why and How"
Guray Yildirim "Tooling and Managing Docker Containers With Python: Why and How"Guray Yildirim "Tooling and Managing Docker Containers With Python: Why and How"
Guray Yildirim "Tooling and Managing Docker Containers With Python: Why and How"
Fwdays
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
Nicole Gomez
 
Kubernetes Java Operator
Kubernetes Java OperatorKubernetes Java Operator
Kubernetes Java Operator
Anthony Dahanne
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
Arvind Kumar G.S
 
Jaeger Integration with Spring Cloud
Jaeger Integration with Spring CloudJaeger Integration with Spring Cloud
Jaeger Integration with Spring Cloud
Inexture Solutions
 
Research Paper
Research PaperResearch Paper
Research Paper
Netravati Patil
 
Understanding and Extending Prometheus AlertManager
Understanding and Extending Prometheus AlertManagerUnderstanding and Extending Prometheus AlertManager
Understanding and Extending Prometheus AlertManager
Lee Calcote
 
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Brian Brazil
 
Monitoring Kubernetes with Prometheus
Monitoring Kubernetes with PrometheusMonitoring Kubernetes with Prometheus
Monitoring Kubernetes with Prometheus
Grafana Labs
 
Struts notes
Struts notesStruts notes
Struts notes
Rajeev Uppala
 
Designing a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpointDesigning a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpoint
Chandim Sett
 
Android Trainning Session 2
Android Trainning  Session 2Android Trainning  Session 2
Android Trainning Session 2
Shanmugapriya D
 
Kubernetes Architecture with Components
 Kubernetes Architecture with Components Kubernetes Architecture with Components
Kubernetes Architecture with Components
Ajeet Singh
 
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio TavillaOpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
Lorenzo Carnevale
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
Rishabh Indoria
 
Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...
Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...
Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...
Stackify
 
Microservices in Java
Microservices in JavaMicroservices in Java
Microservices in Java
Anatole Tresch
 
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio TavillaOpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
Lorenzo Carnevale
 
給 RD 的 Kubernetes 初體驗 (EKS version)
給 RD 的 Kubernetes 初體驗 (EKS version)給 RD 的 Kubernetes 初體驗 (EKS version)
給 RD 的 Kubernetes 初體驗 (EKS version)
William Yeh
 
Openshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceOpenshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhce
Darnette A
 

Similar to stackconf 2024 | Ignite: Distributed Tracing using OpenTelemetry and Jaeger by AJ Jester.pdf (20)

Guray Yildirim "Tooling and Managing Docker Containers With Python: Why and How"
Guray Yildirim "Tooling and Managing Docker Containers With Python: Why and How"Guray Yildirim "Tooling and Managing Docker Containers With Python: Why and How"
Guray Yildirim "Tooling and Managing Docker Containers With Python: Why and How"
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
 
Kubernetes Java Operator
Kubernetes Java OperatorKubernetes Java Operator
Kubernetes Java Operator
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
 
Jaeger Integration with Spring Cloud
Jaeger Integration with Spring CloudJaeger Integration with Spring Cloud
Jaeger Integration with Spring Cloud
 
Research Paper
Research PaperResearch Paper
Research Paper
 
Understanding and Extending Prometheus AlertManager
Understanding and Extending Prometheus AlertManagerUnderstanding and Extending Prometheus AlertManager
Understanding and Extending Prometheus AlertManager
 
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
Monitoring Kubernetes with Prometheus (Kubernetes Ireland, 2016)
 
Monitoring Kubernetes with Prometheus
Monitoring Kubernetes with PrometheusMonitoring Kubernetes with Prometheus
Monitoring Kubernetes with Prometheus
 
Struts notes
Struts notesStruts notes
Struts notes
 
Designing a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpointDesigning a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpoint
 
Android Trainning Session 2
Android Trainning  Session 2Android Trainning  Session 2
Android Trainning Session 2
 
Kubernetes Architecture with Components
 Kubernetes Architecture with Components Kubernetes Architecture with Components
Kubernetes Architecture with Components
 
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio TavillaOpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (kilo) by Lorenzo Carnevale and Silvio Tavilla
 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
 
Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...
Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...
Leveraging Python Telemetry, Azure Application Logging, and Performance Testi...
 
Microservices in Java
Microservices in JavaMicroservices in Java
Microservices in Java
 
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio TavillaOpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
OpenStack Identity - Keystone (liberty) by Lorenzo Carnevale and Silvio Tavilla
 
給 RD 的 Kubernetes 初體驗 (EKS version)
給 RD 的 Kubernetes 初體驗 (EKS version)給 RD 的 Kubernetes 初體驗 (EKS version)
給 RD 的 Kubernetes 初體驗 (EKS version)
 
Openshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceOpenshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhce
 

Recently uploaded

Tata Technologies - Investor Presentation Q1 FY 2024-25
Tata Technologies - Investor Presentation Q1 FY 2024-25Tata Technologies - Investor Presentation Q1 FY 2024-25
Tata Technologies - Investor Presentation Q1 FY 2024-25
Tata Technologies
 
stackconf 2024 | Make You Ops-Life Easy – ansible usecases you didn´t out of ...
stackconf 2024 | Make You Ops-Life Easy – ansible usecases you didn´t out of ...stackconf 2024 | Make You Ops-Life Easy – ansible usecases you didn´t out of ...
stackconf 2024 | Make You Ops-Life Easy – ansible usecases you didn´t out of ...
NETWAYS
 
ResearchPortfolioForGoogle_Version_1.pptx
ResearchPortfolioForGoogle_Version_1.pptxResearchPortfolioForGoogle_Version_1.pptx
ResearchPortfolioForGoogle_Version_1.pptx
Aarushi Shah
 
stackconf 2024 | Rethinking Package Management in Kubernetes with Helm and Gl...
stackconf 2024 | Rethinking Package Management in Kubernetes with Helm and Gl...stackconf 2024 | Rethinking Package Management in Kubernetes with Helm and Gl...
stackconf 2024 | Rethinking Package Management in Kubernetes with Helm and Gl...
NETWAYS
 
Toast To TGIS- Newsletter June 2024 TGIS.pdf
Toast To TGIS- Newsletter June 2024 TGIS.pdfToast To TGIS- Newsletter June 2024 TGIS.pdf
Toast To TGIS- Newsletter June 2024 TGIS.pdf
toastmasterstgis
 
stackconf 2024 | IGNITE: Practical AI with Machine Learning for Observability...
stackconf 2024 | IGNITE: Practical AI with Machine Learning for Observability...stackconf 2024 | IGNITE: Practical AI with Machine Learning for Observability...
stackconf 2024 | IGNITE: Practical AI with Machine Learning for Observability...
NETWAYS
 
Communication Skills........Let's Learn
Communication Skills........Let's Learn Communication Skills........Let's Learn
Communication Skills........Let's Learn
pdtrainernayab
 
Fertilizer production by indorama fertilizer co.pptx
Fertilizer production by indorama fertilizer co.pptxFertilizer production by indorama fertilizer co.pptx
Fertilizer production by indorama fertilizer co.pptx
JohnMatthew62
 
Cal Girls Nirman Nagar Jaipur | 8445551418 | Top Class High Profile Beauty Girl
Cal Girls Nirman Nagar Jaipur | 8445551418 | Top Class High Profile Beauty GirlCal Girls Nirman Nagar Jaipur | 8445551418 | Top Class High Profile Beauty Girl
Cal Girls Nirman Nagar Jaipur | 8445551418 | Top Class High Profile Beauty Girl
pradeepkumar66952#S007
 
Securing Your Dream Job as a Flutter Developer
Securing Your Dream Job  as a Flutter DeveloperSecuring Your Dream Job  as a Flutter Developer
Securing Your Dream Job as a Flutter Developer
Ahmed Abu Eldahab
 
stackconf 2024 | Ignite DevOps Driving School – Explaining DevOps in 5 Minute...
stackconf 2024 | Ignite DevOps Driving School – Explaining DevOps in 5 Minute...stackconf 2024 | Ignite DevOps Driving School – Explaining DevOps in 5 Minute...
stackconf 2024 | Ignite DevOps Driving School – Explaining DevOps in 5 Minute...
NETWAYS
 
Cal Girls Shyam Nagar Jaipur | 8445551418 | Sweet Girls Call With Hotels
Cal Girls Shyam Nagar Jaipur | 8445551418 | Sweet Girls Call With HotelsCal Girls Shyam Nagar Jaipur | 8445551418 | Sweet Girls Call With Hotels
Cal Girls Shyam Nagar Jaipur | 8445551418 | Sweet Girls Call With Hotels
chanchalrani3534
 
stackconf 2024 | Talos Linux One (Immutable) OS to Rule Them All by Pip Oomen...
stackconf 2024 | Talos Linux One (Immutable) OS to Rule Them All by Pip Oomen...stackconf 2024 | Talos Linux One (Immutable) OS to Rule Them All by Pip Oomen...
stackconf 2024 | Talos Linux One (Immutable) OS to Rule Them All by Pip Oomen...
NETWAYS
 
Cal Girls Bani Park Jaipur | | Girls Call Free Drop Service
Cal Girls Bani Park Jaipur | | Girls Call Free Drop ServiceCal Girls Bani Park Jaipur | | Girls Call Free Drop Service
Cal Girls Bani Park Jaipur | | Girls Call Free Drop Service
Deepikakumari457585
 
SaaStr Workshop Wednesday with Jason Lemkin
SaaStr Workshop Wednesday with Jason LemkinSaaStr Workshop Wednesday with Jason Lemkin
SaaStr Workshop Wednesday with Jason Lemkin
saastr
 
MOL- Management of Learning MATATAG Curriculum
MOL- Management of Learning MATATAG CurriculumMOL- Management of Learning MATATAG Curriculum
MOL- Management of Learning MATATAG Curriculum
KennethAbante
 
Cal Girls Holiday Inn Jaipur City Centre | 8445551418 | Girls Call With Sweet...
Cal Girls Holiday Inn Jaipur City Centre | 8445551418 | Girls Call With Sweet...Cal Girls Holiday Inn Jaipur City Centre | 8445551418 | Girls Call With Sweet...
Cal Girls Holiday Inn Jaipur City Centre | 8445551418 | Girls Call With Sweet...
mohankumar66951#S0007
 
一比一原版(heriotwatt毕业证书)英国赫瑞瓦特大学毕业证如何办理
一比一原版(heriotwatt毕业证书)英国赫瑞瓦特大学毕业证如何办理一比一原版(heriotwatt毕业证书)英国赫瑞瓦特大学毕业证如何办理
一比一原版(heriotwatt毕业证书)英国赫瑞瓦特大学毕业证如何办理
omkiy38
 
Cal Girls Hotel Highway King Jaipur | 8445551418 | Top Class High Profile Bea...
Cal Girls Hotel Highway King Jaipur | 8445551418 | Top Class High Profile Bea...Cal Girls Hotel Highway King Jaipur | 8445551418 | Top Class High Profile Bea...
Cal Girls Hotel Highway King Jaipur | 8445551418 | Top Class High Profile Bea...
pradeepkumar66952#S007
 
DAY 10 D Revelation 07-21-2024 PPT.pptx
DAY 10  D Revelation 07-21-2024 PPT.pptxDAY 10  D Revelation 07-21-2024 PPT.pptx
DAY 10 D Revelation 07-21-2024 PPT.pptx
FamilyWorshipCenterD
 

Recently uploaded (20)

Tata Technologies - Investor Presentation Q1 FY 2024-25
Tata Technologies - Investor Presentation Q1 FY 2024-25Tata Technologies - Investor Presentation Q1 FY 2024-25
Tata Technologies - Investor Presentation Q1 FY 2024-25
 
stackconf 2024 | Make You Ops-Life Easy – ansible usecases you didn´t out of ...
stackconf 2024 | Make You Ops-Life Easy – ansible usecases you didn´t out of ...stackconf 2024 | Make You Ops-Life Easy – ansible usecases you didn´t out of ...
stackconf 2024 | Make You Ops-Life Easy – ansible usecases you didn´t out of ...
 
ResearchPortfolioForGoogle_Version_1.pptx
ResearchPortfolioForGoogle_Version_1.pptxResearchPortfolioForGoogle_Version_1.pptx
ResearchPortfolioForGoogle_Version_1.pptx
 
stackconf 2024 | Rethinking Package Management in Kubernetes with Helm and Gl...
stackconf 2024 | Rethinking Package Management in Kubernetes with Helm and Gl...stackconf 2024 | Rethinking Package Management in Kubernetes with Helm and Gl...
stackconf 2024 | Rethinking Package Management in Kubernetes with Helm and Gl...
 
Toast To TGIS- Newsletter June 2024 TGIS.pdf
Toast To TGIS- Newsletter June 2024 TGIS.pdfToast To TGIS- Newsletter June 2024 TGIS.pdf
Toast To TGIS- Newsletter June 2024 TGIS.pdf
 
stackconf 2024 | IGNITE: Practical AI with Machine Learning for Observability...
stackconf 2024 | IGNITE: Practical AI with Machine Learning for Observability...stackconf 2024 | IGNITE: Practical AI with Machine Learning for Observability...
stackconf 2024 | IGNITE: Practical AI with Machine Learning for Observability...
 
Communication Skills........Let's Learn
Communication Skills........Let's Learn Communication Skills........Let's Learn
Communication Skills........Let's Learn
 
Fertilizer production by indorama fertilizer co.pptx
Fertilizer production by indorama fertilizer co.pptxFertilizer production by indorama fertilizer co.pptx
Fertilizer production by indorama fertilizer co.pptx
 
Cal Girls Nirman Nagar Jaipur | 8445551418 | Top Class High Profile Beauty Girl
Cal Girls Nirman Nagar Jaipur | 8445551418 | Top Class High Profile Beauty GirlCal Girls Nirman Nagar Jaipur | 8445551418 | Top Class High Profile Beauty Girl
Cal Girls Nirman Nagar Jaipur | 8445551418 | Top Class High Profile Beauty Girl
 
Securing Your Dream Job as a Flutter Developer
Securing Your Dream Job  as a Flutter DeveloperSecuring Your Dream Job  as a Flutter Developer
Securing Your Dream Job as a Flutter Developer
 
stackconf 2024 | Ignite DevOps Driving School – Explaining DevOps in 5 Minute...
stackconf 2024 | Ignite DevOps Driving School – Explaining DevOps in 5 Minute...stackconf 2024 | Ignite DevOps Driving School – Explaining DevOps in 5 Minute...
stackconf 2024 | Ignite DevOps Driving School – Explaining DevOps in 5 Minute...
 
Cal Girls Shyam Nagar Jaipur | 8445551418 | Sweet Girls Call With Hotels
Cal Girls Shyam Nagar Jaipur | 8445551418 | Sweet Girls Call With HotelsCal Girls Shyam Nagar Jaipur | 8445551418 | Sweet Girls Call With Hotels
Cal Girls Shyam Nagar Jaipur | 8445551418 | Sweet Girls Call With Hotels
 
stackconf 2024 | Talos Linux One (Immutable) OS to Rule Them All by Pip Oomen...
stackconf 2024 | Talos Linux One (Immutable) OS to Rule Them All by Pip Oomen...stackconf 2024 | Talos Linux One (Immutable) OS to Rule Them All by Pip Oomen...
stackconf 2024 | Talos Linux One (Immutable) OS to Rule Them All by Pip Oomen...
 
Cal Girls Bani Park Jaipur | | Girls Call Free Drop Service
Cal Girls Bani Park Jaipur | | Girls Call Free Drop ServiceCal Girls Bani Park Jaipur | | Girls Call Free Drop Service
Cal Girls Bani Park Jaipur | | Girls Call Free Drop Service
 
SaaStr Workshop Wednesday with Jason Lemkin
SaaStr Workshop Wednesday with Jason LemkinSaaStr Workshop Wednesday with Jason Lemkin
SaaStr Workshop Wednesday with Jason Lemkin
 
MOL- Management of Learning MATATAG Curriculum
MOL- Management of Learning MATATAG CurriculumMOL- Management of Learning MATATAG Curriculum
MOL- Management of Learning MATATAG Curriculum
 
Cal Girls Holiday Inn Jaipur City Centre | 8445551418 | Girls Call With Sweet...
Cal Girls Holiday Inn Jaipur City Centre | 8445551418 | Girls Call With Sweet...Cal Girls Holiday Inn Jaipur City Centre | 8445551418 | Girls Call With Sweet...
Cal Girls Holiday Inn Jaipur City Centre | 8445551418 | Girls Call With Sweet...
 
一比一原版(heriotwatt毕业证书)英国赫瑞瓦特大学毕业证如何办理
一比一原版(heriotwatt毕业证书)英国赫瑞瓦特大学毕业证如何办理一比一原版(heriotwatt毕业证书)英国赫瑞瓦特大学毕业证如何办理
一比一原版(heriotwatt毕业证书)英国赫瑞瓦特大学毕业证如何办理
 
Cal Girls Hotel Highway King Jaipur | 8445551418 | Top Class High Profile Bea...
Cal Girls Hotel Highway King Jaipur | 8445551418 | Top Class High Profile Bea...Cal Girls Hotel Highway King Jaipur | 8445551418 | Top Class High Profile Bea...
Cal Girls Hotel Highway King Jaipur | 8445551418 | Top Class High Profile Bea...
 
DAY 10 D Revelation 07-21-2024 PPT.pptx
DAY 10  D Revelation 07-21-2024 PPT.pptxDAY 10  D Revelation 07-21-2024 PPT.pptx
DAY 10 D Revelation 07-21-2024 PPT.pptx
 

stackconf 2024 | Ignite: Distributed Tracing using OpenTelemetry and Jaeger by AJ Jester.pdf

  • 1. 1 Distributed Tracing using OpenTelemetry and Jaeger 1 Prepared by: AJ
  • 2. 2 2 ● Several years ago when you had a monolithic application, it was fairly easy to debug and diagnose since there was probably only one service with a couple of users. ● Nowadays systems are broken up into smaller microservices deployed in containers on top of Kubernetes in multiple clusters across different cloud environments. ● In these kinds of distributed environments, there is a need to observe it all, both the overall picture, and, if need be, at a more granular level.
  • 3. 3 3 ● Observability can be roughly divided into three sub-categories: logging, metrics, and tracing. ● Tracing is the term used to describe the activity of recording and observing requests made by an application, and how those requests propagate through a system. ● When systems are set up in a distributed fashion, we call this distributed tracing as it involves observing the application and its interactions through multiple systems. ● For example, as a developer your code probably includes multiple functions, but you are more interested in how long the functions take to execute and the interdependency of those functions as they are used in the application.
  • 4. 4 4 Tracing will give the necessary insights by ● Identifying performance and latency bottlenecks ● Finding root cause analysis after major incidents ● Determining dependencies in multi-service architecture ● Monitoring transactions within your application
  • 5. 5 5 ● Let’s start by taking a look where it makes sense to add tracing. ● Here we’ll get started with a small Python application that will show a couple of simple operations. ● We’ll then later add the code for tracing to measure the time it takes for our code to execute.
  • 6. 6 6 Initially the code would look something like this minio_client.fput_object(config["dest_bucket"], file_path, file_path)
  • 7. 7 7
  • 8. 8 8 Install OpenTelemetry… $ pip install opentelemetry-api $ pip install opentelemetry-sdk and import Trace from opentelemetry import trace
  • 9. 9 9 Initialize the trace… resource = Resource(attributes={ SERVICE_NAME: "my-minio" }) provider = TracerProvider(resource=resource) processor = BatchSpanProcessor(ConsoleSpanExporter()) provider.add_span_processor(processor) trace.set_tracer_provider(provider) tracer = trace.get_tracer(__name__) and create a Span with tracer.start_as_current_span("check if bucket exist"):
  • 10. 10 10 You can create additional multiple spans with tracer.start_as_current_span("create object to add"): with tracer.start_as_current_span("add created object to bucket"): with tracer.start_as_current_span("fetch object from bucket"): with tracer.start_as_current_span("remove object from bucket"): with tracer.start_as_current_span("check if bucket exists"):
  • 11. 11 11 Once a span is created you can add custom attributes ● Adding a function name current_span.set_attribute("function.name", "CHECK_BUCKET") ● Adding a Span event current_span.add_event("Checking if bucket exists.") if not minio_client.bucket_exists(config["dest_bucket"]): current_span.add_event("Bucket does not exist, going to create it.") minio_client.make_bucket(config["dest_bucket"])
  • 12. 12 12 You can create multiple span events current_span.add_event("Test object has been placed in bucket.") current_span.add_event("Test object has been fetched from bucket.") current_span.add_event("Test object has been removed from bucket.") current_span.add_event("Bucket exists, going to remove it.")
  • 13. 13 13 Configuring Jaeger ● Install Jaeger package pip install opentelemetry-exporter-jaeger ● Import and Configure Jaeger from opentelemetry.exporter.jaeger.thrift import JaegerExporter jaeger_exporter = JaegerExporter( agent_host_name="localhost", agent_port=6831, )
  • 14. 14 14 Go to http://localhost:16686/ to access the Jaeger UI
  • 15. 15 15 Using Jaeger UI find the traces
  • 16. 16 16 So far we’ve only made one request, and there should be a couple of traces from the few spans we created.
  • 17. 17 17 Click on one of the traces which shows 2 Spans; let's choose the one that says “check if bucket exists”.
  • 18. 18 18 After running the script five to six times, we can start to see patterns emerge.
  • 19. 19 19 Is tracing the only option? ● Tracing is just one of the pieces in the path towards observability. ● Generally when incidents happen it's not just one trace or one log or one metric that we use to determine and resolve the issue. ● Often it is understanding the combination of these things that is required to get to the root cause.