config

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 1 Imported by: 8

README

Agent Config Go

Agent config holds all the configuration settings for the Hypertrace Go Agent.

Getting Started

// loads the config from the config file tbd.json and env vars
cfg := config.Load()

// overrides statically the service name
cfg.ServiceName = config.String("myservice")
cfg.DataCapture.HTTPHeaders.Request = config.Bool(true)

Values can also be overriden by the environment variables, e.g. HT_DATA_CAPTURE_HTTP_HEADERS_RESPONSE=false. You can check a list of the supported environment variables here

The location for the config file can also be overriden by passing the path in HT_CONFIG_FILE environment variable or you can set the location in code by using

// loads the config from the specified file and env vars
cfg := config.LoadFromFile("path/to/file.yml")
...

Supported formats for config files are YAML and JSON.

Default Values

All default values are defined in the defaults.go, everything else will be default to zero values.

Loading for existing config

Sometimes the user can choose to populate the config object and then load the config values from environment variables. In such case one can run:

cfg := &config.AgentConfig{}
cfg.ServiceName = config.String("myservice")
cfg.DataCapture.HTTPHeaders.Request = config.Bool(true)

cfg.LoadFromEnv()

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Bool                           = agentconfig.Bool
	String                         = agentconfig.String
	Int32                          = agentconfig.Int32
	TraceReporterType_OTLP         = agentconfig.TraceReporterType_OTLP
	TraceReporterType_ZIPKIN       = agentconfig.TraceReporterType_ZIPKIN
	TraceReporterType_LOGGING      = agentconfig.TraceReporterType_LOGGING
	PropagationFormat_B3           = agentconfig.PropagationFormat_B3
	PropagationFormat_TRACECONTEXT = agentconfig.PropagationFormat_TRACECONTEXT
)

Functions

func Load

func Load() *agentconfig.AgentConfig

func LoadEnv added in v0.4.0

func LoadEnv(cfg *agentconfig.AgentConfig)

func LoadFromFile

func LoadFromFile(configFile string) *agentconfig.AgentConfig

func PropagationFormats added in v0.4.0

func PropagationFormats(formats ...agentconfig.PropagationFormat) []agentconfig.PropagationFormat

Types

This section is empty.

Jump to

Keyboard shortcuts

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