Documentation
¶
Index ¶
- Constants
- func AddTraceHeaders(ctx context.Context, req *http.Request)
- func Distribution(metric string, value float64, tags ...string)
- func DistributionWithContext(ctx context.Context, metric string, value float64, tags ...string)
- func GetContext() context.Context
- func GetTraceHeaders(ctx context.Context) map[string]string
- func WrapHandler(handler interface{}, cfg *Config) interface{}
- type Config
Constants ¶
View Source
const ( // DatadogAPIKeyEnvVar is the environment variable that will be used as an API key by default DatadogAPIKeyEnvVar = "DD_API_KEY" // DatadogSiteEnvVar is the environment variable that will be used as the API host. DatadogSiteEnvVar = "DD_SITE" )
Variables ¶
This section is empty.
Functions ¶
func AddTraceHeaders ¶
AddTraceHeaders adds DataDog trace headers to a HTTP Request
func Distribution ¶
Distribution sends a distribution metric to DataDog
func DistributionWithContext ¶
DistributionWithContext sends a distribution metric to DataDog
func GetContext ¶
GetContext retrieves the last created lambda context. Only use this if you aren't manually passing context through your call hierarchy.
func GetTraceHeaders ¶
GetTraceHeaders reads a map containing the DataDog trace headers from a context object.
func WrapHandler ¶
func WrapHandler(handler interface{}, cfg *Config) interface{}
WrapHandler is used to instrument your lambda functions, reading in context from API Gateway. It returns a modified handler that can be passed directly to the lambda.Start function.
Types ¶
type Config ¶
type Config struct {
// APIKey is your Datadog API key. This is used for sending metrics.
APIKey string
// ShouldRetryOnFailure is used to turn on retry logic when sending metrics via the API. This can negatively effect the performance of your lambda,
// and should only be turned on if you can't afford to lose metrics data under poor network conditions.
ShouldRetryOnFailure bool
// BatchInterval is the period of time which metrics are grouped together for processing to be sent to the API or written to logs.
// Any pending metrics are flushed at the end of the lambda.
BatchInterval time.Duration
// Site is the host to send metrics to. If empty, this value is read from the 'DD_SITE' environment variable, or if that is empty
// will default to 'datadoghq.com'.
Site string
}
Config gives options for how ddlambda should behave
Click to show internal directories.
Click to hide internal directories.