otelconfig

package module
v0.0.0-...-e5acace Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

otelconfig

Use it like this in your service entry point:


import (
    "context"

    "github.com/ejobsgroup/otelconfig"
)

func main() {
	ctx := context.Background()

	shutdown := otelconfig.ConfigureOpentelemetry(ctx)
	defer shutdown()

    // Use the global trace provider which is now configured to what the env vars
    // specified. Example env configs:
    //
    // Note: for GRPC the endpoint shouldn't contain a protocol
    //
    // OTEL_EXPORTER_OTLP_ENDPOINT=127.0.0.1:4317
    // OTEL_EXPORTER_OTLP_PROTOCOL=grpc
    // OTEL_EXPORTER_OTLP_INSECURE=true
    // OTEL_EXPORTER_OTLP_SERVICE_NAME=my-instrumented-service
    //
    // or
    //
    // OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
    // OTEL_EXPORTER_OTLP_PROTOCOL=http
    // OTEL_EXPORTER_OTLP_INSECURE=true
    // OTEL_EXPORTER_OTLP_SERVICE_NAME=my-instrumented-service
    //
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureOpentelemetry

func ConfigureOpentelemetry(ctx context.Context) func()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL