| 436 | |
| 437 | // Small helper function to get flattened attributes for test comparison |
| 438 | function getAttributesForRoute(route: Route): SpanAttributes { |
| 439 | const { params, query } = route; |
| 440 | |
| 441 | const attributes: SpanAttributes = {}; |
| 442 | |
| 443 | for (const key of Object.keys(params)) { |
| 444 | attributes[`url.path.parameter.${key}`] = params[key]; |
| 445 | attributes[`params.${key}`] = params[key]; |
| 446 | } |
| 447 | for (const key of Object.keys(query)) { |
| 448 | const value = query[key]; |
| 449 | if (value) { |
| 450 | attributes[`query.${key}`] = value; |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | return attributes; |
| 455 | } |