Giter Site home page Giter Site logo

otel-config-go's Introduction

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.

Getting started

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

Configure

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

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

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

You can set headers directly instead.

import "github.com/honeycombio/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 Option Env Variable Required Default
WithServiceName OTEL_SERVICE_NAME y -
WithServiceVersion OTEL_SERVICE_VERSION n -
WithHeaders OTEL_EXPORTER_OTLP_HEADERS n {}
WithProtocol OTEL_EXPORTER_OTLP_PROTOCOL n grpc
WithTracesExporterEndpoint OTEL_EXPORTER_OTLP_TRACES_ENDPOINT n localhost:4317
WithTracesExporterInsecure OTEL_EXPORTER_OTLP_TRACES_INSECURE n false
WithMetricsExporterEndpoint OTEL_EXPORTER_OTLP_METRICS_ENDPOINT n localhost:4317
WithMetricsExporterInsecure OTEL_EXPORTER_OTLP_METRICS_INSECURE n false
WithLogLevel OTEL_LOG_LEVEL n info
WithPropagators OTEL_PROPAGATORS n tracecontext,baggage
WithResourceAttributes OTEL_RESOURCE_ATTRIBUTES n -
WithMetricsReportingPeriod OTEL_EXPORTER_OTLP_METRICS_PERIOD n 30s
WithMetricsEnabled OTEL_METRICS_ENABLED n true
WithTracesEnabled OTEL_TRACES_ENABLED n true

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.

otel-config-go's People

Contributors

jamiedanielson avatar mikegoldsmith avatar vreynolds avatar dependabot[bot] avatar martin308 avatar cartermp avatar robbkidd avatar pkanal avatar jburnham avatar kentquirk avatar thomasdesr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.