Skip to content

feat: surface handler results to middleware chain#47

Merged
bougyman merged 1 commit intorubyists:mainfrom
pmcclory-pp:surface-handler-results-to-middleware
Apr 29, 2026
Merged

feat: surface handler results to middleware chain#47
bougyman merged 1 commit intorubyists:mainfrom
pmcclory-pp:surface-handler-results-to-middleware

Conversation

@pmcclory-pp
Copy link
Copy Markdown
Contributor

Use case is for OTEL tracing middleware. want to mark spans as errored if the handler failed. so errors can easily be identified, sampled etc

lambda do |wrapper|
result = execute_handler.call(wrapper, handler)
process_result(wrapper, result, callbacks)
result
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wouldn't #process_result just return a Result?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure i'm following. so we need to pass the result of actually executing the handler to the middleware chain. process_result just takes the result that is returned and calls the appropriate callback for the transport (req/reply or jetstream).

@pmcclory-pp pmcclory-pp force-pushed the surface-handler-results-to-middleware branch 2 times, most recently from 77aa415 to df0aea6 Compare April 28, 2026 21:09
@pmcclory-pp pmcclory-pp force-pushed the surface-handler-results-to-middleware branch from df0aea6 to ce5e055 Compare April 28, 2026 22:14
@bougyman bougyman merged commit eb046f2 into rubyists:main Apr 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants