import { Context, Handler } from "aws-lambda"; import { MetricsConfig, MetricsQueue } from "./metrics"; import { TraceConfig } from "./trace"; import { Logger } from "./utils"; import { DatadogTraceHeaders } from "./trace/context/extractor"; export { DatadogTraceHeaders as TraceHeaders } from "./trace/context/extractor"; export declare const apiKeyEnvVar = "DD_API_KEY"; export declare const apiKeyKMSEnvVar = "DD_KMS_API_KEY"; export declare const apiKeySecretARNEnvVar = "DD_API_KEY_SECRET_ARN"; export declare const captureLambdaPayloadEnvVar = "DD_CAPTURE_LAMBDA_PAYLOAD"; export declare const captureLambdaPayloadMaxDepthEnvVar = "DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH"; export declare const traceManagedServicesEnvVar = "DD_TRACE_MANAGED_SERVICES"; export declare const siteURLEnvVar = "DD_SITE"; export declare const logLevelEnvVar = "DD_LOG_LEVEL"; export declare const logForwardingEnvVar = "DD_FLUSH_TO_LOG"; export declare const logInjectionEnvVar = "DD_LOGS_INJECTION"; export declare const enhancedMetricsEnvVar = "DD_ENHANCED_METRICS"; export declare const datadogHandlerEnvVar = "DD_LAMBDA_HANDLER"; export declare const lambdaTaskRootEnvVar = "LAMBDA_TASK_ROOT"; export declare const mergeXrayTracesEnvVar = "DD_MERGE_XRAY_TRACES"; export declare const traceExtractorEnvVar = "DD_TRACE_EXTRACTOR"; export declare const defaultSiteURL = "datadoghq.com"; export declare const encodeAuthorizerContextEnvVar = "DD_ENCODE_AUTHORIZER_CONTEXT"; export declare const decodeAuthorizerContextEnvVar = "DD_DECODE_AUTHORIZER_CONTEXT"; export declare const coldStartTracingEnvVar = "DD_COLD_START_TRACING"; export declare const minColdStartTraceDurationEnvVar = "DD_MIN_COLD_START_DURATION"; export declare const coldStartTraceSkipLibEnvVar = "DD_COLD_START_TRACE_SKIP_LIB"; export declare const localTestingEnvVar = "DD_LOCAL_TESTING"; export declare const addSpanPointersEnvVar = "DD_TRACE_AWS_ADD_SPAN_POINTERS"; export declare const dataStreamsEnabledEnvVar = "DD_DATA_STREAMS_ENABLED"; interface GlobalConfig { /** * Whether to log extra information. * @default false */ debugLogging: boolean; /** * Whether to force the `datadog()` wrapper to always wrap. * @default false */ forceWrap: boolean; /** * Custom logger. */ logger?: Logger; } /** * Configuration options for Datadog's lambda wrapper. */ export type Config = MetricsConfig & TraceConfig & GlobalConfig; export declare const defaultConfig: Config; export declare const _metricsQueue: MetricsQueue; /** * Wraps your AWS lambda handler functions to add tracing/metrics support * @param handler A lambda handler function. * @param config Configuration options for datadog. * @returns A wrapped handler function. * * ```javascript * import { datadog } from 'datadog-lambda-js'; * function yourHandler(event) {} * exports.yourHandler = datadog(yourHandler); * ``` */ export declare function datadog(handler: Handler | any, config?: Partial): Handler | any; /** * * @param isResponseStreamFunction A boolean determining if a Lambda Function is Response Stream. * @param args Spread arguments of a Lambda Function. * @returns An object containing the context and the event of a Lambda Function. */ export declare function extractArgs(isResponseStreamFunction: boolean, ...args: any[]): { context: Context; event: TEvent; responseStream: any; }; /** * Sends a Distribution metric asynchronously to the Datadog API. * @param name The name of the metric to send. * @param value The value of the metric * @param metricTime The timestamp associated with this metric data point. * @param tags The tags associated with the metric. Should be of the format "tag:value". */ export declare function sendDistributionMetricWithDate(name: string, value: number, metricTime: Date, ...tags: string[]): void; /** * Sends a Distribution metric asynchronously to the Datadog API. * @param name The name of the metric to send. * @param value The value of the metric * @param tags The tags associated with the metric. Should be of the format "tag:value". */ export declare function sendDistributionMetric(name: string, value: number, ...tags: string[]): void; /** * Retrieves the Datadog headers for the current trace. */ export declare function getTraceHeaders(): Partial; export declare function getEnvValue(key: string, defaultValue: string): string; export declare function emitTelemetryOnErrorOutsideHandler(error: Error, functionName: string, startTime: number): Promise; //# sourceMappingURL=index.d.ts.map