Updated content and screenshots

This commit is contained in:
ankit01-oss
2024-05-23 17:01:22 +05:30
parent c10639bd65
commit 386d6b5250
10 changed files with 68 additions and 10 deletions

2
.gitignore vendored
View File

@ -124,11 +124,13 @@ celerybeat.pid
# Environments
.env
.venv
.venb
env/
venv/
ENV/
env.bak/
venv.bak/
.DS_Store
# Spyder project settings
.spyderproject

View File

@ -1,6 +1,6 @@
url - `signoz.io/opentelemetry/python-environment-setup/`
# Lesson 1: Setting up the environment
---
In this lesson, we will be setting up a basic Flask application.
## Flask To-Do App with MongoDB
@ -50,7 +50,9 @@ python -m pip install -r requirements.txt
Make sure MongoDB is installed and running on the default port (27017). You can start it manually or use a process manager. To check if MongoDB is running, use:
```bash
pgrep mongod
pgrep mongod # If a process ID is returned, MongoDB is running
```
If MongoDB is running, you should see a process ID. If not, start MongoDB with the following command:

43
lesson-2/content.md Normal file
View File

@ -0,0 +1,43 @@
# Lesson 2: Setting up SigNoz
You need a backend to send data collected with OpenTelemetry. SigNoz is an OpenTelemetry-native observability backend that is best suited for visualizing OpenTelemetry data. It is a one-stop observability solution and provides logs, metrics, and traces under a single pane of glass.
With SigNoz, you can:
- Visualise Traces, Metrics, and Logs in a single pane of glass
- Monitor application metrics like p99 latency, error rates for your services, external API calls, and individual endpoints.
- Find the root cause of the problem by going to the exact traces which are causing the problem and see detailed flamegraphs of individual request traces.
- Run aggregates on trace data to get business-relevant metrics
- Filter and query logs, build dashboards and alerts based on attributes in logs
- Monitor infrastructure metrics such as CPU utilization or memory usage
- Record exceptions automatically in Python, Java, Ruby, and Javascript
- Easy to set alerts with DIY query builder
SigNoz is available both as an open-source software and as a cloud service.
## **SigNoz Cloud**
SigNoz cloud is the easiest way to run SigNoz. You can sign up [here](https://signoz.io/teams/) for a free account and get 30 days of unlimited access to all features.
In this tutorial series, we will be using SigNoz Cloud to visualize everything that we collect from our applications with OpenTelemetry.
After you sign up and verify your email, you will be provided with details of your SigNoz cloud instance. Once you set up your password and log in, you will be greeted with the following onboarding screen.
![SigNoz onboarding screen](static/images/onboarding-screen.png)
Since we will be following instructions from the tutorial, you can skip onboarding by clicking on the SigNoz logo.
You will see the below screen:
![Services tab in SigNoz shows the list of services being monitored](static/images/signoz-screen.png)
For sending data to SigNoz cloud, you will be needing details like ingestion key and region. You can find them under `Ingestion Settings` under `Settings`.
![Ingestion Settings](static/images/ingestion-settings.png)
## **Self-Host SigNoz**
You can also use the open-source version of SigNoz. Check out the [docs](https://signoz.io/docs/install/) for installing self-host SigNoz.
You can also check out our [GitHub repo](https://github.com/SigNoz/signoz).

View File

@ -1,8 +1,6 @@
url - `opentelemetry-python-example`
# Lesson 3.1: OpenTelemetry Auto-Instrumentation of Python Application
---
In the previous tutorial, we created a Flask to-do application with MongoDB.
In the previous tutorial, we set up SigNoz so that we can send the data collected by OpenTelemetry to it.
In this tutorial, we will set up automatic traces, metrics and logs collection in our Flask application with OpenTelemetry. We will make use of auto-instrumentation tools that set up everything for us. With auto-instrumentation, you can configure your Python application to collect telemetry without any changes in the application code.
@ -34,7 +32,9 @@ This package includes the OpenTelemetry SDK, the OTLP exporter, and the necessar
## Step 2: Use `opentelemetry-bootstrap` for Auto-Instrumentation
With the distro package installed, we can use the `opentelemetry-bootstrap` tool to automatically install the required instrumentation libraries for our application. This tool inspects the environment and detects the frameworks and libraries installed. It then finds and installs the appropriate instrumentation libraries, ensuring comprehensive auto-instrumentation. For example, if you have Flask installed, it will install the `opentelemetry-instrumentation-flask` package (as long as the version is supported).
With the distro package installed, we can use the `opentelemetry-bootstrap` tool to automatically install the required instrumentation libraries for our application. This tool inspects the environment and detects the frameworks and libraries installed.
It then finds and installs the appropriate instrumentation libraries, ensuring comprehensive auto-instrumentation. For example, if you have Flask installed, it will install the `opentelemetry-instrumentation-flask` package (as long as the version is supported).
Run the following command to install the required instrumentation packages:
@ -96,7 +96,13 @@ Interact with the Flask application to generate tracing data and send it to SigN
## 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.
![Application being monitored in SigNoz](static/images/application-monitored.png)
You can click on the application to see useful application metrics like latency, requests rates, error rates, apdex score, key operations, etc.
![Monitor things like application latency, requests per sec, error percentage, apdex and see your top endpoints with SigNoz.](static/images/application-monitored.png)
## Additional: Troubleshooting if you cant see data in SigNoz
@ -107,7 +113,7 @@ Interact with the Flask application to generate tracing data and send it to SigN
```bash
OTEL_RESOURCE_ATTRIBUTES=service.name=my-application \
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>" \
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true \
OTEL_TRACES_EXPORTER=console \

5
readme.md Normal file
View File

@ -0,0 +1,5 @@
Lesson 1: Setting up the Environment
Lesson 2: Setting up SigNoz
Lesson 3-1: Auto-instrumentation with OpenTelemetry

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB