Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddtrace/tracer: improve agent connectivity check #719

Merged
merged 2 commits into from
Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ddtrace/tracer/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package tracer

import (
"bytes"
"encoding/json"
"fmt"
"math"
Expand Down Expand Up @@ -51,10 +52,12 @@ type startupInfo struct {
// If the endpoint is not reachable, checkEndpoint returns an error
// explaining why.
func checkEndpoint(endpoint string) error {
req, err := http.NewRequest("POST", endpoint, nil)
req, err := http.NewRequest("POST", endpoint, bytes.NewReader([]byte{0x90}))
if err != nil {
return fmt.Errorf("cannot create http request: %v", err)
}
req.Header.Set(traceCountHeader, "0")
req.Header.Set("Content-Type", "application/msgpack")
_, err = defaultClient.Do(req)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions ddtrace/tracer/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ type transport interface {

// newTransport returns a new Transport implementation that sends traces to a
// trace agent running on the given hostname and port, using a given
// http.RoundTripper. If the zero values for hostname and port are provided,
// *http.Client. If the zero values for hostname and port are provided,
// the default values will be used ("localhost" for hostname, and "8126" for
// port). If roundTripper is nil, a default is used.
// port). If client is nil, a default is used.
//
// In general, using this method is only necessary if you have a trace agent
// running on a non-default port, if it's located on another machine, or when
Expand Down