-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[refactor] Refactor jptrace/attributes_tests.go
for readability
#6786
[refactor] Refactor jptrace/attributes_tests.go
for readability
#6786
Conversation
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
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.
Hello @mahadzaryab1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request refactors the jptrace/attributes.go
file by introducing a new helper method AttributesToStringMap
and modifying the existing AttributesToMap
method. It also updates the tests to reflect these changes. The primary goal is to address leftover comments from a previous pull request, specifically #6785.
Highlights
- New Helper Method: Introduces
AttributesToStringMap
ininternal/jptrace/attributes.go
to convert pcommon.Map attributes to a map[string]string. - Modified AttributesToMap: Updates
AttributesToMap
ininternal/jptrace/attributes.go
to convert pcommon.Map attributes to a map[string]any. - Test Refactoring: Refactors tests in
internal/jptrace/attributes_test.go
to accommodate the newAttributesToStringMap
method and the updatedAttributesToMap
method. - Integration Adjustment: Adjusts the call to the attributes conversion in
cmd/jaeger/internal/integration/trace_reader.go
to use the newAttributesToStringMap
method. - Storage API Adjustment: Adjusts the call to the attributes conversion in
internal/storage/v2/api/tracestore/reader.go
to use the newAttributesToStringMap
method.
Changelog
Click here to see the changelog
- cmd/jaeger/internal/integration/trace_reader.go
- Replaces
AttributesToMap
withAttributesToStringMap
on line 124.
- Replaces
- internal/jptrace/attributes.go
- Introduces
AttributesToStringMap
function converting pcommon.Map to map[string]string (lines 21-27). - Modifies
AttributesToMap
function converting pcommon.Map to map[string]any (lines 30-36).
- Introduces
- internal/jptrace/attributes_test.go
- Renames
TestAttributesToMap
toTestAttributesToStringMap
(line 13). - Adds a new
TestAttributesToMap
to test the new implementation of the function (lines 63-107). - Updates
TestMapToAttributes
to assert equality withAttributesToStringMap
(line 135).
- Renames
- internal/storage/v2/api/tracestore/reader.go
- Replaces
AttributesToMap
withAttributesToStringMap
on line 111.
- Replaces
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Did you know?
The OpenTelemetry project, which provides the pcommon library used in this PR, is the second most active project in the Cloud Native Computing Foundation (CNCF) after Kubernetes.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
The pull request introduces a new helper method AttributesToMap
to jptrace/attributes.go
and refactors the tests. The changes look good overall, but there are a few minor suggestions for improvement.
Summary of Findings
Merge Readiness
The code changes are well-structured and the tests are comprehensive. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. I believe this pull request is ready to be merged after addressing the comments.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6786 +/- ##
=======================================
Coverage 96.03% 96.04%
=======================================
Files 364 364
Lines 20690 20690
=======================================
+ Hits 19870 19872 +2
+ Misses 626 624 -2
Partials 194 194
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
jptrace/attributes.go
and refactor testsjptrace/attributes_tests.go
for readability
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
Description of the changes
attributes_test.go
#6785How was this change tested?
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test