Commit 72cfdf7
authored
perf(observability): tag APM spans with matched Express route (#635)
* perf(observability): tag APM spans with Express route (LFXV2-1637)
Add an applyCustomAttributesOnSpan hook on HttpInstrumentation that
sets http.route to req.baseUrl + req.route.path and updates the span
name to METHOD ROUTE. Datadog uses these to compute resource_name, so
spans now bucket by endpoint (e.g. GET /api/meetings/:id) instead of
bare HTTP method.
For SSR catch-all routes where req.route isn't set, fall back to
bucketing by first URL segment (e.g. /meetings/*) so SSR latency is
no longer lumped into a single GET bucket.
Signed-off-by: Asitha de Silva <asithade@gmail.com>
* fix(observability): bucket root SSR requests under route '/'
Address PR #635 review feedback from coderabbitai, copilot[bot]:
- otel.mjs: handle root path in SSR fallback so http.route is set
to '/' when URL has no segments. Previously, requests to '/' left
http.route unset and landed in the bare GET resource bucket — the
exact problem this PR set out to fix. The root dashboard route
(app.routes.ts path: '') is real SSR traffic, so this matters.
Resolves 2 review threads.
Signed-off-by: Asitha de Silva <asithade@gmail.com>
* fix(review): address PR #635 review feedback
Address review comments from copilot-pull-request-reviewer:
- otel.mjs: skip pure wildcard route paths ('**', '*', '/*', '/**')
so static-asset fallthrough does not collapse SSR spans into
GET ** (per copilot[bot])
- otel.mjs: strip trailing slash from concatenated routes so
router.get('/') mounts (e.g. /api/meetings/) bucket as their
canonical path (per copilot[bot])
- otel.mjs: bucket single-segment fallback URLs as exact paths
(e.g. /login) instead of /login/*, since they are concrete
endpoints not prefixes (per copilot[bot])
Resolves 4 review threads.
Signed-off-by: Asitha de Silva <asithade@gmail.com>
---------
Signed-off-by: Asitha de Silva <asithade@gmail.com>1 parent b2dce1f commit 72cfdf7
1 file changed
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
110 | 145 | | |
111 | 146 | | |
112 | 147 | | |
| |||
0 commit comments