config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 2 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
	MetricReporterType_METRIC_REPORTER_TYPE_LOGGING = agentconfig.MetricReporterType_METRIC_REPORTER_TYPE_LOGGING
	MetricReporterType_METRIC_REPORTER_TYPE_OTLP    = agentconfig.MetricReporterType_METRIC_REPORTER_TYPE_OTLP
)

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