otelinit

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Servicename string `json:"service_name"`
	Endpoint    string `json:"endpoint"`
	Insecure    bool   `json:"insecure"`
}

Config holds the typed values of configuration read from the environment. It is public mainly to make testing easier and most users should never use it directly.

func ConfigFromContext

func ConfigFromContext(ctx context.Context) (*Config, bool)

ConfigFromContext extracts the Config struct from the provided context. Returns the Config and true if it was retried successfully, false otherwise.

type OtelShutdown

type OtelShutdown func(context.Context)

OtelShutdown is a function that should be called with context when you want to shut down OpenTelemetry, usually as a defer in main.

func InitOpenTelemetry

func InitOpenTelemetry(ctx context.Context, serviceName string) (context.Context, OtelShutdown)

InitOpenTelemetry sets up the OpenTelemetry plumbing so it's ready to use. It requires a context.Context and service name string that is the name of your service or application. TODO: should even this be overrideable via envvars? Returns context and a func() that encapuslates clean shutdown.

Jump to

Keyboard shortcuts

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