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

AWS SDK instrumentation - DynamoDB attributes #2262

Merged
merged 7 commits into from Feb 22, 2021
Merged

AWS SDK instrumentation - DynamoDB attributes #2262

merged 7 commits into from Feb 22, 2021

Conversation

ghost
Copy link

@ghost ghost commented Feb 12, 2021

Closes #1198

Currently as PoC, after discussions concerning the previous attempt (custom "query" creation per DynamoDb operation).

Goals:

Remarks:

  • PoC, so may (and should) po polished, optimised and tested before releasing
  • if the approach is valid, will add all operations as per AWS SDK sem conventions

@anuraaga @trask please have a look - I'm primarily looking for validation of the presented approach :)

@anuraaga
Copy link
Contributor

Is the timing coincidentally the same as reviving my spec pr? Guessing not but interestingly close :)

open-telemetry/opentelemetry-specification#1422

Sorry I didn't get to look at the code yet at all but if you can compare with that and see any possible improvements on both sides, or otherwise confirm they aren't really related, that would be great and will check this out more by Monday

@ghost
Copy link
Author

ghost commented Feb 12, 2021

@anuraaga pure coincidence, but out of exactly the same reason - I was busy end of last year but got some extra time now ;) Proposed PR aims to provide implementation for setting attributes, without defining them - I planned to use your drafted sem convs :)

@ghost
Copy link
Author

ghost commented Feb 15, 2021

@anuraaga please have a look - updated the code for the initial implementation. If the direction is ok, I'll add rest of DynamoDb requests (hardcoded for now), some tests and a bit of clean up.

Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Thanks for helping with this! Generally looks good

@ghost
Copy link
Author

ghost commented Feb 16, 2021

@anuraaga another revision (with AWS SDK marshalling). Please have a look (will add more tests! :) ).

@ghost ghost marked this pull request as ready for review February 17, 2021 09:56
Function<String, Object> fieldValueProvider, FieldMapping fieldMapping, Span span) {
// traverse path
String[] path = fieldMapping.getFields();
Object target = fieldValueProvider.apply(camelCase(path[0]));
Copy link
Member

Choose a reason for hiding this comment

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

This camelCase() call wouldn't be needed if fields in AwsSdkRequestType were already camelCased, would it?

Copy link
Author

Choose a reason for hiding this comment

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

So, here's the deal - in AWS model, fields are CamelCased, but getters start with lowercase (FieldName vs fieldName). First field in a path is retrieved by getFieldValue call which takes field name, rest is retrieved with getter call. So either way we're going to transform the name, assuming we want to stay consistent with naming (avoid putting first camel cased and rest lowercased).

@ghost ghost changed the title Draft: AWS SDK instrumentation - DynamoDB attributes AWS SDK instrumentation - DynamoDB attributes Feb 18, 2021
Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@ghost
Copy link
Author

ghost commented Feb 18, 2021

@mateuszrzeszutek @anuraaga please have another look, resolved all comments. Notable changed:

  • additional NPE guards
  • improved serialization (fixed a bug in AWS SDK usage)
  • FieldMapping field paths are now fields (Camel Cased) with optional lowercasing for getter calls (so the other way around than it used to - better performance and improved readability)

Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Thanks, just nits

@ghost
Copy link
Author

ghost commented Feb 18, 2021

Nits done :) Awaiting merge (or an additional review ;) ).

@iNikem iNikem merged commit 17aae4d into open-telemetry:main Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS instrumentation - DynamoDB statements
4 participants