Search code examples
aws-lambdaaws-xray

java lambda don't write on aws x-ray


i try write on aws x-ray but, don't do it.

Subsegment subsegment = AWSXRay.beginSubsegment("Obtene documento de s3");
        subsegment.addPrecursorId("descarga de documento");
        FilePdf pdf = new FilePdf(System.getenv().get("AccesKey"), System.getenv().get("SecretKey"));
        subsegment.addPrecursorId("descarga de documento");
        pdf.setInputFile(input.getFileName());
        pdf.setTemporaryFile("temporary.pdf");
        subsegment.addPrecursorId("documento en otp");
        subsegment.end();

how i do it??


Solution

  • If you are are doing this in a Lambda environment, make sure you have the "active tracing enabled" box checked in your Lambda console and that the permissions are set correctly on your Lambda function to write data to AWS X-Ray.

    If so, you should end the subsegment with the AWSXRay class as well, like so:

    AWSXRay.endSubsegment();