Skip to content

feat(apim): add inferred span support for Azure API Managment#7496

Merged
jcstorms1 merged 12 commits intomasterfrom
storms/add-apim-support
Feb 13, 2026
Merged

feat(apim): add inferred span support for Azure API Managment#7496
jcstorms1 merged 12 commits intomasterfrom
storms/add-apim-support

Conversation

@jcstorms1
Copy link
Copy Markdown
Contributor

@jcstorms1 jcstorms1 commented Feb 11, 2026

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.

image

Motivation

APMSVLS-383

Additional Notes

@jcstorms1 jcstorms1 requested a review from a team as a code owner February 11, 2026 18:12
@jcstorms1 jcstorms1 requested a review from a team as a code owner February 11, 2026 18:12
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 11, 2026

Overall package size

Self size: 4.62 MB
Deduped: 5.45 MB
No deduping: 5.45 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
Copy link
Copy Markdown

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 7.40741% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.15%. Comparing base (510563d) to head (5d9e775).
⚠️ Report is 34 commits behind head on master.

Files with missing lines Patch % Lines
...ckages/datadog-plugin-azure-functions/src/index.js 0.00% 25 Missing ⚠️
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     
Flag Coverage Δ
aiguard-macos 39.00% <50.00%> (-0.19%) ⬇️
aiguard-ubuntu 39.12% <50.00%> (-0.10%) ⬇️
aiguard-windows 38.86% <50.00%> (-0.22%) ⬇️
apm-capabilities-tracing-macos 48.74% <7.40%> (-0.11%) ⬇️
apm-capabilities-tracing-ubuntu 48.77% <7.40%> (-0.08%) ⬇️
apm-capabilities-tracing-windows 48.46% <7.40%> (-0.12%) ⬇️
apm-integrations-child-process 38.57% <50.00%> (-0.11%) ⬇️
apm-integrations-couchbase-18 37.47% <50.00%> (+0.04%) ⬆️
apm-integrations-couchbase-eol 37.96% <50.00%> (-0.11%) ⬇️
apm-integrations-oracledb 38.00% <50.00%> (-0.10%) ⬇️
appsec-express 55.37% <100.00%> (-0.07%) ⬇️
appsec-fastify 51.99% <100.00%> (-0.07%) ⬇️
appsec-graphql 52.34% <100.00%> (-0.05%) ⬇️
appsec-kafka 44.57% <50.00%> (-0.15%) ⬇️
appsec-ldapjs 44.33% <100.00%> (-0.06%) ⬇️
appsec-lodash 44.01% <100.00%> (-0.06%) ⬇️
appsec-macos 58.43% <100.00%> (-0.12%) ⬇️
appsec-mongodb-core 49.14% <100.00%> (-0.13%) ⬇️
appsec-mongoose 49.94% <100.00%> (-0.01%) ⬇️
appsec-mysql 51.33% <100.00%> (-0.01%) ⬇️
appsec-node-serialize 43.52% <100.00%> (-0.06%) ⬇️
appsec-passport 48.09% <100.00%> (-0.11%) ⬇️
appsec-postgres 51.09% <100.00%> (-0.04%) ⬇️
appsec-sourcing 42.87% <100.00%> (-0.06%) ⬇️
appsec-template 43.69% <100.00%> (-0.06%) ⬇️
appsec-ubuntu 58.51% <100.00%> (-0.06%) ⬇️
appsec-windows 58.28% <100.00%> (-0.15%) ⬇️
instrumentations-instrumentation-bluebird 32.27% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-body-parser 40.80% <100.00%> (-0.03%) ⬇️
instrumentations-instrumentation-child_process 37.88% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-cookie-parser 34.49% <50.00%> (-0.12%) ⬇️
instrumentations-instrumentation-express 34.83% <50.00%> (-0.12%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.63% <50.00%> (-0.12%) ⬇️
instrumentations-instrumentation-express-session 40.41% <100.00%> (-0.10%) ⬇️
instrumentations-instrumentation-fs 31.87% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-generic-pool 30.19% <ø> (+0.38%) ⬆️
instrumentations-instrumentation-http 39.59% <50.00%> (-0.13%) ⬇️
instrumentations-instrumentation-knex 32.27% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-mongoose 33.63% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-multer 40.54% <100.00%> (-0.03%) ⬇️
instrumentations-instrumentation-mysql2 38.37% <50.00%> (+<0.01%) ⬆️
instrumentations-instrumentation-passport 44.40% <100.00%> (+3.53%) ⬆️
instrumentations-instrumentation-passport-http 44.05% <100.00%> (+3.21%) ⬆️
instrumentations-instrumentation-passport-local 44.61% <100.00%> (+3.77%) ⬆️
instrumentations-instrumentation-pg 37.79% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-promise 32.20% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-promise-js 32.20% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-q 32.25% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-url 32.17% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-when 32.22% <50.00%> (-0.09%) ⬇️
llmobs-ai 41.41% <50.00%> (-0.24%) ⬇️
llmobs-anthropic 40.60% <50.00%> (-0.13%) ⬇️
llmobs-bedrock 39.49% <50.00%> (-0.11%) ⬇️
llmobs-google-genai 40.10% <50.00%> (-0.11%) ⬇️
llmobs-langchain 39.64% <50.00%> (-0.10%) ⬇️
llmobs-openai 44.45% <50.00%> (-0.13%) ⬇️
llmobs-vertex-ai 40.31% <50.00%> (-0.20%) ⬇️
platform-core 29.71% <ø> (+1.62%) ⬆️
platform-esbuild 32.89% <ø> (+1.40%) ⬆️
platform-instrumentations-misc 40.53% <ø> (+0.91%) ⬆️
platform-shimmer 36.14% <ø> (+1.31%) ⬆️
platform-unit-guardrails 31.27% <ø> (+0.89%) ⬆️
plugins-azure-event-hubs 24.02% <ø> (+1.38%) ⬆️
plugins-azure-service-bus 23.42% <ø> (+1.34%) ⬆️
plugins-bullmq 43.71% <50.00%> (-0.16%) ⬇️
plugins-cassandra 38.04% <50.00%> (-0.10%) ⬇️
plugins-cookie 25.08% <ø> (+1.38%) ⬆️
plugins-cookie-parser 24.87% <ø> (+1.37%) ⬆️
plugins-crypto 24.72% <ø> (+1.83%) ⬆️
plugins-dd-trace-api 38.42% <50.00%> (-0.10%) ⬇️
plugins-express-mongo-sanitize 25.04% <ø> (+1.36%) ⬆️
plugins-express-session 24.83% <ø> (+1.37%) ⬆️
plugins-fastify 42.52% <100.00%> (-0.10%) ⬇️
plugins-fetch 38.58% <50.00%> (-0.12%) ⬇️
plugins-fs 38.68% <50.00%> (-0.10%) ⬇️
plugins-generic-pool 24.06% <ø> (+1.38%) ⬆️
plugins-google-cloud-pubsub 45.73% <100.00%> (-0.10%) ⬇️
plugins-grpc 41.25% <50.00%> (-0.14%) ⬇️
plugins-handlebars 25.08% <ø> (+1.36%) ⬆️
plugins-hapi 40.43% <100.00%> (-0.25%) ⬇️
plugins-hono 40.70% <100.00%> (-0.03%) ⬇️
plugins-ioredis 38.48% <50.00%> (-0.10%) ⬇️
plugins-knex 24.80% <ø> (+1.29%) ⬆️
plugins-ldapjs 22.61% <ø> (+1.33%) ⬆️
plugins-light-my-request 24.48% <ø> (+1.33%) ⬆️
plugins-limitd-client 32.57% <50.00%> (-0.09%) ⬇️
plugins-lodash 24.13% <ø> (+1.39%) ⬆️
plugins-mariadb 39.58% <50.00%> (-0.13%) ⬇️
plugins-memcached 38.21% <50.00%> (-0.10%) ⬇️
plugins-microgateway-core 39.45% <100.00%> (-0.10%) ⬇️
plugins-moleculer 40.81% <50.00%> (-0.13%) ⬇️
plugins-mongodb 39.53% <50.00%> (-0.12%) ⬇️
plugins-mongodb-core 39.08% <50.00%> (-0.15%) ⬇️
plugins-mongoose 39.13% <50.00%> (-0.15%) ⬇️
plugins-multer 24.83% <ø> (+1.37%) ⬆️
plugins-mysql 39.23% <50.00%> (-0.14%) ⬇️
plugins-mysql2 39.33% <50.00%> (-0.08%) ⬇️
plugins-node-serialize 25.12% <ø> (+1.38%) ⬆️
plugins-opensearch 37.87% <50.00%> (-0.11%) ⬇️
plugins-passport-http 24.91% <ø> (+1.35%) ⬆️
plugins-postgres 35.73% <50.00%> (-0.20%) ⬇️
plugins-process 24.72% <ø> (+1.83%) ⬆️
plugins-pug 25.08% <ø> (+1.38%) ⬆️
plugins-redis 38.95% <50.00%> (-0.11%) ⬇️
plugins-router 43.30% <100.00%> (-0.04%) ⬇️
plugins-sequelize 23.66% <ø> (+1.38%) ⬆️
plugins-test-and-upstream-amqp10 38.55% <50.00%> (-0.10%) ⬇️
plugins-test-and-upstream-amqplib 43.89% <50.00%> (+0.04%) ⬆️
plugins-test-and-upstream-apollo 39.28% <50.00%> (-0.14%) ⬇️
plugins-test-and-upstream-avsc 38.82% <50.00%> (-0.10%) ⬇️
plugins-test-and-upstream-bunyan 33.88% <50.00%> (-0.09%) ⬇️
plugins-test-and-upstream-connect 41.11% <100.00%> (-0.04%) ⬇️
plugins-test-and-upstream-graphql 40.23% <50.00%> (-0.10%) ⬇️
plugins-test-and-upstream-koa 40.68% <100.00%> (-0.05%) ⬇️
plugins-test-and-upstream-protobufjs 39.05% <50.00%> (-0.10%) ⬇️
plugins-test-and-upstream-rhea 44.17% <50.00%> (-0.11%) ⬇️
plugins-undici 39.37% <50.00%> (-0.12%) ⬇️
plugins-url 24.72% <ø> (+1.83%) ⬆️
plugins-valkey 38.13% <50.00%> (-0.10%) ⬇️
plugins-vm 24.72% <ø> (+1.83%) ⬆️
plugins-winston 34.26% <50.00%> (-0.11%) ⬇️
plugins-ws 42.22% <50.00%> (-0.09%) ⬇️
profiling-macos 39.97% <50.00%> (-0.19%) ⬇️
profiling-ubuntu 40.10% <50.00%> (-0.12%) ⬇️
profiling-windows 41.34% <50.00%> (-0.23%) ⬇️
serverless-azure-functions-client 23.75% <ø> (+1.37%) ⬆️
serverless-azure-functions-eventhubs 23.75% <ø> (+1.37%) ⬆️
serverless-azure-functions-servicebus 23.75% <ø> (+1.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-official

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(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can just get rid of serverless I think.

@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Feb 12, 2026

Benchmarks

Benchmark execution time: 2026-02-13 20:18:08

Comparing candidate commit 5d9e775 in PR branch storms/add-apim-support with baseline commit 510563d in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 233 metrics, 27 unstable metrics.

@jcstorms1 jcstorms1 requested a review from bengl February 13, 2026 13:57
tlhunter
tlhunter previously approved these changes Feb 13, 2026
@lucaspimentel
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +42 to +44
const webContext = web.patch(req)
webContext.config = this.config
webContext.tracer = this.tracer
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +46 to +52
span = web.startServerlessSpanWithInferredProxy(
this.tracer,
this.config,
this.operationName(),
req,
ctx
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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
bengl previously approved these changes Feb 13, 2026
@jcstorms1 jcstorms1 dismissed stale reviews from bengl and tlhunter via 1cc861b February 13, 2026 19:51
Copy link
Copy Markdown
Collaborator

@bengl bengl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fixed bug needs a test to verify.

@jcstorms1 jcstorms1 merged commit ec08cdd into master Feb 13, 2026
791 checks passed
@jcstorms1 jcstorms1 deleted the storms/add-apim-support branch February 13, 2026 21:16
dd-octo-sts bot pushed a commit that referenced this pull request Feb 14, 2026
* 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
@dd-octo-sts dd-octo-sts bot mentioned this pull request Feb 14, 2026
juan-fernandez pushed a commit that referenced this pull request Feb 18, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants