Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add s3 session wrapper #927

Merged
merged 29 commits into from
Apr 8, 2021
Merged

Conversation

stuartnelson3
Copy link
Contributor

tracing for #881

note:

this is still a draft. I have a few questions which I'll call out specifically below.

@stuartnelson3 stuartnelson3 requested a review from axw April 6, 2021 11:10
@apmmachine
Copy link
Contributor

apmmachine commented Apr 6, 2021

💚 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

Expand to view the summary

Build stats

  • Build Cause: Pull request #927 updated

  • Start Time: 2021-04-08T12:30:03.461+0000

  • Duration: 30 min 27 sec

  • Commit: d2cc381

Test stats 🧪

Test Results
Failed 0
Passed 10087
Skipped 266
Total 10353

Trends 🧪

Image of Build Times

Image of Tests

I had to hunt around for this, and the first place
I looked was the Makefile (where I would expect
code generation to occur).
Makefile Outdated Show resolved Hide resolved
@stuartnelson3 stuartnelson3 marked this pull request as ready for review April 6, 2021 12:50
@stuartnelson3
Copy link
Contributor Author

note: default make target was updating the deps for all the modules. this has been committed separately in case there's another process to go about doing that.

@stuartnelson3
Copy link
Contributor Author

seems like make check-modules is failing, but make update-modules doesn't appear to do anything ...

[2021-04-06T12:57:03.799Z] go run scripts/genmod/main.go -check .
[2021-04-06T12:57:05.187Z] # checking go.elastic.co/apm/module/apmhttp
[2021-04-06T12:57:07.097Z] # checking go.elastic.co/apm
[2021-04-06T12:57:07.097Z]  - missing "replace go.elastic.co/apm/module/apmhttp => module/apmhttp"
[2021-04-06T12:57:07.097Z] 2021/04/06 12:57:06 /var/lib/jenkins/workspace/agent-go_apm-agent-go-mbp_PR-927/src/go.elastic.co/apm/go.mod invalid
[2021-04-06T12:57:07.097Z] exit status 1
[2021-04-06T12:57:07.097Z] Makefile:29: recipe for target 'check-modules' failed

Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Looking good! The main thing I'd like to see is to move this to a more general module that can create spans for arbitrary aws-sdk-go services.

Makefile Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
model/generate.sh Outdated Show resolved Hide resolved
module/apms3session/session.go Outdated Show resolved Hide resolved
module/apms3session/session.go Outdated Show resolved Hide resolved
module/apms3session/session_test.go Outdated Show resolved Hide resolved
module/apms3session/session_test.go Outdated Show resolved Hide resolved
module/apms3session/session.go Outdated Show resolved Hide resolved
module/apms3session/session.go Outdated Show resolved Hide resolved
There are two names the bucket name can get
encoded into the request URL, either as a
subdomain prepended to the host, or as the first
member in the path. Handle both of these, as we
don't have control over which will be used.

Even if explicitly set in the config to use the
hosted bucket style, it might only be able to do
the path style.

https://github.com/aws/aws-sdk-go/blob/main/aws/config.go#L118-L127
also, add make target that will update the file if
a new module is created.
seems the tests are failing to build on older
versions of go
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Nearly there, just a few more small things. We'll also need to add docs: docs/supported_tech.asciidoc and docs/instrumenting.asciidoc. Up to you if you want to do it in this PR or in a followup

Makefile Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
module/apmawssdkgo/session.go Outdated Show resolved Hide resolved
module/apmawssdkgo/session.go Outdated Show resolved Hide resolved
module/apmawssdkgo/session.go Outdated Show resolved Hide resolved
module/apmawssdkgo/session.go Outdated Show resolved Hide resolved
spancontext.go Outdated Show resolved Hide resolved
module/apmawssdkgo/session.go Show resolved Hide resolved
module/apmawssdkgo/session_test.go Outdated Show resolved Hide resolved
module/apmawssdkgo/session_test.go Outdated Show resolved Hide resolved
This reverts commit 052125a.
As mentioned in the comment, after 3 attempts I
wasn't able to find an S3 request that used the
virtual bucket style pathing (which is supposed to
be the default). I opted to test the function for
now, even though it's private.
If the bucket name is all caps, it forces the path
style URL structure; if the bucket name is
lowercase, it will default to virtual bucket
style. Test that both cases are handled.
@stuartnelson3
Copy link
Contributor Author

Going to merge this in favor of moving forward on dynamodb and other services, seems like most of the code will be branching within the send() function based on service type. Can circle back in subsequent PRs if there are outstanding issues that still need to be addressed.

Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Looks great now, thank you!

@stuartnelson3 stuartnelson3 merged commit f62afdf into elastic:master Apr 8, 2021
@stuartnelson3 stuartnelson3 deleted the apms3session branch April 8, 2021 14:23
stuartnelson3 added a commit that referenced this pull request Jul 30, 2021
Add a wrapper around the aws-sdk-go `session.Session` struct which instruments outgoing requests.

This currently only correctly traces calls to `s3`; using the session with other services will produce incorrect traces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants