public class DDLambda
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
|
DDLambda(com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent req,
com.amazonaws.services.lambda.runtime.Context cxt)
Create a trace-enabled DDLambda instrumenter given an APIGatewayProxyRequestEvent and a Lambda context
|
|
DDLambda(com.amazonaws.services.lambda.runtime.events.APIGatewayV2ProxyRequestEvent req,
com.amazonaws.services.lambda.runtime.Context cxt)
Create a trace-enabled DDLambda instrumenter given an APIGatewayV2ProxyEventRequest and a Lambda context
|
|
DDLambda(com.amazonaws.services.lambda.runtime.Context cxt)
Create a new DDLambda instrumenter given some Lambda context
|
protected |
DDLambda(com.amazonaws.services.lambda.runtime.Context cxt,
java.lang.String xrayTraceInfo)
Testing only: create a DDLambda instrumenter with a given context and xrayTraceInfo
|
|
DDLambda(Headerable req,
com.amazonaws.services.lambda.runtime.Context cxt)
Create a trace-enabled DDLambda instrumenter given a custom request object.
|
|
DDLambda(com.amazonaws.services.lambda.runtime.events.KinesisEvent event,
com.amazonaws.services.lambda.runtime.Context cxt)
Create a trace-enabled DDLambda instrumenter given an KinesisEvent and a Lambda context
|
|
DDLambda(com.amazonaws.services.lambda.runtime.events.SQSEvent event,
com.amazonaws.services.lambda.runtime.Context cxt)
Create a trace-enabled DDLambda instrumenter given an SQSEvent and a Lambda context
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.http.client.methods.HttpUriRequest |
addTraceHeaders(org.apache.http.client.methods.HttpUriRequest httpRequest)
Deprecated.
|
okhttp3.Request |
addTraceHeaders(okhttp3.Request request)
Deprecated.
|
java.net.URLConnection |
addTraceHeaders(java.net.URLConnection urlConnection)
Deprecated.
|
protected boolean |
checkEnhanced() |
protected boolean |
checkTraceEnabled()
Check to see if the user has set DD_TRACE_ENABLED
|
void |
error(com.amazonaws.services.lambda.runtime.Context cxt)
error increments the aws.lambda.enhanced.error metric in Datadog.
|
void |
finish()
Finish the active span.
|
java.util.Map<java.lang.String,java.lang.String> |
getTraceContext()
Get the trace context for trace/log correlation.
|
java.lang.String |
getTraceContextJSONString()
Get the trace context as a JSON string.
|
java.lang.String |
getTraceContextString()
Get the trace context in string form.
|
org.apache.http.client.methods.HttpGet |
makeHttpGet(java.lang.String url)
Deprecated.
|
okhttp3.Request.Builder |
makeRequestBuilder()
Deprecated.
|
java.net.URLConnection |
makeUrlConnection(java.net.URL url)
Deprecated.
|
void |
metric(java.lang.String name,
double value,
java.util.Map<java.lang.String,java.lang.Object> tags)
metric allows the user to record their own custom metric that will be sent to Datadog.
|
void |
metric(java.lang.String name,
double value,
java.util.Map<java.lang.String,java.lang.Object> tags,
java.util.Date date)
metric allows the user to record their own custom metric that will be sent to Datadog.
|
protected java.lang.String |
santitizeFunctionArn(java.lang.String functionArn) |
public DDLambda(com.amazonaws.services.lambda.runtime.Context cxt)
cxt - Enhanced Metrics pulls information from the Lambda context.protected DDLambda(com.amazonaws.services.lambda.runtime.Context cxt,
java.lang.String xrayTraceInfo)
cxt - Enhanced Metrics pulls information from the Lambda context.xrayTraceInfo - This would normally be the contents of the "_X_AMZN_TRACE_ID" env varpublic DDLambda(com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent req,
com.amazonaws.services.lambda.runtime.Context cxt)
req - Your Datadog trace headers are pulled from the request and sent to XRay for consumption by the
Datadog Xray Crawlercxt - Enhanced Metrics pulls information from the Lambda context.public DDLambda(com.amazonaws.services.lambda.runtime.events.APIGatewayV2ProxyRequestEvent req,
com.amazonaws.services.lambda.runtime.Context cxt)
req - Your Datadog trace headers are pulled from the request and sent to XRay for consumption by the
Datadog Xray Crawlercxt - Enhanced Metrics pulls information from the Lambda context.public DDLambda(com.amazonaws.services.lambda.runtime.events.SQSEvent event,
com.amazonaws.services.lambda.runtime.Context cxt)
event - Your Datadog trace headers are pulled from the SQS Event and sent to XRay for consumption by the
Datadog Xray Crawlercxt - Enhanced Metrics pulls information from the Lambda context.public DDLambda(com.amazonaws.services.lambda.runtime.events.KinesisEvent event,
com.amazonaws.services.lambda.runtime.Context cxt)
event - Your Datadog trace headers are pulled from the SQS Event and sent to XRay for consumption by the
Datadog Xray Crawlercxt - Enhanced Metrics pulls information from the Lambda context.public DDLambda(Headerable req, com.amazonaws.services.lambda.runtime.Context cxt)
req - A custom request object that implements Headerable. Datadog trace headers are pulled from this request object.cxt - Enhanced Metrics pulls information from the Lambda context.public void finish()
protected java.lang.String santitizeFunctionArn(java.lang.String functionArn)
protected boolean checkEnhanced()
protected boolean checkTraceEnabled()
public void metric(java.lang.String name,
double value,
java.util.Map<java.lang.String,java.lang.Object> tags)
name - The metric's namevalue - The metric's valuetags - A map of tags to be assigned to the metricpublic void metric(java.lang.String name,
double value,
java.util.Map<java.lang.String,java.lang.Object> tags,
java.util.Date date)
name - The metric's namevalue - The metric's valuetags - A map of tags to be assigned to the metricdate - The date under which the metric value will appear in datadogpublic void error(com.amazonaws.services.lambda.runtime.Context cxt)
cxt - The AWS Context provided to your handler@Deprecated
public java.net.URLConnection makeUrlConnection(java.net.URL url)
throws java.io.IOException
openConnection calls openConnection on the provided URL, adds the Datadog trace headers, and then returns the resulting URLConnection. This duplicates the usual workflow with a java.net.URLConnection
url - the URL to which you want to open a connection.java.io.IOException@Deprecated public java.net.URLConnection addTraceHeaders(java.net.URLConnection urlConnection)
Adds Datadog trace headers to a java.net.URLConnection, so you can trace downstream HTTP requests.
urlConnection - the URLConnection that will have the trace headers added to it.@Deprecated public org.apache.http.client.methods.HttpGet makeHttpGet(java.lang.String url)
Creates an Apache HttpGet instrumented with Datadog trace headers. Please note, this does not _execute_ the HttpGet, it merely creates a default HttpGet with headers added.
url - The URL that will eventually be gotten.@Deprecated public org.apache.http.client.methods.HttpUriRequest addTraceHeaders(org.apache.http.client.methods.HttpUriRequest httpRequest)
Adds Datadog trace header to an org.apache.http.client.methods.HttpUriRequest, so you can trace downstream HTTP requests.
httpRequest - the HttpUriRequest that will have the trace headers added to it.@Deprecated public okhttp3.Request.Builder makeRequestBuilder()
Create an OKHttp3 request builder with Datadog headers already added.
@Deprecated public okhttp3.Request addTraceHeaders(okhttp3.Request request)
Adds Datadog trace header to an OKHttp3 request, so you can trace downstream HTTP requests.
request - The OKHttp3 Request that will have the trace headers added to it.public java.util.Map<java.lang.String,java.lang.String> getTraceContext()
public java.lang.String getTraceContextString()
public java.lang.String getTraceContextJSONString()
class X {
// ...
public void sendMessageToSQS(DDLambda ddl) {
SendMessageRequest sendMessageRequest = new SendMessageRequest()
.withQueueUrl("somewhere")
.withMessageBody("foobar")
.withMessageAttributes(Map.of(
SQSHeaderable.DATADOG_ATTRIBUTE_NAME, new MessageAttributeValue().withStringValue(ddLambda.getTraceContextJSONString())
));
sqs.sendMessage(sendMessageRequest);
}
}