Skip to content

feat(compat): add Azure inventory payload core - #175

Open
nina9753 wants to merge 6 commits into
mainfrom
nina.rei/SVLS-9604/compat-inventory-azure
Open

nina9753 wants to merge 6 commits into
mainfrom
nina.rei/SVLS-9604/compat-inventory-azure

Conversation

@nina9753

@nina9753 nina9753 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add the reusable serverless compatibility inventory crate and payload builder
  • collect canonical Azure Functions identity, slot, runtime, and subscription metadata
  • keep scheduling and transport out of this foundational slice

Stack

  1. feat(compat): add Azure inventory payload core #175 — Azure identity and core payload (this PR)
  2. feat(compat): add GCP inventory collection #176 — GCP inventory collection, based on this PR
  3. feat(compat): add serverless-compat inventory reporter (SVLS-9604) #161 — reporter, transport, and compat integration

#176 targets this PR branch. #161 will be rebuilt on #176 and retained as the top, end-to-end-testable PR so its existing URL, comments, and review history remain intact.

Testing

  • cargo test --package datadog-serverless-compat-inventory --locked --offline
  • cargo clippy --package datadog-serverless-compat-inventory --all-targets --locked --offline -- -D warnings
  • rustfmt --edition 2024 --check on all new Rust sources
  • git diff --check

Copilot AI balanced review requested due to automatic review settings September 29, 2026 13:45
@nina9753
nina9753 requested review from a team as code owners September 29, 2026 13:45
@nina9753
nina9753 requested review from apiarian-datadog and shreyamalpani and removed request for a team September 29, 2026 13:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T13:48:55.941936Z cd00914 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unsafe test environment mutation, missing override coverage, and the unrelated TLS downgrade should be addressed.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds the foundational Azure Functions inventory payload crate for Serverless Compat.

Changes:

  • Collects canonical Azure identity, slot, runtime, region, and subscription metadata.
  • Builds serialized Fleet Automation inventory payloads.
  • Adds focused Azure and payload tests.
File Description
src/​platform/​mod.rs Dispatches platform metadata collection.
src/​platform/​azure.rs Collects Azure Functions metadata and identity.
src/​payload.rs Constructs serialized inventory payloads.
src/​lib.rs Exposes the inventory report API.
Cargo.toml Defines the new crate and dependencies.
Cargo.lock Registers the crate and changes rustls.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/datadog-serverless-compat-inventory/src/platform/azure.rs Outdated
Comment thread crates/datadog-serverless-compat-inventory/src/payload.rs Outdated

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

Copy link
Copy Markdown

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: cd00914fa7

ℹ️ 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 thread crates/datadog-serverless-compat-inventory/src/payload.rs Outdated

@apiarian-datadog apiarian-datadog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks pretty good to me, tho i'd defer to folks more familiar with serverless compat for an ultimate review.

