redpanda-data / redpanda-data/benthos
Can we pass context.Context to custom Bloblang functions?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 571
- Forks
- 120
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 18
Description
Hey team,
I’m writing some custom Bloblang functions for a Benthos pipeline, and I noticed I can’t get the tracing info (trace / span) that’s already on the message. The reason is the current function signature doesn’t give us a context.Context.
Right now it’s:
func myFunc(args ...any) (any, error) {
// no ctx here
}
If we could write it like this instead:
func myFunc(ctx context.Context, args ...any) (any, error) {
span := trace.SpanFromContext(ctx)
// do stuff...
}
we could:
- keep end-to-end tracing intact (no more orphan spans)
- respect timeouts and cancellations coming from upstream
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the custom Bloblang function registration and the current func(args ...any) (any, error) entry point; read how the message context is available there. Done means custom functions can receive context.Context and use tracing information plus upstream timeout and cancellation behavior without breaking existing function behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100