Remove Resource public ctor as Provider expects ResourceBuilder now#1566
Conversation
CodeBlanch
left a comment
There was a problem hiding this comment.
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.mdupdated for non-trivial changes