-
Notifications
You must be signed in to change notification settings - Fork 374
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
Memoize environment tags to improve performance #1762
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable. Since this is seems like an important component of CI performance, I suggest also adding a test for it, since otherwise we could mistakenly remove the memoization, degrading performance again, and nothing would break 😅 .
@@ -38,7 +38,10 @@ def self.set_tags!(span, tags = {}) | |||
span.context.origin = Ext::Test::CONTEXT_ORIGIN if span.context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⬆️ GitHub doesn't allow me to comment on line 34, but is it just me or is it kinda weird that this method can receive an arbitrary tags
hash, but does not actually set all of the tags in it, instead just cherry picking a few?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK it uses all tags
passed in, but then adds/overwrites them with metadata. This should be an internal API anyway used only by the CI auto-instrumentation.
@ivoanjo we have internal end-to-end performance tests that do this already. What would you suggest doing? A benchmark? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ivoanjo we have internal end-to-end performance tests that do this already. What would you suggest doing? A benchmark?
I was thinking more of a test that checks that Ext::Environment.tags(ENV)
only ever gets called only once.
But if the internal end-to-end tests already cover this comfortably, then I'm very OK with relying on that -- up to you :)
@ivoanjo oh that makes sense! I'm not familiar with the testing of this code, but we will definitely follow up with a test to avoid regressions. |
🎉 |
Fixes #1748
Environment tags do not change during the life of the test process, so we should calculate them only once.