koajs / bodyparser

Koa body parsing middleware
MIT License
1.31k stars 118 forks source link

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

Closed satazor closed 8 months ago

satazor commented 8 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 8 months ago
satazor commented 8 months ago

@fengmk2 thanks for the quick merge and release 🙏