HyperDX uses the OpenTelemetry standard for collecting telemetry data (logs and traces). Traces are auto-generated with automatic instrumentation, so manual instrumentation isn't required to get value out of tracing.

This Guide Integrates:

✅ Logs✅ Metrics✅ Traces

Getting Started

Install OpenTelemetry Instrumentation Packages

To install the OpenTelemetry and Hyperdx Go packages, use the command below. It is recommended to check out the current instrumentation packages (opens in a new tab) and install the necessary packages to ensure that the trace information is attached correctly.

For this example, we will be using net/http/otelhttp.

go get -u
go get -u

Install Hyperdx Zapz Logging Module

To effectively correlate traces with logs in your Go application, consider replacing your existing logger with Hyperdx Zaps module, which is fully compatible with Zap (opens in a new tab), a popular logging framework for Go. To get started, you can install the module by running the following commands in your terminal:

go get -u
go get -u

Native HTTP Server Example (net/http)

Refer to the commented sections to learn how to instrument your Go application.

package main
import (
func main() {
	// Initialize otel tracing for server
	// Initialize zapz logger and use it across the entire app
	logger, err := zapz.New(strings.Split(os.Getenv("OTEL_EXPORTER_OTLP_HEADERS"), "=")[1])
	if err != nil {
	defer logger.Sync()
	logger.Warn("hello world", zap.String("foo", "bar"))
	http.Handle("/", otelhttp.NewHandler(wrapHandler(logger, ExampleHandler), "example-service"))
	port := os.Getenv("PORT")
	if port == "" {
		port = "7777"
	logger.Info("** Service Started on Port " + port + " **")
	if err := http.ListenAndServe(":"+port, nil); err != nil {
// Wrap all handlers using this function to include trace metadata in the logger
func wrapHandler(logger *zap.Logger, handler http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		logger := zapz.WithTraceMetadata(r.Context(), logger)
		logger.Info("request received", zap.String("path", r.URL.Path), zap.String("method", r.Method))
		handler(w, r)
		logger.Info("request completed", zap.String("path", r.URL.Path), zap.String("method", r.Method))
func ExampleHandler(w http.ResponseWriter, r *http.Request) {
	w.Header().Add("Content-Type", "application/json")
	io.WriteString(w, `{"status":"ok"}`)

Configure Environment Variables

Afterwards you'll need to configure the following environment variables in your shell to ship telemetry to HyperDX:


The OTEL_SERVICE_NAME environment variable is used to identify your service in the HyperDX app, it can be any name you want.

The OTEL_EXPORTER_OTLP_HEADERS environment variable is used to link your telemetry to your HyperDX account, and the API Key can be grabbed from the team page (opens in a new tab)