feat(stats)!: add agent version gating to client-side stats#2040
feat(stats)!: add agent version gating to client-side stats#2040VianneyRuhlmann wants to merge 5 commits into
Conversation
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: f0568c8 | Docs | Datadog PR Page | Give us feedback! |
22670c0 to
b607a25
Compare
📚 Documentation Check Results📦
|
Clippy Allow Annotation ReportComparing clippy allow annotations between branches:
Summary by Rule
Annotation Counts by File
Annotation Stats by Crate
About This ReportThis report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality. |
🔒 Cargo Deny Results📦
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2040 +/- ##
========================================
Coverage 72.90% 72.90%
========================================
Files 457 459 +2
Lines 75768 76309 +541
========================================
+ Hits 55238 55634 +396
- Misses 20530 20675 +145
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b607a2507d
ℹ️ 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".
| .info | ||
| .version | ||
| .as_ref() | ||
| .is_some_and(|v| (v.major, v.minor, v.patch) >= MIN_STATS_AGENT_VERSION) |
There was a problem hiding this comment.
Reject prerelease versions below the minimum
When the agent reports a prerelease such as 7.65.0-rc.1, the parser preserves that suffix in metadata, but this comparison only checks (major, minor, patch), so the prerelease is treated as satisfying the >= 7.65.0 gate. Under semver precedence 7.65.0-rc.1 is lower than 7.65.0, so in environments running RC/dev agents that also advertise /v0.6/stats, client-side stats can be enabled before the minimum supported stable agent version.
Useful? React with 👍 / 👎.
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
oscar.ledauphin@datadoghq.com unqueued this merge request |
| where | ||
| D: Deserializer<'de>, | ||
| { | ||
| let Some(raw) = Option::<String>::deserialize(deserializer)? else { |
There was a problem hiding this comment.
Small detail but this implies agent version is always a string, because otherwise the ? here is the only place we will return an Err and thus make the whole schema un-parsable.
In a more general note, I don't like how any parse failure in a field on the schema fails the deserialization of the whole struct because it makes for some really unclear errors. I don't have a solution tho :/
What does this PR do?
Parse the agent version as semver and check it when enabling client-side stats. Also check for the stats endpoint.
Motivation
According to spec client-side stats should only be enabled when agent version is higher than. 7.65 and the stats endpoint is available.
Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.