-
Notifications
You must be signed in to change notification settings - Fork 887
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
Consider removing Resource::Merge() #62
Comments
I could imagine wanting to allow resources to be defined at various locations in the code. Maybe you have linked in some code that knows about Linux /proc file entries, and is able to generate detailed resource values. Another module knows about K8S and is able to generate detailed resource values. I wouldn't try to convince you that a single main() routine is going to be effective at gathering all the resource-providing modules; instead I think it should be possible to combine independently produced resource listings. That said, I wouldn't try to define the semantics of combining overlapping resource definitions. Why not treat the resource definition as a map, with normal update semantics? most programming runtimes do not specify the order of initializers, so the programmer should avoid creating overlapping resource definitions. I don't really see a problem that Merge will help with. |
@jmacd the way how merging is implemented (map semantics, or other strategy) will result in how this API will be used by different modules (as you mentioned k8s) and consumed by different implementation. For example imagine that we don't define a merge API then every module will try to overwrite all the fields because some implementation may decide to keep only the last Resource. So it is very important to define how multiple Resource will be "merged". So I feel uncomfortable to not have a well defined algorithm on how multiple resources will be merged together, but I am open to discuss if the current algorithm makes sense vs having a map like semantic or other semantics. Talking about "map semantic" I think we have some inconsistency there:
Because of this I think we cannot simply say that we have "map semantics" and we actually have to define the semantic. QQ: What is "normal update semantics"? |
I don't think defining map semantics is the hard part, it's that these updates happen in an undetermined order if we let them happen as a result of program initializers. I believe the options are to: (1) allow the ambiguity, suggest that names should be qualified by namespaces to avoid conflicts, and allow static initializers to apply global resources in unspecified order to the global tracer. I'd say it's more important to talk about namespaces than about merging algorithms. |
+1 I prefer simplicity, and I think this Merge() function and the respective merge semantics are unnecessary complications to the spec that can be easily handled by user code / instrumentation. But perhaps I am missing some elaborate use cases. |
@jmacd for the namespace discussion, see the current OpenCensus definition https://github.com/open-telemetry/opentelemetry-specification/blob/master/work_in_progress/opencensus/StandardResources.md @yurishkuro Merge is important in this scenario: |
Today spec does not define any scenario where resources could be merged (it only allows to assign one resource per tracer that propagates to spans) So having Merge API seems to serve some future scenarios. Introducing API in v1 for future scenarios that are not yet designed seems to be risky - chances are this API won't be needed or won't work as we will want it to. So I suggest that if we keep this API in v1, we should understand, support and document some scenarios where it is needed, If we don't have them - we should remove it. |
Closing this issue as Resource is not part of API anymore. Please re-open if you think this is still important or similar ;) |
This discussion #56 (comment)
The text was updated successfully, but these errors were encountered: