feat(telemetry)!: Add Installation signature and AppProduct changes payloads#2213
feat(telemetry)!: Add Installation signature and AppProduct changes payloads#2213bwoebi wants to merge 1 commit into
Conversation
|
| pub use libdd_common::tag::{parse_tags, Tag}; | ||
| pub use libdd_common::{parse_uri, Endpoint}; |
There was a problem hiding this comment.
This is here. But we expose Tag currently publicly in data/metrics.rs. So we need that right now...
📚 Documentation Check Results📦
|
And some smaller stuff like more metric namespaces.
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📦
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f102bdf44
ℹ️ 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".
| #[cfg(feature = "telemetry")] | ||
| telemetry: Option<TelemetryConfig>, | ||
| #[cfg(feature = "telemetry")] | ||
| telemetry_handle: Option<TelemetryWorkerHandle>, |
There was a problem hiding this comment.
Initialize the telemetry handle field in the builder
With the default telemetry feature enabled, this newly added field is never initialized by TraceExporterBuilder::new(), so constructing the builder fails to compile (cargo check -p libdd-data-pipeline reports E0063 at the Self { ... } initializer). Please add telemetry_handle: None under the same cfg gate in new() so the default data-pipeline build remains usable.
Useful? React with 👍 / 👎.
| Telemetry, | ||
| Apm, | ||
| Sidecar, | ||
| Civisibility, |
There was a problem hiding this comment.
Serialize CI Visibility metrics under the expected namespace
Because this enum uses #[serde(rename_all = "snake_case")], the new Civisibility variant serializes as "civisibility" rather than the CI Visibility namespace name ("ci_visibility"). When callers register CI Visibility telemetry metrics with this variant, the payload will carry an unknown/misspelled namespace and those metrics can be rejected or misclassified; use a variant/serde rename that emits ci_visibility.
Useful? React with 👍 / 👎.
| dependencies: self.data.dependencies.unflushed().cloned().collect(), | ||
| integrations: self.data.integrations.unflushed().cloned().collect(), | ||
| install_signature: self.data.install_signature.clone(), | ||
| products: self.data.products.clone(), |
There was a problem hiding this comment.
Clear pending product changes after app-started
When a product is registered before send_start, it is included in the initial app-started payload here, but app_started_sent_success() only clears dependencies/configurations/integrations and leaves the product name in products_pending. The next FlushData will therefore emit an app-product-change for the same initial state, double-reporting product enablement; clear the pending product entries after a successful AppStarted send as well.
Useful? React with 👍 / 👎.
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub hash: Option<String>, | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub metadata: Option<Vec<DependencyMetadata>>, |
There was a problem hiding this comment.
Update all Dependency constructors for the new fields
Adding hash and metadata as required struct fields breaks existing in-tree constructors that still use Dependency { name, version } (for example datadog-sidecar-ffi/src/lib.rs:515), so after the data-pipeline initializer is fixed those crates will fail with E0063. Update those constructors to include the new fields, or use ..Default::default(), so the workspace continues to compile.
Useful? React with 👍 / 👎.
| if !self.data.products.is_empty() { | ||
| let products = self | ||
| .data | ||
| .products | ||
| .iter() | ||
| .map(|(name, state)| (name.clone(), state.clone())) | ||
| .collect(); | ||
| let product_change = | ||
| data::Payload::AppProductChange(data::AppProductChange { products }); |
There was a problem hiding this comment.
Gate extended-heartbeat product changes on pending state
Once any product has been recorded, every ExtendedHeartbeat takes this branch because it checks the full products map rather than products_pending, so long-running processes will emit app-product-change for unchanged product states on every extended heartbeat even after the pending set was cleared. Build this payload only from pending products, or omit it here and let the normal change batch handle product changes.
Useful? React with 👍 / 👎.
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub metadata: Option<Vec<DependencyMetadata>>, |
There was a problem hiding this comment.
Keep dependency metadata out of the store identity
Because Store<Dependency> deduplicates by the derived Hash/Eq, including the new metadata field in that identity makes the same package/version a second stored dependency when SCA metadata is attached after the initial dependency report. On the next extended heartbeat, unflush_stored() will re-send both the stale entry and the updated metadata entry for the same dependency; track identity by the stable dependency key and update metadata in place instead.
Useful? React with 👍 / 👎.
And some smaller stuff like more metric namespaces.
This bridges the gap to the current capabilities exposed by dd-trace-py.