feat: added environment capability [APMSP-3780]#2239
Conversation
📚 Documentation Check Results📦
|
a1dfa1a to
baa79d4
Compare
🔒 Cargo Deny Results📦
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: bed4965 | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1dfa1a88f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
baa79d4 to
9534a81
Compare
9534a81 to
d3d3c25
Compare
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
BenchmarksComparisonBenchmark execution time: 2026-07-15 13:31:11 Comparing candidate commit bed4965 in PR branch Found 4 performance improvements and 27 performance regressions! Performance is the same for 111 metrics, 0 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: bed4965e07
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| fn get(&self, name: &str) -> Result<Option<String>, EnvError> { | ||
| match std::env::var(name) { | ||
| Ok(v) => Ok(Some(v)), | ||
| Err(VarError::NotPresent) => Ok(None), |
There was a problem hiding this comment.
Reject invalid names on env reads
When get is called with an invalid variable name containing = or NUL, std::env::var reports that as VarError::NotPresent, so this branch returns Ok(None) even though the trait docs say that means the variable is unset. Because set and unset already validate these names, reads should do the same and return EnvError::Invalid rather than silently treating caller input errors as missing environment variables.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I don't necessarily agree but I'm leaving it open for a future reviewer's opinion on this.
What does this PR do?
Added capability to read and write environment variables
Motivation
dd-trace-js needing to add info from the env in their requests, it's better to have libdatadog drive the call
Additional Notes
Nop
How to test the change?
check, tests, check for wasm32