Observability is an important concept in software which provides visibility into your application/services. It describes how the services function in real-time and what is happening inside your application.
Observabilitiy has three main pillars:
- Traces: Tells which requests are slow.
- Metrics: Monitors latency, failures, and so on.
- Logs: Helps debug errors with context.
Introduction
How do you ensure your logs, metrics and traces are in place? Observability is the answer to all of these. OpenTelemetry helps collect traces, metrics, and logs in a vendor-agnostic way and send it to a backend like SigNoz for visualization.
This topic describes how you can enforce observability in a simple application using OpenTelemetry and SigNoz.
OpenTelemetry, aka OTel, is a vendor-neutral open source Observability framework to instrument, generate, collect, and export traces, metrics, and logs (aka telemetry data).
SigNoz is an open-source observability tool powered by OpenTelemetry that helps monitor and gain insights into your application and infrastructure.
Prerequisites
- Docker
- A microservices application (Here, I am using a Flask-based service that simulates real-world behavior like successful requests, errors, and metrics exposure; and it is instrumented with OpenTelemetry.). Download the app here.
This blog assumes that you are hands on with concepts like containerization and Docker.
Steps to setup observability
-
Dockerize your application and build the application by specifying correct ports. In this case, the local host uses port 8000.
docker build -t simple-app .
docker run -p 8000:8000 \
-e OTEL_EXPORTER_OTLP_ENDPOINT=http://host.docker.internal:4318 \
-e OTEL_SERVICE_NAME=simple-app \
simple-app Set up self-hosted SigNoz on Docker using the install script.
-
Verify the SigNoz installation.
- This installation spins up: • ClickHouse (for storing telemetry) • OTEL Collector (for receiving traces/metrics) • SigNoz login page (on port 8080)
Ensure port 4318 is open; this is where OTEL collector receives HTTP traces.
-
Hit some endpoints from the terminal to generate traffic and build traces. For example:
curl http://localhost:8000/
The above command displays a simple welcome message.
curl http://localhost:8000/fail
The above command throws an error.
To run SigNoz on your local machine, go to http://localhost:8080/ from your browser after verifying the installation.
-
Signup to SigNoz, and navigate to "Traces" from the left sidebar.
-
Go to "Service Name" and select the app name to display the traces associated with the application.
Depending on the type of metric, you can choose to view a variety of data insights in different formats (table, visual, and so).
Conclusion
This blog demonstrates observability setup using powerful, open-source tools like SigNoz and OpenTelemetry. These tools help build robust observability pipeline with scalability that help catch bugs easily and reduce latency.
Top comments (0)