koajs / bodyparser

Koa body parsing middleware
MIT License
1.3k stars 116 forks source link

feat: set name of middleware function to improve interop with monitoring tools #159

Closed satazor closed 4 months ago

satazor commented 4 months ago

Set name of middleware function to improve interop with monitoring tools.

Tools like @opentelemetry/instrumentation-koa use function names to generate span names. These names appear in UI of monitoring tools, such as datadog.

Because the returned function doesn't have a name, there's no hint about the actual middleware associated with that span. See below:

Screenshot 2024-03-24 at 13 03 42

In v4 the returned middleware had a name but in v5 got removed, see: https://github.com/koajs/bodyparser/blob/5678a79e64d7833e0dd7734c9e9de40126e14d98/index.js#L63.

Checklist

fengmk2 commented 4 months ago
satazor commented 4 months ago

@fengmk2 thanks for the quick merge and release 🙏