redpanda-data / redpanda-data/benthos

Can we pass context.Context to custom Bloblang functions?

Open
#217 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bloblang enhancement plugin api
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.