Closed tlhunter closed 10 months ago
What other versions are you using that are working? Did this specific service ever work with a different version?
On second look, we don't have any other Hapi services instrumented with Datadog. We've never seen middleware metrics displayed in the APM tool with this server.
Actually, I may have replied a bit too quickly. Looking at the code it doesn't look like middleware are instrumented for Hapi. Looking at the Hapi documentation, it also doesn't seem to have the concept of a middleware in the Express sense. Can you show an example of the code you would like to automatically get a span for?
Hapi takes a little different of an approach but essentially provides a bunch of hooks for injecting functionality at different stages of a request. I don't think they use the term middleware, but it's basically the same thing but with a different interface. I'm having trouble finding this list in the Hapi API docs, but here's a list that a third party put together: https://superchargejs.com/docs/master/request-lifecycle
So, for example, our project has a dozen onRequest
middleware, some onPreAuth
middleware, etc. We'd like it if Datadog could interpose on these layers, logging the time each one takes. Each one of these layers has a name that gets defined that can be used to differentiate them.
Fastify has a very similar pattern, not sure if Datadog is interposing on those. If so, might be able to reuse some code.
Makes sense. Do you think hapi.middleware
would make sense as the span name or would something else be more semantically correct?
Looking through articles about Hapi, it looks like they use the term "extension", and then the different sections like onRequest
are referred to as "extension points". I believe this is the list of all the extension points:
Here's a third party cheatsheet as I'm not finding results on hapi.dev: https://futurestud.io/downloads/hapi/request-lifecycle
I think hapi.extension
might be more correct in this case.
I'm closing this as it no longer affects the OP.
Describe the bug
APM traces don't seem to pick up middleware usage for the particular version of Hapi one of our services uses. Based on the docs I'm assuming it would automatically extract this info and visualize the middleware stages in the APM graphs.
For example, these
pg.query
calls belong to theonRequest
stage, but don't have any visible association with a middleware:Environment