- End-to-End Observability in Go with OTel and SigNoz
This project demonstrates how to capture traces, metrics, and logs from HTTP-based microservices in Go, send them to an OpenTelemetry Collector running locally, and visualize them in SigNoz Cloud.
For a deeper dive, visit this blog post
- Go 1.23+
- SigNoz Cloud account (or self-hosted SigNoz)
- SigNoz Ingestion Key
- OpenTelemetry Collector
Note:
This project was built and tested on Windows, with the OpenTelemetry Collector running locally on Windows.
You can also run the Collector on Linux or macOS, or use a Docker container instead of the native binary. The configuration and telemetry flow remain the same across platforms.
git clone https://github.com/ShrutiC-git/go-otel-e2e.git
cd go-otel-e2e
go mod tidy
This will download all dependencies required to run the application.
- Copy the provided
config.yaml
into the same folder as the OpenTelemetry Collector binary. - Open
config.yaml
in a text editor. - Update the following fields to point to your SigNoz Cloud account:
Field | Description | Example / Notes |
---|---|---|
endpoint |
OTLP endpoint for sending telemetry data | ingest.<YOUR_SIGNOZ_REGION>.signoz.cloud:443 |
signoz-ingestion-key |
Your SigNoz ingestion key | <YOUR_SIGNOZ_INGESTION_KEY> |
- Save the file.
Once configured, the Collector will export traces, metrics, and logs from your Go services to SigNoz Cloud.
- Open PowerShell or Command Prompt.
- Navigate to the folder containing
otelcol-contrib.exe
. - Run the Collector with the config file:
.\otelcol-contrib.exe --config config.yaml
If your config file is in a different path:
.\otelcol-contrib.exe --config <path-to-config.yaml>
You should see Health Check is ready
in the logs, indicating the Collector is running.
Note: otelcol-contrib is the name of the OpenTelemetry Collector executable. This specific version includes additional exporters and receivers needed for this project.
Start the Go application:
go run main.go
The service will start on port 8080
and expose two sample endpoints:
POST http://localhost:8080/createOrder
GET http://localhost:8080/checkInventory
curl -X POST http://localhost:8080/createOrder
curl http://localhost:8080/checkInventory
Once the OpenTelemetry Collector is running, all requests to these endpoints will be recorded, and the traces, metrics, and logs will be visible in SigNoz Cloud.
To light up traces/metrics in SigNoz, run a tiny bash loop:
# 60 requests over ~60s (low and steady)
for i in {1..60}; do
curl -s -o /dev/null -w "%{http_code}\n" -X POST http://localhost:8080/createOrder
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8080/checkInventory
sleep 1
done
+------------------+ +----------------------+ +----------------+
| Go Microservice | ----> | OTel Collector (local)| ---> | SigNoz Cloud |
| (with OTel SDK) | | Receives traces via | | (Backend + UI) |
| | | OTLP (http/grpc) | | |
+------------------+ +----------------------+ +----------------+
If you're having issues, here are a few common problems and their solutions.
This is usually caused by a connectivity or configuration issue.
Confirm that the Collector binary is running in your terminal and you see the Health Check is ready message. If not, double-check that you've navigated to the correct directory and run the command from Step 4 correctly.
Alternatively, you can also check Windows Service
to check the OTel Collector
is running.
Verify that your config.yaml
file contains the correct endpoint
and signoz-ingestion-key
for your SigNoz Cloud account. A simple typo in the ingestion key can prevent data from being ingested. Check Windows Application Logs
if issues persist.
The Go service is configured to send telemetry to localhost:4318. Make sure your local OpenTelemetry Collector is running and listening on this address and port.
Check for any firewall rules that might be blocking the connection between your Go application and the Collector.
If the application won't start, it's often a dependency issue.
Ensure you have run go mod tidy after cloning the repository to download all necessary dependencies. Check your terminal output for any errors during this process.
- Explore the traces in the SigNoz UI under the Traces tab.
- Check out the Metrics and Logs dashboards.