("runtime", azure.get_runtime()),
(
"serverless_compat_runtime_version",
azure.get_runtime_version(),

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.

Isn't this the version of the runtime rather than the version of serverless compat? e.g. Python 3.13

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.

Yes, you're right. This is the application runtime version, for example Python 3.13. serverless_compat_runtime_version is the existing downstream field name, so I kept it for compatibility and added a comment clarifying the distinction. serverless_compat_version is the Compat package and release version.

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.

Just to clarify - serverless_compat_runtime_version is the downstream field name in the REDAPL table?

Comment on lines +36 to +45
let compat_version = env
.get_var("DD_SERVERLESS_COMPAT_VERSION")
.filter(|value| !value.is_empty())
.or_else(|| {
embedded_version
.map(str::trim)
.filter(|value| !value.is_empty())
.map(str::to_string)
})
.unwrap_or_else(|| env!("CARGO_PKG_VERSION").to_string());

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.

The values in compat_version seem to be overloaded. Currently the versions in DD_SERVERLESS_COMPAT_VERSION are the version of the runtime packages that the serverless compat rust agent is built into. With this change now the version number could refer to the binary itself. Couldn't that be confusing, especially if the version numbers are similiar?

My recommendation would be consider removing the binary version altogether (is it really needed?). If it is really needed then it should be in a separate field with a name that is sufficiently distinct fromDD_SERVERLESS_COMPAT_VERSION. Also I would not recommend reading from CARGO_PKG_VERSION since it will always return 0.1.0 from this value unless it's manually incremented.

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.

Good point. I removed the CARGO_PKG_VERSION fallback so we never report the inventory crate's hard-coded 0.1.0 as the Compat version. The field now uses only an explicit DD_SERVERLESS_COMPAT_VERSION or the embedded Serverless Compat release version, which represent the same package and release version. If neither is available, the field is omitted.

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.

My point is in the current state it is confusing that the compat_version saved could be either one of these versions from the runtime package (nuget, go, maven, npm, pypi):

Or it could be the version for the rust binary:

If we want to track the version for the rust binary I think it should be in a separate field to differentiate the version from those used by the runtime packages (nuget, go, maven, npm, pypi).

Comment on lines +22 to +30
// Non-production deployment slots share WEBSITE_SITE_NAME with the parent
// app but have their own ARM path and therefore need a distinct inventory ID.
let slot = env
.get_var("WEBSITE_SLOT_NAME")
.filter(|value| !value.is_empty() && !value.eq_ignore_ascii_case("production"));
let resource_id = match slot {
Some(slot) => format!("{base_resource_id}/slots/{}", slot.to_lowercase()),
None => base_resource_id.to_string(),
};

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.

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.

Agreed. I opened DataDog/libdatadog#2629 to move deployment-slot handling into libdd-common, where the canonical Azure resource ID can include non-production slots in one shared place. Because serverless-components currently consumes the published libdd-common 5.2 API, #175 retains the small local fallback until the next libdd-common release is available. I will update #175 to consume the shared resource ID after it is published.

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.

I would chat with someone on the libdatadog team to see if a minor version of libdd-common can be published from main. If the change is only merged to a hotfix branch at what point does it get merged to main?

Comment thread crates/datadog-serverless-compat-inventory/src/platform/azure.rs Outdated
Comment on lines +42 to +46
("runtime", azure.get_runtime()),
(
"serverless_compat_runtime_version",
azure.get_runtime_version(),
),

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.

I recall some different behavior with regards to the value and formatting for the runtime and runtime version values based on the hosting plan and operating system. Should some normalization be applied for these values?

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.

Good question. I checked the serverless-init and libdd-common behavior. This Compat path only handles Azure Functions, so the runtime comes directly from FUNCTIONS_WORKER_RUNTIME. Normalizing it here without a defined mapping could change valid values such as custom worker names and create a separate runtime taxonomy. I kept Azure's value as-is and retained the explicit DD_SERVERLESS_COMPAT_RUNTIME handoff as the override. If there are specific plan or OS mappings you expect, could you share them so we can encode those mappings with tests?

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.

A few examples (not comprehensive):

  • Elastic Premium and Dedicated App Service Plans for Linux show unknown for the runtime version
  • Java and Node.js Azure Functions sometimes have a ~ prefix in front of the runtime version
  • .NET Azure Functions will have a runtime dotnet or dotnet-isolated depending on whether or not it is an in process or isolated Azure Function

Comment thread .github/workflows/build-datadog-serverless-compat.yml Outdated
Comment thread crates/datadog-serverless-compat-inventory/src/platform/azure.rs Outdated
# SPDX-License-Identifier: Apache-2.0

[package]
name = "datadog-serverless-compat-inventory"

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.

What do you think about shortening this to just inventory?

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.

Agreed. I renamed the Cargo package and Rust crate to inventory and updated its consumers and lockfile entries.

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.

It looks like the directory name is still datadog-serverless-compat-inventory rather than inventory.

https://github.com/DataDog/serverless-components/blob/dd0b4f3fdf1614028561709bdee98d27c30d82ac/crates/datadog-serverless-compat-inventory/Cargo.toml

Comment thread crates/datadog-serverless-compat-inventory/Cargo.toml Outdated
@nina9753
nina9753 added this pull request to stack #177 October 5, 2026 20:05
@nina9753
nina9753 requested a review from duncanpharvey October 5, 2026 20:52

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants