Cross-compatible hook/middleware + "plugins" which are allowed to be hook and middleware#1284
Open
brandur wants to merge 1 commit into
Open
Cross-compatible hook/middleware + "plugins" which are allowed to be hook and middleware#1284brandur wants to merge 1 commit into
brandur wants to merge 1 commit into
Conversation
…hook and middleware This one's largely aimed at extending a few parts of `otelriver` to be able to emit some additional useful metrics like time that it takes to lock jobs, number of jobs locked per batch, or any other arbitrary metrics we want to emit down the road. I previously had something similar back in #1203, but here we extract an isolated piece of it. This change does two things: * If either a hook sent to `Config.Hooks` implements a middleware or a middleware sent to `Config.Middleware` implements a hook, activate its alternate side as well. * Establish a new `Config.Plugins` that acts as a more generalized place where a hook/middleware can go. We define a plugin as this type: type Plugin interface { Hook Middleware } The reason for the first point is better backward compatibility. Notably, if I add a hook to `otelriver.Middleware`, I want it to be able to still work even if the user doesn't explicitly movie it from `Config.Middleware` to `Config.Plugins`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This one's largely aimed at extending a few parts of
otelriverto beable to emit some additional useful metrics like time that it takes to
lock jobs, number of jobs locked per batch, or any other arbitrary
metrics we want to emit down the road. I previously had something
similar back in #1203, but here we extract an isolated piece of it.
This change does two things:
If either a hook sent to
Config.Hooksimplements a middleware or amiddleware sent to
Config.Middlewareimplements a hook, activate itsalternate side as well.
Establish a new
Config.Pluginsthat acts as a more generalized placewhere a hook/middleware can go. We define a plugin as this type:
The reason for the first point is better backward compatibility.
Notably, if I add a hook to
otelriver.Middleware, I want it to be ableto still work even if the user doesn't explicitly movie it from
Config.MiddlewaretoConfig.Plugins.