-
Notifications
You must be signed in to change notification settings - Fork 35
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
Allow users to disable event serialization if metrics are empty #66
base: master
Are you sure you want to change the base?
Conversation
@jaredcnance, the description is somewhat confusing for a newbie (me)
I think it is written with the "internal knowledge" about I used the decorator The decorator seemed designed to make things simple, so I wouldn't necessarily know that simply by decorating, I was in the category of calling " |
@Jeff17Robbins thanks for the feedback. Actually in this context it
One option, is to change the default behavior so that if no metrics have been added, we don't emit anything by default. The problem is that I believe there are still use cases where you might want the events, even if it is just a record that the operation happened. It might be unexpected that if I remove a call to |
@jaredcnance if there are no metrics (and, say, no custom properties either), what is the use-case for the "empty" record in the log? I'm genuinely curious, since until now I was perceiving this simply as a bug, not as a feature! I don't think I've seen any examples of what it is for, or why someone might want it, which played a role in my perception. In reading the EMF spec, the definition of
where the Perhaps |
The use case might be that the event or invocation ever happened. You get a lot of metadata included in each event which might be valuable even if no metrics have been added. Now that being said, you raise a good point. If no metrics have been added we do not need to include the
I don’t believe there is any use case for this section if no metrics have been added. I will update the PR to skip adding this field if no metrics have been added. There is some overlap with this proposal and #57. I think an implementation for conditional filtering could support this use case without the need for an additional config flag. However, right now I think for now this is a relatively simple solution that is worth shipping by itself. Not sure if @benkehoe had any thoughts on this. |
Issue #, if available: Closes #51
Introduce a new configuration flag
ONLY_LOG_EVENTS_WITH_METRICS
which will allow users to disable serialization unless metrics are present. The reason this is put behind a flag is because some users may still expect events even if there are no metrics added. Another option would be to extend this to properties/dimensions as well so that we only skip serialization if the logger has not been updated at all.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.