Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
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
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.
There was a problem hiding this comment.
💡 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".
apiarian-datadog
left a comment
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
Isn't this the version of the runtime rather than the version of serverless compat? e.g. Python 3.13
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Just to clarify - serverless_compat_runtime_version is the downstream field name in the REDAPL table?
| 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()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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):
- https://github.com/DataDog/datadog-serverless-compat-dotnet/releases/tag/v1.9.0
- https://github.com/DataDog/datadog-serverless-compat-go/releases/tag/datadogserverlesscompat%2Fv0.3.0
- https://github.com/DataDog/datadog-serverless-compat-java/releases/tag/v0.22.0
- https://github.com/DataDog/datadog-serverless-compat-js/releases/tag/v0.20.0
- https://github.com/DataDog/datadog-serverless-compat-py/releases/tag/v0.18.0
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).
| // 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(), | ||
| }; |
There was a problem hiding this comment.
This logic to pull information about the slot looks like it should live in https://github.com/DataDog/libdatadog/blob/188a1f3b0c1bc6de70787b442682e16b60c91c2b/libdd-common/src/azure_app_services.rs
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
| ("runtime", azure.get_runtime()), | ||
| ( | ||
| "serverless_compat_runtime_version", | ||
| azure.get_runtime_version(), | ||
| ), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
A few examples (not comprehensive):
- Elastic Premium and Dedicated App Service Plans for Linux show
unknownfor 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
dotnetordotnet-isolateddepending on whether or not it is an in process or isolated Azure Function
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| [package] | ||
| name = "datadog-serverless-compat-inventory" |
There was a problem hiding this comment.
What do you think about shortening this to just inventory?
There was a problem hiding this comment.
Agreed. I renamed the Cargo package and Rust crate to inventory and updated its consumers and lockfile entries.
There was a problem hiding this comment.
It looks like the directory name is still datadog-serverless-compat-inventory rather than inventory.


Summary
Stack
#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