Proposal: Telemetry event instead of predefined log message on batch timeout #1347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I really love the work done about batch timeouts in #1298, with one exception I noted in a comment there. On a timeout, Absinthe produces a predefined log message on error level. This goes against my thinking that libraries generally should not produce logs on runtime (only on startup or maintenance actions, such as running mix tasks), especially when there's a better option available.
This PR suggests adding a new telemetry event
[:absinthe, :middleware, :batch, :timeout]
instead, so everyone can attach to it and do whatever they want (including logging the same message on the same level).More context
I was about to bump Absinthe at our company project, but the approach with the log and not telemetry caused at least three hold-backs:
inspect(batch_fun)
is large.error
-level log message, but I'm not sure we want to trigger it in case of the timeout. Sowarning
level, at least for evaluation period, would work much better here.Other considerations
This is technically a breaking change, in case someone already relies on these log messages. But I think the capability was not advertised in changelog or anywhere, so perhaps it's safe to change. If not, perhaps we can at least give a configuration option to choose between the log message and telemetry.