diff --git a/.gitignore b/.gitignore index efa407c..dcfbe68 100644 --- a/.gitignore +++ b/.gitignore @@ -124,11 +124,13 @@ celerybeat.pid # Environments .env .venv +.venb env/ venv/ ENV/ env.bak/ venv.bak/ +.DS_Store # Spyder project settings .spyderproject diff --git a/lesson-1/content.md b/lesson-1/content.md index a31e2af..325e6a5 100644 --- a/lesson-1/content.md +++ b/lesson-1/content.md @@ -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: diff --git a/lesson-2/content.md b/lesson-2/content.md new file mode 100644 index 0000000..0c4c00f --- /dev/null +++ b/lesson-2/content.md @@ -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). diff --git a/lesson-3-1/content.md b/lesson-3-1/content.md index 8ffd595..b97ce5b 100644 --- a/lesson-3-1/content.md +++ b/lesson-3-1/content.md @@ -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 - +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 can’t 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=" \ OTEL_EXPORTER_OTLP_PROTOCOL=grpc \ OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true \ OTEL_TRACES_EXPORTER=console \ diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e899b53 --- /dev/null +++ b/readme.md @@ -0,0 +1,5 @@ + + +Lesson 1: Setting up the Environment +Lesson 2: Setting up SigNoz +Lesson 3-1: Auto-instrumentation with OpenTelemetry \ No newline at end of file diff --git a/static/images/application-metrics.png b/static/images/application-metrics.png new file mode 100644 index 0000000..f7253ae Binary files /dev/null and b/static/images/application-metrics.png differ diff --git a/static/images/application-monitored.png b/static/images/application-monitored.png new file mode 100644 index 0000000..4b3cc94 Binary files /dev/null and b/static/images/application-monitored.png differ diff --git a/static/images/ingestion-settings.png b/static/images/ingestion-settings.png new file mode 100644 index 0000000..82c6c99 Binary files /dev/null and b/static/images/ingestion-settings.png differ diff --git a/static/images/onboarding-screen.png b/static/images/onboarding-screen.png new file mode 100644 index 0000000..625ff0e Binary files /dev/null and b/static/images/onboarding-screen.png differ diff --git a/static/images/signoz-screen.png b/static/images/signoz-screen.png new file mode 100644 index 0000000..8436244 Binary files /dev/null and b/static/images/signoz-screen.png differ