-
Notifications
You must be signed in to change notification settings - Fork 503
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
Make SetResource return status, and call it synchronously in Batch[Log|Span]Processor #1898
base: main
Are you sure you want to change the base?
Conversation
/// This function SHOULD only be called once during the initialization of the exporter. | ||
/// This function SHOULD complete or abort within some timeout. This function SHOULD be | ||
/// implemented as a blocking API | ||
fn set_resource(&mut self, _resource: &Resource) -> LogResult<()> { |
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.
Why does set_resource
need to return a Result
or impose timeout limit on it? Shouldn't it always be a matter of assigning/copying a vector?
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.
Don't want to make assumptions on what the exporter does within set_resource()
. The exporter may choose to do some custom serialization for resource within this method, and then use this serialized data with every export. So better to have the status.
Can you elaborate more? I am not sure I follow the intention. What is broken and how is that being fixed ? |
This was discussed and agreed here: #1854 (comment)
This is neither a priority nor a required change. It was agreed upon earlier, and I just wanted to make such interface changes before the beta release. We can even kill this PR if we now agree with earlier interface :) |
Nothing is broken - Thanks for the context! I agree we need a solution to avoid random sleep, but not sure if the problem needs changes beyond BatchProcessors. BatchProcessors should be able to store the Resource reliably, irrespective of the fact that it uses channels for its internal comms. Is it possible to fix BatchProcessor alone? |
Yes, it is possible. However, |
You are right that exporter can do much more than just store the attributes. In fact, I think that is the right thing for exporters to do - pre-serialize once at startup those things which won't change. What is the SDK supposed to do, if the resource serialization fails in processor/exporter? Should it keep sending normal telemetry or abort that processor? Or should we just let Exporters/Processors deal with it (like logging, or fabricating default resource etc.) |
Currently, the SDK logs the error and continues emitting telemetry to the exporter. However, if we decide later, the return status gives flexibility for |
Changes
As discussed here
Make
SetResource
return status, and call it blockng in Batch[Log|Span]Processor. This makes the setting of resources during initialization deterministic.Earlier
Now:
Please provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes