-
Notifications
You must be signed in to change notification settings - Fork 501
Add GTest PrintTo function for PointDataAttributes #3365
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
Conversation
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3365 +/- ##
=======================================
Coverage 89.56% 89.56%
=======================================
Files 210 210
Lines 6502 6502
=======================================
Hits 5823 5823
Misses 679 679 🚀 New features to boost your workflow:
|
|
@yashykt - Can you revisit this PR, it seems to add/update ~1000 files. |
|
Seems some format is applied by accident? |
Actually, complete python venv has been added to the PR 🤦 |
|
my bad, and I thought I was careful :D |
|
@yashykt - I do see some concerns maintaining a test-only helper that isn’t covered by the spec in the repo, as we want to keep the public API minimal and clean. Wouldn’t it make more sense for users of the library to add their own PrintTo implementation in their test code, within the appropriate otel namespace, if they need custom GTest output? |
Adding methods to some other library's namespace is generally not recommended due to namespace pollution, conflicts, and general maintainability. But I guess I'll leave the decision to y'all. Do you feel comfortable with users adding their own methods to Alternative, we could create a separate |
Agree on the namespace pollution/conflicts concerns. I'm not a GTest expert, but I believe there should be alternatives to directly implementing PrintTo in our namespace. Users could employ custom formatters, wrappers, or mappers in their own test code instead. I have some concerns about adding a custom formatter directly in the OpenTelemetry repository. If users start depending on such implementation, we'd be obligated to maintain it indefinitely to avoid breaking their tests. This creates an unnecessary maintenance burden that isn't part of our core functionality. |
I second that. Ok to have helpers for testing, but this should be test code in a test library, not production code in the opentelemetry metrics library. In other words, we do not want to:
|
|
ack |
Addresses #3364 for my immediate needs
Changes
Added a
PrintTomethod forPointDataAttributes. (We could probably do this for all the other types, but for my immediate needs, this is enough.)I'm not sure where the maintainers would prefer such functions to be placed. Open to suggestions.