... | ... | @@ -112,4 +112,14 @@ After installing the necessary libraries, we need to make changes to our code. I |
|
|
The adjusted code can be seen [here](https://gitlab.fi.muni.cz/xbrazda/kubernetes-monitoring/-/blob/main/web-backend/app/host.py)
|
|
|
Following [this](https://opentelemetry-python.readthedocs.io/en/latest/exporter/jaeger/jaeger.html) guide, there are two main changes we need to make.
|
|
|
First, we need our code to produce traces. The way to do this in python is using `with` statements, each `with` block will crate a span, whose lifetime will be ended when the code within the block is done executing. We can also start tracing at the begging of a function using the `@` decorator.
|
|
|
After that, we need to setup Jeager exporter to export the traces emitted by our code to the Jaeger backend. Only changes we need to make to the template code are the host name of our k8s Jaeger service and the name of service. |
|
|
\ No newline at end of file |
|
|
After that, we need to setup Jeager exporter to export the traces emitted by our code to the Jaeger backend. Only changes we need to make to the template code are the host name of our k8s Jaeger service and the name of service.
|
|
|
|
|
|
#### Deployment
|
|
|
|
|
|
[This](https://www.jaegertracing.io/docs/1.40/operator/) guide shows us how to deploy the Jaeger operator to our k8s cluster. Jaeger consist of different parts, such as Collector, Agent, Query. There are 3 strategies to deploying Jaeger: AllInOne, production, and streaming. The AllInOne is the default strategy which will package all the compnents of Jeager into one image. It is the easiest strategy to sue and recommended for testing purposes. After applying the commands, we need to port-forward the Jaeger service and exposing port `16686`, which will allow us to access the Jager UI.
|
|
|
|
|
|
#### Preview
|
|
|
![image](uploads/98af747326f56e2b65a9edc14631dcbf/image.png)
|
|
|
*Jaeger UI*
|
|
|
![image](uploads/91d0dd381d8a895d918ec689051a0eaf/image.png)
|
|
|
*Details of a trace* |
|
|
\ No newline at end of file |