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

feat(opentelemetry-sampler-aws-xray): add rule cache and rule matching #1463

Closed

Conversation

carolabadeer
Copy link
Contributor

@carolabadeer carolabadeer commented Apr 7, 2023

Which problem is this PR solving?

Short description of the changes

  • Added resource to remote sampler constructor
  • Added rule cache and rule matching logic
  • Added reservoir and statistics interfaces and respective classes (currently skeleton classes that will be implemented in the next PR)

Temporary note: Since the first PR that this builds on has not yet been merged to main, the commits in it persist in this PR. Please only review the "add rule cache and rule matching" commit onwards, as the previous commits will be resolved once changes from main are pulled in.

@carolabadeer carolabadeer marked this pull request as ready for review April 11, 2023 18:58
@carolabadeer carolabadeer requested a review from a team April 11, 2023 18:58
Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

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

Maybe it would be good to have a samplers directory instead of putting this in packages to help with discoverability?

Can you please add yourself and this package to the component owners file?

@carolabadeer carolabadeer marked this pull request as draft May 11, 2023 22:48
@carolabadeer carolabadeer changed the title feat(opentelemetry-remote-sampler-aws-xray): add rule cache and rule matching feat(opentelemetry-sampler-aws-xray): add rule cache and rule matching May 31, 2023
@carolabadeer carolabadeer marked this pull request as ready for review May 31, 2023 23:29
Copy link
Member

@blumamir blumamir left a comment

Choose a reason for hiding this comment

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

Sorry for taking so long to review.

Added comments, mostly regarding performance, style, and conventions.

Since this package is hosted in opentelemetry but is written and maintained by AWS engineers, please feel free to resolve any thread that you are not interested in implementing or do not agree with.

packages/opentelemetry-sampler-aws-xray/src/utils.ts Outdated Show resolved Hide resolved
.match(convertPatternToRegex(pattern.toLowerCase()));

if (match === null) {
console.log(`WildcardMatch: no match found for ${text}`);
Copy link
Member

Choose a reason for hiding this comment

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

I know this is not the final artifact, but recommend using diag for these, as console.log can be easily forgotten in the future and print into end user apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely - since this feedback was given in the first PR, it will be incorporated in all 3 as well

packages/opentelemetry-sampler-aws-xray/src/utils.ts Outdated Show resolved Hide resolved

const match = text
.toLowerCase()
.match(convertPatternToRegex(pattern.toLowerCase()));
Copy link
Member

Choose a reason for hiding this comment

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

I saw this package in npm and wondering if we can replace some of the code here with it.

This will reduce code we need to maintain test and understand while benefiting from a mature package that abstract away many of the nitty details.

Not sure though if it's compatible to the format that x-ray uses, but that should be easy to check.

resource.attributes[SemanticResourceAttributes.CLOUD_PLATFORM];

// "Default" is a reserved keyword from X-Ray back-end.
if (this.RuleName === 'Default') {
Copy link
Member

Choose a reason for hiding this comment

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

Since it's used twice in the code (also in rule-cache.ts), consider extracting this const to consts.ts and copying the comment there.

@JamieDanielson
Copy link
Member

@carolabadeer Is this PR something you are still working on, or do you know if there is someone else at AWS who might be planning to pick this back up? It's a bit of a rough spot having part of the package already in the repo, though we have it in a incubating directory separate from the other published packages.

@carolabadeer
Copy link
Contributor Author

Hi @JamieDanielson, someone from AWS will likely be picking this up, although I am not sure about the timeline.

@JamieDanielson
Copy link
Member

Hi @JamieDanielson, someone from AWS will likely be picking this up, although I am not sure about the timeline.

Okay thanks for confirming! For now we are working on reviewing old PRs and think it makes sense to close this for now as it's not actively being worked on. When someone is ready to pick it back up, feel free to reopen this or open a new PR with these changes.

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

Successfully merging this pull request may close these issues.

5 participants