apm-agent-python icon indicating copy to clipboard operation
apm-agent-python copied to clipboard

add span links from SQS messages in AWS lambda transactions

Open beniwohli opened this issue 2 years ago • 6 comments

closes #1473

beniwohli avatar Oct 06 '22 12:10 beniwohli

@basepi do you have a real word setup already where we could test this in AWS?

beniwohli avatar Oct 06 '22 12:10 beniwohli

:green_heart: Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-10-19T12:06:44.391+0000

  • Duration: 30 min 8 sec

Test stats :test_tube:

Test Results
Failed 0
Passed 5059
Skipped 3461
Total 8520

:green_heart: Flaky test report

Tests succeeded.

:robot: GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /test linters : Run the Python linters only.

  • /test full : Run the full matrix of tests.

  • /test benchmark : Run the APM Agent Python benchmarks tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

apmmachine avatar Oct 06 '22 12:10 apmmachine

:globe_with_meridians: Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (68/68) :green_heart:
Files 100.0% (229/229) :green_heart:
Classes 100.0% (229/229) :green_heart:
Lines 91.029% (18153/19942) :grey_exclamation:
Conditionals 74.571% (2824/3787) :grey_exclamation:

apmmachine avatar Oct 06 '22 12:10 apmmachine

@basepi do you have a real word setup already where we could test this in AWS?

I have a working setup on the receiving end, but not on the sending end. I can probably do something later this week, couple of higher priority things at the moment.

basepi avatar Oct 10 '22 16:10 basepi

If it helps, here is an SQS payload that we use for Node.js agent tests: https://github.com/elastic/apm-agent-nodejs/blob/main/test/lambda/fixtures/aws_sqs_test_data.json#L26-L37

It started as a real payload... to which I manually added the two conflicting Traceparent message attributes for testing.

trentm avatar Oct 11 '22 17:10 trentm

And if it helps, here are some AWS CLI commands I used to send SQS messages:

aws sqs create-queue --queue-name trentm-play-queue1
{
    "QueueUrl": "https://sqs.us-west-2.amazonaws.com/627286350134/trentm-play-queue"
}

aws sqs send-message \
    --queue-url "https://sqs.us-west-2.amazonaws.com/627286350134/trentm-play-queue" \
    --message-body 'this is my body' \
    --message-attributes '{
        "astr": {"DataType": "String", "StringValue": "a str value"}
    }'

aws sqs send-message \
    --queue-url "https://sqs.us-west-2.amazonaws.com/627286350134/trentm-play-queue" \
    --message-body 'this is my body' \
    --message-attributes file://send-message.json


       Command:

          aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQu
eue --message-body "Information about the largest city in Any Region." --delay-seconds 10 --mess
age-attributes file://send-message.json

       Input file (send-message.json):

          {
            "City": {
              "DataType": "String",
              "StringValue": "Any City"
            },
            "Greeting": {
              "DataType": "Binary",
              "BinaryValue": "Hello, World!"
            },
            "Population": {
              "DataType": "Number",
              "StringValue": "1250800"
            }
          }

       Output:

          {
            "MD5OfMessageBody": "51b0a325...39163aa0",
            "MD5OfMessageAttributes": "00484c68...59e48f06",
            "MessageId": "da68f62c-0c07-4bee-bf5f-7e856EXAMPLE"
          }

trentm avatar Oct 11 '22 17:10 trentm