Use Datadog tracer environment variables to setup default config
This commit is contained in:
parent
a3327c4430
commit
759d17547a
1 changed files with 13 additions and 4 deletions
|
@ -2,6 +2,8 @@ package datadog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/opentracing/opentracing-go"
|
"github.com/opentracing/opentracing-go"
|
||||||
|
@ -27,10 +29,17 @@ type Config struct {
|
||||||
|
|
||||||
// SetDefaults sets the default values.
|
// SetDefaults sets the default values.
|
||||||
func (c *Config) SetDefaults() {
|
func (c *Config) SetDefaults() {
|
||||||
c.LocalAgentHostPort = "localhost:8126"
|
host, ok := os.LookupEnv("DD_AGENT_HOST")
|
||||||
c.GlobalTag = ""
|
if !ok {
|
||||||
c.Debug = false
|
host = "localhost"
|
||||||
c.PrioritySampling = false
|
}
|
||||||
|
|
||||||
|
port, ok := os.LookupEnv("DD_TRACE_AGENT_PORT")
|
||||||
|
if !ok {
|
||||||
|
port = "8126"
|
||||||
|
}
|
||||||
|
|
||||||
|
c.LocalAgentHostPort = net.JoinHostPort(host, port)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets up the tracer.
|
// Setup sets up the tracer.
|
||||||
|
|
Loading…
Reference in a new issue