Monitor Go-Zero performance with OpenTelemetry
By integrating OpenTelemetry into your Go-Zero application, you can gain insights into its performance, troubleshoot issues, and analyze its behavior in real-time or post-analysis using the supported monitoring and observability tools.
What is OpenTelemetry?
OpenTelemetry is a vendor-neutral standard on how to collect telemetry data for applications and their supporting infrastructures. OpenTelemetry was created by merging OpenCensus and OpenTracing projects.
OpenTelemetry aims to standardize how you collect and send telemetry data to backend platforms: distributed tracing, logs, and OpenTelemetry metrics.
By using OpenTelemetry, developers gain valuable insight into the performance, behavior and dependencies of their applications, enabling them to optimize and troubleshoot their systems more effectively.
What is Go-Zero?
Go-Zero is an open-source microservices framework for Go programming language. It is designed to simplify the development of high-performance, scalable, and reliable microservices.
Usage
You can instrument your Go-Zero application by enabling OpenTelemetry instrumentation to capture relevant telemetry data, such as traces and metrics.
To start monitoring your Go-Zero application, add the following lines to the YAML config. If you don't have an Uptrace DSN, you can learn how to obtain one here.
Telemetry:
Name: api-api
Endpoint: localhost:14317
Sampler: 1.0
Batcher: otlpgrpc
OtlpHeaders:
uptrace-dsn: http://project2_secret_token@localhost:14318?grpc=14317
You can also find a Docker example on GitHub.
What is Uptrace?
Uptrace is an open source APM for OpenTelemetry that supports distributed tracing, metrics, and logs. You can use it to monitor applications and troubleshoot issues.
Uptrace comes with an intuitive query builder, rich dashboards, alerting rules, notifications, and integrations for most languages and frameworks.
Uptrace can process billions of spans and metrics on a single server and allows you to monitor your applications at 10x lower cost.
In just a few minutes, you can try Uptrace by visiting the cloud demo (no login required) or running it locally with Docker. The source code is available on GitHub.
What's next?
Next, instrument more operations to get a more detailed picture. Try to prioritize network calls, disk operations, database queries, error and logs.
You can also create your own instrumentations using OpenTelemetry Go Tracing API.