-
Notifications
You must be signed in to change notification settings - Fork 780
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
Remove Resource public ctor as Provider expects ResourceBuilder now #1566
Conversation
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.
I left the ctor public for two reasons:
- Spec specifically calls out a create method on Resource that accepts attributes. The ctor satisfied that nicely. Really Resource class is highly compliant with the spec.
- You can new up a Resource and pass it to the AddResource method on ResourceBuilder. User is free to do this, if they want to:
var builder = ResourceBuilder.CreateEmpty() .AddService("MyService") .AddResource(new Resource(new Dictionary<string, object> { ["Key1"] = "Value1" })) .AddResource(new Resource(new Dictionary<string, object> { ["Key2"] = "Value2" }));
If you still want to make internal though, fine with me.
Can I also remove builder.AddResource(Resource) as well? That'll ensure there is only way to create Resource - its through ResourceBuilder. |
Check out |
The extensibility for Resource would come through ResourceDetectors - we just need to wait for spec to finalize on that. (https://github.com/open-telemetry/oteps/blob/master/text/0111-auto-resource-detection.md) But, until then, we can still do the below, right?
|
Ya that would work fine, good call. |
Codecov Report
@@ Coverage Diff @@
## master #1566 +/- ##
==========================================
+ Coverage 81.00% 81.05% +0.05%
==========================================
Files 237 237
Lines 6453 6449 -4
==========================================
Hits 5227 5227
+ Misses 1226 1222 -4
|
Fixes #.
Changes
Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes