Updated content and screenshots till lesson 5
@ -1,6 +1,4 @@
|
|||||||
url - `opentelemetry-python-example`
|
# Lesson 3.2: OpenTelemetry Manual Instrumentation of Python Application
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
In the previous tutorial, we set up auto-instrumentation for our Flask application with OpenTelemetry without any code changes. In this tutorial, we will manually configure the agent.
|
In the previous tutorial, we set up auto-instrumentation for our Flask application with OpenTelemetry without any code changes. In this tutorial, we will manually configure the agent.
|
||||||
|
|
||||||
@ -67,7 +65,7 @@ Now, let's see how to run the application.
|
|||||||
```bash
|
```bash
|
||||||
OTEL_RESOURCE_ATTRIBUTES=service.name=my-application \
|
OTEL_RESOURCE_ATTRIBUTES=service.name=my-application \
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.in.signoz.cloud:443" \
|
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.in.signoz.cloud:443" \
|
||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=72282c07-60ad-45ff-9131-3b8819f9cdc3" \
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
python lesson-3-2/app.py
|
python lesson-3-2/app.py
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -77,7 +75,9 @@ Interact with the Flask application to generate tracing data and send it to SigN
|
|||||||
|
|
||||||
## Step 5: See Trace Data in SigNoz
|
## Step 5: See Trace Data in SigNoz
|
||||||
|
|
||||||
<Insert screenshots showing actual spans from the code>
|
Once you've created some dummy telemetry by interacting with your application, you will be able to find your application under the `Services` tab of SigNoz.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
@ -88,7 +88,7 @@ def action():
|
|||||||
desc = request.values.get("desc")
|
desc = request.values.get("desc")
|
||||||
date = request.values.get("date")
|
date = request.values.get("date")
|
||||||
pr = request.values.get("pr")
|
pr = request.values.get("pr")
|
||||||
span.set_attribute("name", name)
|
span.set_attribute("task_name", name)
|
||||||
span.add_event("Adding a Task")
|
span.add_event("Adding a Task")
|
||||||
todos_coll.insert_one(
|
todos_coll.insert_one(
|
||||||
{"name": name, "desc": desc, "date": date, "pr": pr, "done": "no"}
|
{"name": name, "desc": desc, "date": date, "pr": pr, "done": "no"}
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
url - `opentelemetry-python-manual-instrumentation`
|
# Lesson 4: Create Manual Spans in Python application using OpenTelemetry
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
In the previous tutorials, we set up out of the box tracing, metrics and logs in our Flask application. In this tutorial, we will show you how to manually create spans.
|
In the previous tutorials, we set up out of the box tracing, metrics and logs in our Flask application. In this tutorial, we will show you how to manually create spans.
|
||||||
|
|
||||||
@ -187,7 +185,22 @@ def my_function():
|
|||||||
|
|
||||||
## Step 6: See your Spans in SigNoz
|
## Step 6: See your Spans in SigNoz
|
||||||
|
|
||||||
<screenshots showing exact spans that was created with manual instrumentation>
|
The sample code for lesson 4 has a manual span named `add_task` which gets created whenever you create a new task in the to-do application. To see this span go to the `Traces` tab and apply filters for your application.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
OTEL_RESOURCE_ATTRIBUTES=service.name=my-application \
|
||||||
|
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||||
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
|
python lesson-4/app.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you run the application and add a task, you will be able to see it in SigNoz.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can see your span in the trace detail view too which will show how the request flowed and how much it took for the `add_task` operation.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
url - `opentelemetry-python-manual-instrumentation`
|
# Lesson 5: Creating custom metrics in Python Application using OpenTelemetry
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
In the previous tutorials, we have seen how to manually create spans in a Python application. In this tutorial, we will look at how to create custom metrics using OpenTelemetry.
|
In the previous tutorials, we have seen how to manually create spans in a Python application. In this tutorial, we will look at how to create custom metrics using OpenTelemetry.
|
||||||
|
|
||||||
@ -101,7 +99,33 @@ The `create_gauge()` method creates a gauge instrument with the given name, unit
|
|||||||
|
|
||||||
## Step 6: See your metrics in SigNoz
|
## Step 6: See your metrics in SigNoz
|
||||||
|
|
||||||
<screenshots showing exact metrics that was created with manual instrumentation>
|
The sample code for lesson 5 has a custom metric named `todo_counter` which keeps a track of number of To-Dos added by the user. You can create customized dashboards to monitor your custom metrics.
|
||||||
|
|
||||||
|
In order to see your custom metric in SigNoz, run the updated code with custom metric in Lesson 5.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
OTEL_RESOURCE_ATTRIBUTES=service.name=my-application \
|
||||||
|
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||||
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
|
python lesson-5/app.py
|
||||||
|
```
|
||||||
|
|
||||||
|
Let's suppose you add 6 tasks in your to-do application.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can go to `Dashboards` in SigNoz and create a new panel to monitor the number of tasks in your to-do application using the `todo_counter` metric.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can create a value panel type and monitor the number of tasks being created.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
You can also set alerts on metrics based on your use-case directly from these panels.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
|
BIN
static/images/6-tasks.png
Normal file
After Width: | Height: | Size: 912 KiB |
BIN
static/images/create-alerts-custom-metrics.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
static/images/custom-metrics-opentelemetry-python.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
static/images/manual-span-fullscreen.png
Normal file
After Width: | Height: | Size: 907 KiB |
BIN
static/images/manual-spans.png
Normal file
After Width: | Height: | Size: 103 KiB |
BIN
static/images/no-of-tasks-added.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
static/images/trace-details-manual-span.png
Normal file
After Width: | Height: | Size: 147 KiB |