[refactor] Refactor jptrace/attributes_tests.go for readability#6786
[refactor] Refactor jptrace/attributes_tests.go for readability#6786mahadzaryab1 merged 6 commits intojaegertracing:mainfrom
jptrace/attributes_tests.go for readability#6786Conversation
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.
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
AttributesToStringMapininternal/jptrace/attributes.goto convert pcommon.Map attributes to a map[string]string. - Modified AttributesToMap: Updates
AttributesToMapininternal/jptrace/attributes.goto convert pcommon.Map attributes to a map[string]any. - Test Refactoring: Refactors tests in
internal/jptrace/attributes_test.goto accommodate the newAttributesToStringMapmethod and the updatedAttributesToMapmethod. - Integration Adjustment: Adjusts the call to the attributes conversion in
cmd/jaeger/internal/integration/trace_reader.goto use the newAttributesToStringMapmethod. - Storage API Adjustment: Adjusts the call to the attributes conversion in
internal/storage/v2/api/tracestore/reader.goto use the newAttributesToStringMapmethod.
Changelog
Click here to see the changelog
- cmd/jaeger/internal/integration/trace_reader.go
- Replaces
AttributesToMapwithAttributesToStringMapon line 124.
- Replaces
- internal/jptrace/attributes.go
- Introduces
AttributesToStringMapfunction converting pcommon.Map to map[string]string (lines 21-27). - Modifies
AttributesToMapfunction converting pcommon.Map to map[string]any (lines 30-36).
- Introduces
- internal/jptrace/attributes_test.go
- Renames
TestAttributesToMaptoTestAttributesToStringMap(line 13). - Adds a new
TestAttributesToMapto test the new implementation of the function (lines 63-107). - Updates
TestMapToAttributesto assert equality withAttributesToStringMap(line 135).
- Renames
- internal/storage/v2/api/tracestore/reader.go
- Replaces
AttributesToMapwithAttributesToStringMapon 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.
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>
…egertracing#6786) ## Description of the changes - Addresses the leftover comments from jaegertracing#6785 ## How was this change tested? - CI ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com> Signed-off-by: amol-verma-allen <amol.verma@allen.in>
Description of the changes
attributes_test.go#6785How was this change tested?
Checklist
jaeger:make lint testjaeger-ui:npm run lintandnpm run test