feat: allow customers to have codeless instrumentation#102
feat: allow customers to have codeless instrumentation#102duncanista wants to merge 3 commits intomainfrom
Conversation
| # Enable the instrumentation | ||
| end | ||
|
|
||
| def handler(event:, context:) |
There was a problem hiding this comment.
🔵 Code Quality Violation
Avoid top-level methods definition. Organize methods in modules/classes. (...read more)
This rule emphasizes the importance of organizing methods within modules or classes in Ruby. In Ruby, it's considered a best practice to wrap methods within classes or modules. This is because it helps in grouping related methods together, which in turn makes the code easier to understand, maintain, and reuse.
Not adhering to this rule can lead to a disorganized codebase, making it hard for other developers to understand and maintain the code. It can also lead to potential name clashes if a method is defined in the global scope.
To avoid violating this rule, always define your methods within a class or a module. For example, instead of writing def some_method; end, you should write class SomeClass def some_method; end end. This not only adheres to the rule but also improves the readability and maintainability of your code.
| handler_file, HANDLER_METHOD = LAMBDA_HANDLER.split('.') | ||
|
|
||
| # Add extension to the handler file | ||
| handler_file += '.rb' |
There was a problem hiding this comment.
⚪ Code Quality Violation
| handler_file += '.rb' | |
| handler_file << '.rb' |
Avoid appending to string using += (...read more)
The rule to avoid slow string concatenation in Ruby is essential for writing efficient and fast-performing code. String concatenation using the += operator is slower because it creates a new string object every time it's used. This can lead to performance issues, especially in loops or large programs where numerous string concatenations might be happening.
Instead, the << operator, also known as the append operator, should be used for string concatenation in Ruby. The << operator modifies the original string, avoiding the creation of multiple unnecessary string objects. This results in faster execution time and lower memory usage, which is especially beneficial in larger applications or systems with limited resources.
Therefore, good coding practice in Ruby suggests using << for string concatenation instead of +=. For instance, output << "<p>#{text}</p>" is more efficient than output += "<p>#{text}</p>". Following this rule will help you write cleaner, faster, and more resource-efficient Ruby code.
What does this PR do?
WIP
Motivation
Testing Guidelines
Additional Notes
Types of changes
Check all that apply