Upgrade Instana tracer and make process profiling configurable

This commit is contained in:
Andrii Kushch
2021-09-29 11:52:08 +02:00
committed by GitHub
parent 380514941c
commit 9ef3fc84f9
6 changed files with 56 additions and 27 deletions

View File

@@ -11,11 +11,12 @@ import (
// Name sets the name of this tracer.
const Name = "instana"
// Config provides configuration settings for a instana tracer.
// Config provides configuration settings for an instana tracer.
type Config struct {
LocalAgentHost string `description:"Set instana-agent's host that the reporter will used." json:"localAgentHost,omitempty" toml:"localAgentHost,omitempty" yaml:"localAgentHost,omitempty"`
LocalAgentPort int `description:"Set instana-agent's port that the reporter will used." json:"localAgentPort,omitempty" toml:"localAgentPort,omitempty" yaml:"localAgentPort,omitempty"`
LogLevel string `description:"Set instana-agent's log level. ('error','warn','info','debug')" json:"logLevel,omitempty" toml:"logLevel,omitempty" yaml:"logLevel,omitempty" export:"true"`
LocalAgentHost string `description:"Sets the Instana Agent host." json:"localAgentHost,omitempty" toml:"localAgentHost,omitempty" yaml:"localAgentHost,omitempty"`
LocalAgentPort int `description:"Sets the Instana Agent port." json:"localAgentPort,omitempty" toml:"localAgentPort,omitempty" yaml:"localAgentPort,omitempty"`
LogLevel string `description:"Sets the log level for the Instana tracer. ('error','warn','info','debug')" json:"logLevel,omitempty" toml:"logLevel,omitempty" yaml:"logLevel,omitempty" export:"true"`
EnableAutoProfile bool `description:"Enables automatic profiling for the Traefik process." json:"enableAutoProfile,omitempty" toml:"enableAutoProfile,omitempty" yaml:"enableAutoProfile,omitempty" export:"true"`
}
// SetDefaults sets the default values.
@@ -40,10 +41,11 @@ func (c *Config) Setup(serviceName string) (opentracing.Tracer, io.Closer, error
}
tracer := instana.NewTracerWithOptions(&instana.Options{
Service: serviceName,
LogLevel: logLevel,
AgentPort: c.LocalAgentPort,
AgentHost: c.LocalAgentHost,
Service: serviceName,
LogLevel: logLevel,
AgentPort: c.LocalAgentPort,
AgentHost: c.LocalAgentHost,
EnableAutoProfile: c.EnableAutoProfile,
})
// Without this, child spans are getting the NOOP tracer