Cherry pick v1.7 into master
This commit is contained in:
parent
a09dfa3ce1
commit
b6498cdcbc
73 changed files with 6573 additions and 186 deletions
31
vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/transport.go
generated
vendored
31
vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/transport.go
generated
vendored
|
@ -10,7 +10,9 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var tracerVersion = "v1.0"
|
||||
// TODO(gbbr): find a more effective way to keep this up to date,
|
||||
// e.g. via `go generate`
|
||||
var tracerVersion = "v1.5.0"
|
||||
|
||||
const (
|
||||
defaultHostname = "localhost"
|
||||
|
@ -57,16 +59,8 @@ func newHTTPTransport(addr string) *httpTransport {
|
|||
"Datadog-Meta-Tracer-Version": tracerVersion,
|
||||
"Content-Type": "application/msgpack",
|
||||
}
|
||||
host, port, _ := net.SplitHostPort(addr)
|
||||
if host == "" {
|
||||
host = defaultHostname
|
||||
}
|
||||
if port == "" {
|
||||
port = defaultPort
|
||||
}
|
||||
addr = fmt.Sprintf("%s:%s", host, port)
|
||||
return &httpTransport{
|
||||
traceURL: fmt.Sprintf("http://%s/v0.3/traces", addr),
|
||||
traceURL: fmt.Sprintf("http://%s/v0.3/traces", resolveAddr(addr)),
|
||||
client: &http.Client{
|
||||
// We copy the transport to avoid using the default one, as it might be
|
||||
// augmented with tracing and we don't want these calls to be recorded.
|
||||
|
@ -118,3 +112,20 @@ func (t *httpTransport) send(p *payload) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// resolveAddr resolves the given agent address and fills in any missing host
|
||||
// and port using the defaults.
|
||||
func resolveAddr(addr string) string {
|
||||
host, port, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
// no port in addr
|
||||
host = addr
|
||||
}
|
||||
if host == "" {
|
||||
host = defaultHostname
|
||||
}
|
||||
if port == "" {
|
||||
port = defaultPort
|
||||
}
|
||||
return fmt.Sprintf("%s:%s", host, port)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue