Documentation ¶
Overview ¶
Package clientutil contains the Datadog API client util functions.
Index ¶
- Variables
- func CreateAPIClient(buildInfo component.BuildInfo, endpoint string, ...) *datadog.APIClient
- func CreateZorkianClient(apiKey string, endpoint string) *zorkian.Client
- func GetRequestContext(ctx context.Context, apiKey string) context.Context
- func NewHTTPClient(settings exporterhelper.TimeoutSettings, insecureSkipVerify bool) *http.Client
- func SetDDHeaders(reqHeader http.Header, buildInfo component.BuildInfo, apiKey string)
- func SetExtraHeaders(h http.Header, extras map[string]string)
- func UserAgent(buildInfo component.BuildInfo) string
- func ValidateAPIKey(ctx context.Context, apiKey string, logger *zap.Logger, ...) error
- func ValidateAPIKeyZorkian(logger *zap.Logger, client *zorkian.Client) error
- func WrapError(err error, resp *http.Response) error
- type Retrier
Constants ¶
This section is empty.
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")
var GZipSubmitMetricsOptionalParameters = datadogV2.NewSubmitMetricsOptionalParameters().WithContentEncoding(datadogV2.METRICCONTENTENCODING_GZIP)
GZipSubmitMetricsOptionalParameters is used to enable gzip compression for metric payloads submitted by native datadog client
Functions ¶
func CreateAPIClient ¶ added in v0.69.0
func CreateAPIClient(buildInfo component.BuildInfo, endpoint string, settings exporterhelper.TimeoutSettings, insecureSkipVerify bool) *datadog.APIClient
CreateAPIClient creates a new Datadog API client
func CreateZorkianClient ¶ added in v0.67.0
CreateZorkianClient creates a new Zorkian Datadog client Deprecated: CreateZorkianClient returns a Zorkian Datadog client and Zorkian is deprecated. Use CreateAPIClient instead.
func GetRequestContext ¶ added in v0.69.0
GetRequestContext creates a new context with API key for DatadogV2 requests
func NewHTTPClient ¶
func NewHTTPClient(settings exporterhelper.TimeoutSettings, insecureSkipVerify bool) *http.Client
NewHTTPClient returns a http.Client configured with the Agent options.
func SetDDHeaders ¶
SetDDHeaders sets the Datadog-specific headers
func SetExtraHeaders ¶
SetExtraHeaders appends a header map to HTTP headers.
func ValidateAPIKey ¶
func ValidateAPIKey(ctx context.Context, apiKey string, logger *zap.Logger, apiClient *datadog.APIClient) error
ValidateAPIKey checks if the API key (not the APP key) is valid
func ValidateAPIKeyZorkian ¶ added in v0.67.0
ValidateAPIKeyZorkian checks that the provided client was given a correct API key. Deprecated: ValidateAPIKeyZorkian uses the deprecated Zorkian client. Use ValidateAPIKey instead.
Types ¶
type Retrier ¶
type Retrier struct {
// contains filtered or unexported fields
}
func NewRetrier ¶
func NewRetrier(logger *zap.Logger, settings configretry.BackOffConfig, scrubber scrub.Scrubber) *Retrier