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.Fatalf or os.Exit after a span has started — they skip the deferred tp.Shutdown(ctx) and the in-flight spans never flush. Use log.Printf + return from main instead.

Options

FieldDefaultDescription
SpaceID$ARIZE_SPACE_IDArize Space ID. Required.
APIKey$ARIZE_API_KEYArize API key. Required.
ProjectName$ARIZE_PROJECT_NAME or "default"Sets the openinference.project.name resource attribute.
Endpoint$ARIZE_COLLECTOR_ENDPOINT or otlp.arize.comOTLP/HTTP collector hostname. Use arizeotel.EndpointArizeEurope for EU spaces. Accepts bare host or full URL.
ExtraHeadersnoneMerged into the OTLP request headers alongside the required space_id / api_key headers.
ExtraResourceAttributesnoneAppended to the OTel Resource. Common: attribute.String("deployment.environment", "prod").
InsecurefalseDisables TLS. Only set for on-prem / local collectors.
SimpleProcessorfalse (batched)Use SimpleSpanProcessor instead of Batched. Useful for tests and short CLIs.
SkipSetGlobalfalseSkip 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 with ARIZE_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).