utils

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var (
	JSONHeaders map[string]string = map[string]string{
		"Content-Type":     "application/json",
		"Content-Encoding": "gzip",
	}
	ProtobufHeaders map[string]string = map[string]string{
		"Content-Type":     "application/x-protobuf",
		"Content-Encoding": "identity",
	}
)

Functions

func CreateClient

func CreateClient(APIKey string, endpoint string) *datadog.Client

CreateClient creates a new Datadog client

func DoWithRetries

func DoWithRetries(maxRetries int, fn func() error) (i int, err error)

DoWithRetries repeats a fallible action up to `maxRetries` times with exponential backoff

func NewHTTPClient

func NewHTTPClient(timeout time.Duration) *http.Client

NewClient returns a http.Client configured with the Agent options.

func NormalizeServiceName added in v0.19.0

func NormalizeServiceName(service string) string

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 added in v0.18.0

func NormalizeSpanKind(kind pdata.SpanKind) string

NormalizeSpanKind returns a span kind with the SPAN_KIND prefix trimmed off

func NormalizeSpanName

func NormalizeSpanName(tag string, isService bool) string

func SetDDHeaders

func SetDDHeaders(reqHeader http.Header, startInfo component.ApplicationStartInfo, apiKey string)

SetDDHeaders sets the Datadog-specific headers

func SetExtraHeaders

func SetExtraHeaders(h http.Header, extras map[string]string)

SetExtraHeaders appends a header map to HTTP headers.

func UserAgent

func UserAgent(startInfo component.ApplicationStartInfo) string

func ValidateAPIKey

func ValidateAPIKey(logger *zap.Logger, client *datadog.Client)

ValidateAPIKey checks that the provided client was given a correct API key.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL