Getting Started
Prerequisites
- Go 1.27+
- Familiarity with the OpenTelemetry Go SDK
Installation
Install the packages you need. The exporters are separate Go modules:
sh
go get github.com/foomo/opentelemetry-go/exporters/glossy/glossytracesh
go get github.com/foomo/opentelemetry-go/exporters/glossy/glossymetricsh
go get github.com/foomo/opentelemetry-goMinimal Example
Create a glossy trace exporter, wire it into a TracerProvider, and produce a span:
go
package main
import (
"context"
"fmt"
"github.com/foomo/opentelemetry-go/exporters/glossy/glossytrace"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.43.0"
)
func main() {
ctx := context.Background()
exporter, err := glossytrace.New()
if err != nil {
panic(err)
}
tp := sdktrace.NewTracerProvider(
sdktrace.WithBatcher(exporter),
sdktrace.WithResource(resource.NewWithAttributes(
semconv.SchemaURL,
semconv.ServiceName("my-service"),
semconv.ServiceVersion("0.1.0"),
)),
)
otel.SetTracerProvider(tp)
defer func() {
if err := tp.Shutdown(ctx); err != nil {
fmt.Println(err)
}
}()
tracer := otel.Tracer("example")
_, span := tracer.Start(ctx, "hello-world")
span.End()
}Running this prints a styled trace tree to your terminal:
=== TRACE abc123... ===
└─ hello-world (0.12 ms)TIP
Set NO_COLOR=1 to disable color output, useful for CI or piping to files.
Next Steps
- Exporters Guide -- learn about all exporter options including flamegraphs and duration thresholds
- Testing Guide -- integrate traces and metrics into your Go tests
- API Reference -- full function signatures and option tables
