Categorygithub.com/hyperdxio/otel-config-go
module
1.12.3
Repository: https://github.com/hyperdxio/otel-config-go.git
Documentation: pkg.go.dev

# README

otel-config-go (formerly otel-launcher-go)

This project is a configuration layer that chooses default values for configuration options that many OpenTelemetry users would ultimately configure manually, allowing for minimal code to quickly instrument with OpenTelemetry.

Latest release built with:

(Note: semantic conventions to be updated to match upstream in next release)

Getting started

go get github.com/hyperdxio/otel-config-go

Configure

Minimal setup - by default will send all telemetry via GRPC to localhost:4317

import "github.com/hyperdxio/otel-config-go/otelconfig"

func main() {
    otelShutdown, err := otelconfig.ConfigureOpenTelemetry()
    defer otelShutdown()
}

You can set headers directly instead.

import "github.com/hyperdxio/otel-config-go/otelconfig"

func main() {
    otelShutdown, err := otelconfig.ConfigureOpenTelemetry(
        otelconfig.WithServiceName("service-name"),
        otelconfig.WithHeaders(map[string]string{
            "service-auth-key": "value",
            "service-useful-field": "testing",
        }),
    )
    defer otelShutdown()
}

Migrating from otel-launcher-go to otel-config-go

As of v1.8.0, this package has been renamed from otel-launcher-go to otel-config-go. When migrating to use the renamed package, all references to launcher should be changed to otelconfig.

Configuration Options

Config OptionEnv VariableRequiredDefault
WithServiceNameOTEL_SERVICE_NAMEy-
WithServiceVersionOTEL_SERVICE_VERSIONn-
WithHeadersOTEL_EXPORTER_OTLP_HEADERSn{}
WithExporterProtocolOTEL_EXPORTER_OTLP_PROTOCOLngrpc
WithTracesExporterEndpointOTEL_EXPORTER_OTLP_TRACES_ENDPOINTnlocalhost:4317
WithTracesExporterInsecureOTEL_EXPORTER_OTLP_TRACES_INSECUREnfalse
WithMetricsExporterEndpointOTEL_EXPORTER_OTLP_METRICS_ENDPOINTnlocalhost:4317
WithMetricsExporterInsecureOTEL_EXPORTER_OTLP_METRICS_INSECUREnfalse
WithLogLevelOTEL_LOG_LEVELninfo
WithPropagatorsOTEL_PROPAGATORSntracecontext,baggage
WithResourceAttributesOTEL_RESOURCE_ATTRIBUTESn-
WithMetricsReportingPeriodOTEL_EXPORTER_OTLP_METRICS_PERIODn30s
WithMetricsEnabledOTEL_METRICS_ENABLEDntrue
WithTracesEnabledOTEL_TRACES_ENABLEDntrue

This is a joint effort alongside LightStep and is based their initial otel-launcher-go. The intention is to contribute this to OpenTelemetry Go Contrib.

# Packages

No description provided by the author
No description provided by the author