feat(apim): add inferred span support for Azure API Managment#7496
feat(apim): add inferred span support for Azure API Managment#7496
Conversation
Overall package sizeSelf size: 4.62 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 813.08 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7496 +/- ##
==========================================
- Coverage 80.34% 80.15% -0.19%
==========================================
Files 731 730 -1
Lines 31093 31217 +124
==========================================
+ Hits 24981 25022 +41
- Misses 6112 6195 +83
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
| webContext.config = this.config | ||
| webContext.tracer = this.tracer | ||
| // Creates a standard span and an inferred proxy span if headers are present | ||
| span = serverless.startServiceEntrypointSpan( |
There was a problem hiding this comment.
This is a new method you've added to web.js, but here you're referring to it as belonging to serverless. Does serverless include all of web.js? web.js is also required in this file. We could use some consistency here.
There was a problem hiding this comment.
Yeah we can just get rid of serverless I think.
BenchmarksBenchmark execution time: 2026-02-13 20:18:08 Comparing candidate commit 5d9e775 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 233 metrics, 27 unstable metrics. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6cf4d834e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const webContext = web.patch(req) | ||
| webContext.config = this.config | ||
| webContext.tracer = this.tracer |
There was a problem hiding this comment.
Preserve route path before finishing Azure HTTP spans
The new HTTP flow never sets webContext.paths, but web.finishAll() derives both http.route and the span resource.name from context.paths in addResponseTags()/addResourceTag(). Before this change, asyncEnd explicitly set context.paths = [path]; now every HTTP-triggered Azure Function span can collapse to a generic GET resource with no route, which loses endpoint-level visibility and changes aggregation for all HTTP functions.
Useful? React with 👍 / 👎.
| span = web.startServerlessSpanWithInferredProxy( | ||
| this.tracer, | ||
| this.config, | ||
| this.operationName(), | ||
| req, | ||
| ctx | ||
| ) |
There was a problem hiding this comment.
Keep Azure Functions component on HTTP invoke spans
Switching HTTP span creation from this.startSpan(...) to web.startServerlessSpanWithInferredProxy(...) changes the span’s default integration/component source from the Azure Functions plugin to the generic web helper. As a result, HTTP-triggered azure.functions.invoke spans are reclassified as web at creation time, which can break integration-level filtering/telemetry and makes HTTP Azure Function spans inconsistent with non-HTTP triggers.
Useful? React with 👍 / 👎.
bengl
left a comment
There was a problem hiding this comment.
A fixed bug needs a test to verify.
* initial * add apim to the inferrered proxy test * rename method * udpate method name in index.js * clean up some comments and remove serverless type * fix addRequestTags type * remove object.fromentries * remove unexpected import * re add object.fromentries * remove unwanted imports * fix bug found by codex * add test for bug caught by codex
* initial * add apim to the inferrered proxy test * rename method * udpate method name in index.js * clean up some comments and remove serverless type * fix addRequestTags type * remove object.fromentries * remove unexpected import * re add object.fromentries * remove unwanted imports * fix bug found by codex * add test for bug caught by codex
What does this PR do?
Adds support for Azure APIM inferred proxy spans in HTTP triggered azure functions. The inferred span is only added when the appropriate headers are detected from API Management.
Motivation
APMSVLS-383
Additional Notes