-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Change resource.New() to use functional options; add builtin attributes for (host.*, telemetry.sdk.*) #1235
Conversation
Resolves #1076 |
Codecov Report
@@ Coverage Diff @@
## master #1235 +/- ##
========================================
+ Coverage 76.8% 77.1% +0.2%
========================================
Files 122 123 +1
Lines 5953 5985 +32
========================================
+ Hits 4574 4616 +42
+ Misses 1131 1121 -10
Partials 248 248
|
FYI I will address the feedback in this PR today. |
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.
We can probably merge this as is. Adding the exported type/method docs would be nice, but could be added in a follow on.
I will document this PR today. Sorry @MrAlias, and thanks for keeping me honest. |
❤️ Co-authored-by: Tyler Yahn <[email protected]>
@open-telemetry/go-approvers how would you feel about removing the current |
I am in favor of this 👍 |
I'm not sure about this. |
I had originally used |
I think that I like this approach. The addition of |
I'd like this to make progress. The current ideas for this signature:
Another proposal is to change the signature of |
I think my order of preference would be:
with the caveat that I for some reason actively dislike the last two. They just don't feel right compared with the other options. |
I applied your suggestion @Aneurysm9, renamed the new method to |
@XSAM we talked about this issue in the SIG meeting today and wanted to make sure we have consensus on this change going forward. We definitely value your opinion and want to understand if you are in strong opposition to these changes and if we can find an agreeable solution. |
The only last thought I have here is maybe the new method should be |
Yeah, that makes sense. |
I think this is ready to merge. @jmacd @Aneurysm9 thoughts? |
I think this is ready! 😀 |
…es for (host.*, telemetry.sdk.*) (open-telemetry#1235) * Add a resource.Configure() with functional options * Add a changelog * Add tests for builtin resources * Rename to WithoutBuiltin * Add new test; restore environment after tests * Apply feedback * Apply suggestions from code review :heart: Co-authored-by: Tyler Yahn <[email protected]> * Comment edits * Rename New, former method NewFromAttributes * NewFromAttributes->NewWithAttributes Co-authored-by: Tyler Yahn <[email protected]>
This adds
resource.NewConfig(ctx, ...)
with functional options:WithAttributes(...)
for directly adding key:valuesWithDetectors(...)
for directly adding resource detectorsWithTelemetrySDK(...)
to override the defaulttelemetry.sdk.*
resourcesWithHost(...)
to override the defaulthost.*
resourcesWithFromEnv(...)
to override the default environment configurationWithoutBuiltin()
to disable all builtin resourcesThe intention is to make it easy to configure a
*Resource
with the standard resources. This adds standard resource detectors for the telemetry SDK and host name.Resolves #1076.