arize-otel-go
May 13, 2026 · View on GitHub
Go helper for sending OpenTelemetry traces to Arize. Wraps the standard OTel OTLP/HTTP setup with Arize-aware defaults so you don't hand-roll ~30 lines of tracer-provider boilerplate on every service.
Go equivalent of arize-otel-python.
Install
go get github.com/Arize-ai/arize-otel-go
Requires Go 1.23+.
Quick start
package main
import (
"context"
"log"
"time"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
arizeotel "github.com/Arize-ai/arize-otel-go"
)
func main() {
ctx := context.Background()
tp, err := arizeotel.Register(ctx, arizeotel.Options{
ProjectName: "my-go-service",
// SpaceID and APIKey default to $ARIZE_SPACE_ID and $ARIZE_API_KEY.
})
if err != nil {
log.Printf("register tracer: %v", err)
return
}
defer func() {
shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
_ = tp.Shutdown(shutdownCtx)
}()
tracer := otel.Tracer("my-app")
_, span := tracer.Start(ctx, "hello")
span.SetAttributes(attribute.String("input.value", "hi"))
span.End()
}
Critical for short-lived processes: never call
log.Fatalforos.Exitafter a span has started — they skip the deferredtp.Shutdown(ctx)and the in-flight spans never flush. Uselog.Printf+returnfrommaininstead.
Options
| Field | Default | Description |
|---|---|---|
SpaceID | $ARIZE_SPACE_ID | Arize Space ID. Required. |
APIKey | $ARIZE_API_KEY | Arize API key. Required. |
ProjectName | $ARIZE_PROJECT_NAME or "default" | Sets the openinference.project.name resource attribute. |
Endpoint | $ARIZE_COLLECTOR_ENDPOINT or otlp.arize.com | OTLP/HTTP collector hostname. Use arizeotel.EndpointArizeEurope for EU spaces. Accepts bare host or full URL. |
ExtraHeaders | none | Merged into the OTLP request headers alongside the required space_id / api_key headers. |
ExtraResourceAttributes | none | Appended to the OTel Resource. Common: attribute.String("deployment.environment", "prod"). |
Insecure | false | Disables TLS. Only set for on-prem / local collectors. |
SimpleProcessor | false (batched) | Use SimpleSpanProcessor instead of Batched. Useful for tests and short CLIs. |
SkipSetGlobal | false | Skip calling otel.SetTracerProvider. Set if you manage the global provider yourself. |
EU spaces
arizeotel.Register(ctx, arizeotel.Options{
Endpoint: arizeotel.EndpointArizeEurope,
})
Pairs with OpenInference Go
Combine with openinference-go/semconv for typed attribute-key constants:
import "github.com/Arize-ai/openinference/go/semconv"
span.SetAttributes(
attribute.String(semconv.OpenInferenceSpanKind, semconv.SpanKindLLM),
attribute.String(semconv.LLMModelName, "gpt-4o"),
)
Examples
examples/manual— minimal CHAIN + LLM span, no LLM SDK dependency. Run withARIZE_SPACE_ID=… ARIZE_API_KEY=… go run ./examples/manual.
Status
v0.1.0 — initial release. API may evolve; pin a tag.
License
BSD-3-Clause (matches arize-otel-python and the rest of the Arize SDK family).