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

fix: Allow better comment handling in XrayTracingTemplateModifier #4940

Merged
merged 7 commits into from
Mar 29, 2023

Conversation

jfuss
Copy link
Contributor

@jfuss jfuss commented Mar 28, 2023

Which issue(s) does this change fix?

#4860

Why is this change necessary?

Fixes a bug in which the XrayTracingTemplateModifier was duplicating Globals.

How does it address the issue?

Reworks the XrayTracingTemplateModifier to be closer to the ApplicationInsights in using ruamel to parse and keep comments.

What side effects does this change have?

None. But I did remove unnecessary code and tests that we no longer needed.

Mandatory Checklist

PRs will only be reviewed after checklist is complete

  • Add input/output type hints to new functions/methods
  • Write design document if needed (Do I need to write a design document?)
  • Write/update unit tests
  • Write/update integration tests
  • Write/update functional tests if needed
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jfuss jfuss requested a review from a team as a code owner March 28, 2023 19:15
@jfuss jfuss requested review from sriram-mv and hawflau March 28, 2023 19:15
@jfuss jfuss requested review from mndeveci and removed request for sriram-mv March 28, 2023 19:30
Comment on lines 13 to 15
import ruamel.yaml
from ruamel.yaml import YAML
from ruamel.yaml.comments import CommentedMap
Copy link
Contributor

Choose a reason for hiding this comment

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

  • I like that you put imports under class so that they won't be loaded once the module is imported. But this module has only this class, which means this will be imported whenever the class is used. Should we move the imports to the top into others?
  • Line 13 imports entire ruamel.yaml but then next lines imports individual elements from ruamel.yaml again. Shouldn't we use one way or the other (either import everything or import only used stuff one by one)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just copied what was done in the application insights template modifier. I assumed it was done for a reason that way.

I moved the imports to the beginning of the file and updated references.

Copy link
Contributor

@hnnasit hnnasit left a comment

Choose a reason for hiding this comment

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

Thanks Jacob, left a small comment. Overall LGTM.

if self.template.get(self.GLOBALS):
template_globals = self.template.get(self.GLOBALS)

function_gloabls = template_globals.get(self.FUNCTION, {})
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: typo in variable name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Updated in the latest revision

@jfuss jfuss added this pull request to the merge queue Mar 29, 2023
Merged via the queue into aws:develop with commit bf09d01 Mar 29, 2023
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.

4 participants