Customizing the Go data collector
You can set the variables to change the default behavior of the Go data collector.
For Go monitoring in Kubernetes environments, set the following variables in the application yaml file.
For on-premises applications, set the following variables as environment variables or in the config.properties
file.
Variable name | Value | Description |
---|---|---|
OPENTRACING_ENABLED | false | By default, the OpenTracing function is enabled. You can disable OpenTracing by setting the environment variable to false. Example: name: LATENCY_SAMPLER_PARAM value: "0.2" |
OpenTracing sampling: JAEGER_SAMPLER_TYPE JAEGER_SAMPLER_PARAM |
The default sampler type is probabilistic, and the default sampler param is 0.01, which means that 1 in 100 traces will be sampled. You can set it to other values. The Go data collector supports three sampler types: Constant (JAEGER_SAMPLER_TYPE=const) Probabilistic (JAEGER_SAMPLER_TYPE=probabilistic) Rate Limiting (JAEGER_SAMPLER_TYPE=ratelimiting) For more information, see Sampling |
When the OpenTracing function is enabled, you can set the OpenTracing sampler type and param. The sampling type and param variables must be set in pairs. If you set only JAEGER_SAMPLER_TYPE , or only JAEGER_SAMPLER_PARAM ,
you will have a problem showing the tracing data.Example: name: JAEGER_SAMPLER_TYPE value: probabilistic name: JAEGER_SAMPLER_PARAM value: "0.1" |
LATENCY_SAMPLER_PARAM | Any value between 0 and 1 | The default value is 0.1, which means getting one request out of 10 requests. The value must be between 0 and 1. The value of 0 means no latency data will be collected. The value of 1 means no sampler and all requests data will be collected. Example: name: LATENCY_SAMPLER_PARAM value: "0.2" |
GODC_LOG_LEVEL | PANIC FATAL ERROR - WARN NFO DEBUG TRACE |
The default value is INFO. You can set it to the following levels: PANIC: PanicLevel level, the highest level of severity. Logs and then calls panic with the message passed to Debug, Info, and so on. FATAL: FatalLevel level. Logs and then calls logger.Exit(1). It will exit even if the logging level is set to Panic. ERROR: ErrorLevel level. Logs. Used for errors that should definitely be noted. Commonly used for hooks to send errors to an error tracking service. WARN: WarnLevel level. Non-critical entries that deserve eyes. DEBUG: Only useful debug information is printed in the log, for example, collected data, data that are sent to server, and server response. INFO: InfoLevel level. General operational entries about what's going on inside the application. DEBUG: DebugLevel level. Usually only enabled when debugging. Very verbose logging. TRACE: TraceLevel level. Designates finer-grained informational events than the Debug. Example: export GODC_LOG_LEVEL=level |
GODC_LOG_TO_CONSOLE | true | Set GODC_LOG_TO_CONSOLE to dump the log to console, otherwise, the output will be dumped to log files under the root of application. The log files look like godc.log and restclient.log. Example: export GODC_LOG_TO_CONSOLE=true |