Documentation ¶
Index ¶
- Constants
- Variables
- func CreateClient(APIKey string, endpoint string) *datadog.Client
- func GetRoot(t *pb.APITrace) *pb.Span
- func NewHTTPClient(settings exporterhelper.TimeoutSettings, insecureSkipVerify bool) *http.Client
- func NormalizeServiceName(service string) string
- func NormalizeSpanKind(kind ptrace.SpanKind) string
- func NormalizeSpanName(tag string, isService bool) string
- func NormalizeTag(v string) string
- func SetDDHeaders(reqHeader http.Header, buildInfo component.BuildInfo, apiKey string)
- func SetExtraHeaders(h http.Header, extras map[string]string)
- func TruncateUTF8(s string, limit int) string
- func UserAgent(buildInfo component.BuildInfo) string
- func ValidateAPIKey(logger *zap.Logger, client *datadog.Client) error
- type Retrier
Constants ¶
const ( // maximum for tag string lengths MaxTagLength = 200 // DefaultServiceName is the default name we assign a service if it's missing and we have no reasonable fallback // From: https://github.com/DataDog/datadog-agent/blob/eab0dde41fe3a069a65c33d82a81b1ef1cf6b3bc/pkg/trace/traceutil/normalize.go#L15 DefaultServiceName string = "unnamed-otel-service" )
constants for tags
Variables ¶
var ( // JSONHeaders headers for JSON requests. JSONHeaders = map[string]string{ "Content-Type": "application/json", "Content-Encoding": "gzip", } // ProtobufHeaders headers for protobuf requests. ProtobufHeaders = map[string]string{ "Content-Type": "application/x-protobuf", "Content-Encoding": "identity", } )
var ErrInvalidAPI = errors.New("API Key validation failed")
Functions ¶
func CreateClient ¶
CreateClient creates a new Datadog client
func GetRoot ¶
GetRoot extracts the root span from a trace From: https://github.com/DataDog/datadog-agent/blob/a6872e436681ea2136cf8a67465e99fdb4450519/pkg/trace/traceutil/trace.go#L27
func NewHTTPClient ¶
func NewHTTPClient(settings exporterhelper.TimeoutSettings, insecureSkipVerify bool) *http.Client
NewHTTPClient returns a http.Client configured with the Agent options.
func NormalizeServiceName ¶
NormalizeServiceName returns a span service name normalized to remove invalid characters TODO: we'd like to move to the datadog-agent traceutil version of this once it's available in the exportable package https://github.com/DataDog/datadog-agent/blob/eab0dde41fe3a069a65c33d82a81b1ef1cf6b3bc/pkg/trace/traceutil/normalize.go#L52
func NormalizeSpanKind ¶
NormalizeSpanKind returns a span kind with the SPAN_KIND prefix trimmed off
func NormalizeSpanName ¶
func NormalizeTag ¶
NormalizeTag applies some normalization to ensure the tags match the backend requirements. Specifically used for env tag currently port from: https://github.com/DataDog/datadog-agent/blob/c87e93a75b1fc97f0691faf78ae8eb2c280d6f55/pkg/trace/traceutil/normalize.go#L89
func SetDDHeaders ¶
SetDDHeaders sets the Datadog-specific headers
func SetExtraHeaders ¶
SetExtraHeaders appends a header map to HTTP headers.
func TruncateUTF8 ¶
TruncateUTF8 truncates the given string to make sure it uses less than limit bytes. If the last character is an utf8 character that would be splitten, it removes it entirely to make sure the resulting string is not broken. from: https://github.com/DataDog/datadog-agent/blob/140a4ee164261ef2245340c50371ba989fbeb038/pkg/trace/traceutil/truncate.go#L34-L49
func ValidateAPIKey ¶
ValidateAPIKey checks that the provided client was given a correct API key.
Types ¶
type Retrier ¶ added in v0.41.0
type Retrier struct {
// contains filtered or unexported fields
}
func NewRetrier ¶ added in v0.41.0
func NewRetrier(logger *zap.Logger, settings exporterhelper.RetrySettings, scrubber scrub.Scrubber) *Retrier
func (*Retrier) DoWithRetries ¶ added in v0.41.0
DoWithRetries does a function with retries. This is a condensed version of the code on the exporterhelper, which we reuse here since we want custom retry logic.