Skip to content

feat: introduce "exit spans" and mark S3 spans as exit spans#2552

Merged
trentm merged 4 commits intomainfrom
trentm/issue2125-exit-spans-drop-S3-HTTP-spans
Jan 31, 2022
Merged

feat: introduce "exit spans" and mark S3 spans as exit spans#2552
trentm merged 4 commits intomainfrom
trentm/issue2125-exit-spans-drop-S3-HTTP-spans

Conversation

@trentm
Copy link
Copy Markdown
Member

@trentm trentm commented Jan 28, 2022

Per https://github.com/elastic/apm/blob/main/specs/agents/tracing-spans.md#exit-spans
the result is that HTTP child spans of S3 spans are no longer captured.

Closes: #2125

Overview

There is a boolean exitSpan option to the startSpan() APIs now, which we'll eventually use in our instrumentations. For now I've just added it to the s3 instrumentation to get a feel. When creating a new span, if its parent is an exitSpan then the span won't be created.

I manually tested that context-propagation still works, but don't have a test case for that, because it is a pain in the S3 tests. I plan to add tests for context-propagation still working in #2000 (because I already have a MockES in tests that I can easily use to test the traceparent et al headers).

In subsequent PRs we can work through adding , { exitSpan: true } to the relevant instrumentations.

Checklist

  • Implement code
  • Add tests
  • Update TypeScript typings
  • Update documentation
  • Add CHANGELOG.asciidoc entry
  • Commit message follows commit guidelines
  • aws-sdk TAV test run

@trentm trentm self-assigned this Jan 28, 2022
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Jan 28, 2022
@ghost
Copy link
Copy Markdown

ghost commented Jan 28, 2022

💚 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

  • Reason: null

  • Start Time: 2022-01-28T21:56:53.688+0000

  • Duration: 30 min 9 sec

  • Commit: bf01aef

Test stats 🧪

Test Results
Failed 0
Passed 243533
Skipped 0
Total 243533

🤖 GitHub comments

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

  • /test : Re-trigger the build.

  • run module tests for <modules> : Run TAV tests for one or more modules, where <modules> can be either a comma separated list of modules (e.g. memcached,redis) or the string literal ALL to test all modules

  • run benchmark tests : Run the benchmark test only.

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

@trentm
Copy link
Copy Markdown
Member Author

trentm commented Jan 28, 2022

I'm experimenting a bit with adding some span.context.http. For example:

    {
        "span": {
            "name": "S3 GetObject elasticapmtest-bucket-20220128213346",
            "type": "storage",
            "id": "4efe60d5f914412c",
            "transaction_id": "766ebd597ecbc0dd",
            "parent_id": "766ebd597ecbc0dd",
            "trace_id": "32663fe436de85979ae7426674892ff4",
            "subtype": "s3",
            "action": "GetObject",
            "timestamp": 1643405628127090,
            "duration": 270.786,
            "context": {
                "http": {
                    "method": "GET",
                    "status_code": 304,
                    "url": "https://s3.us-east-2.amazonaws.com/",
                    "response": {
                        "encoded_body_size": 0,
                        "headers": {
                            "x-amz-id-2": "qN15KVu9Soe42YSRcU1SNJ8z5XByyC85fS1GDvpZS9BnJTlyHbROwebKhq3LsfuHsFhNNMZGRZU=",
                            "x-amz-request-id": "G4TW207TJAMB962W",
                            "date": "Fri, 28 Jan 2022 21:33:49 GMT",
                            "last-modified": "Fri, 28 Jan 2022 21:33:48 GMT",
                            "etag": "\"fd33e2e8ad3cb1bdd3ea8f5633fcf5c7\"",
                            "server": "AmazonS3"
                        }
                    }
                },
                "destination": {
                    "service": {
                        "name": "s3",
                        "type": "storage",
                        "resource": "elasticapmtest-bucket-20220128213346"
                    },
                    "address": "s3.us-east-2.amazonaws.com",
                    "port": 443,
                    "cloud": {
                        "region": "us-east-2"
                    }
                }
            },
            "sync": false,
            "outcome": "success",
            "sample_rate": 1
        }
    }

However, I am inclined to not include:

  • method: Not that helpful.
  • url: Mostly redundant with context.destination.address.
  • response.headers: A lot of added size for uncertain utility. The inclusion of Amazon's request ID headers might be worth it.

@trentm
Copy link
Copy Markdown
Member Author

trentm commented Jan 28, 2022

run module tests for aws-sdk

@trentm
Copy link
Copy Markdown
Member Author

trentm commented Jan 28, 2022

The TAV test run for aws-sdk is getting out of hand again. They are a lot of the slowest TAV runs:

% ./dev-utils/jenkins-build-slow-steps.sh https://apm-ci.elastic.co/job/apm-agent-nodejs/job/apm-agent-nodejs-mbp/job/main/18/
...
1359145 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "bluebird" "12"
1361483 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "graphql" "12"
1363566 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "aws-sdk" "8"
1386958 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "aws-sdk" "14"
1402172 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "pg" "12"
1405902 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "hapi" "12"
1421825 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "knex" "12"
1422159 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "knex" "10"
1458659 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "knex" "14"
1505502 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "aws-sdk" "12"
1600148 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "apollo-server-express" "14"
1625149 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "apollo-server-express" "12"
1678785 FINISHED SUCCESS .ci/scripts/test.sh -b "release" -t "aws-sdk" "10"

Current TAV runs are testing all these release versions:

-- package versions matching "2.858.0 || 2.889.0 || 2.920.0 || 2.951.0 || 2.982.0 || 2.1013.0 || 2.1016.0 || >2.1016.0 <3": 2.858.0, 2.889.0, 2.920.0, 2.951.0, 2.982.0, 2.1013.0, 2.1016.0, 2.1017.0, 2.1018.0, 2.1019.0, 2.1020.0, 2.1021.0, 2.1022.0, 2.1023.0, 2.1024.0, 2.1025.0, 2.1026.0, 2.1027.0, 2.1028.0, 2.1029.0, 2.1030.0, 2.1031.0, 2.1032.0, 2.1033.0, 2.1034.0, 2.1035.0, 2.1036.0, 2.1037.0, 2.1038.0, 2.1039.0, 2.1040.0, 2.1041.0, 2.1042.0, 2.1043.0, 2.1044.0, 2.1045.0, 2.1046.0, 2.1047.0, 2.1048.0, 2.1049.0, 2.1050.0, 2.1051.0, 2.1052.0, 2.1053.0, 2.1054.0, 2.1055.0, 2.1056.0, 2.1057.0, 2.1058.0, 2.1059.0, 2.1060.0, 2.1061.0, 2.1062.0, 2.1063.0, 2.1064.0, 2.1065.0, 2.1066.0

I'll update the versions to test:

% ./dev-utils/aws-sdk-tav-versions.sh
  # Test v2.858.0, every N=41 of 209 releases, and current latest.
  versions: '2.858.0 || 2.899.0 || 2.940.0 || 2.981.0 || 2.1022.0 || 2.1063.0 || 2.1066.0 || >2.1066.0 <3'

@trentm
Copy link
Copy Markdown
Member Author

trentm commented Jan 28, 2022

run module tests for aws-sdk

@trentm trentm marked this pull request as ready for review January 28, 2022 22:33
@trentm trentm requested a review from astorm January 28, 2022 22:33
return null
}
return this._runCtxMgr.active().currTransaction() || null
return this._runCtxMgr.active().currTransaction()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REVIEW NOTE: This was redundant. RunContext.currTransaction() already defaults to null if there isn't a transaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-nodejs Make available for APM Agents project planning.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drop HTTP spans under S3 spans

3 participants