feat: [Trace Stats] Add skeleton of concentrator#842
Merged
Conversation
265fcd7 to
7226500
Compare
Contributor
Author
|
Will see if we can reuse https://github.com/DataDog/libdatadog/tree/main/data-pipeline/src/span_concentrator |
duncanista
reviewed
Sep 19, 2025
Comment on lines
+10
to
+26
| #[derive(Debug)] | ||
| pub enum StatsError { | ||
| SendError(mpsc::error::SendError<ConcentratorCommand>), | ||
| RecvError(oneshot::error::RecvError), | ||
| } | ||
|
|
||
| impl From<mpsc::error::SendError<ConcentratorCommand>> for StatsError { | ||
| fn from(err: mpsc::error::SendError<ConcentratorCommand>) -> Self { | ||
| StatsError::SendError(err) | ||
| } | ||
| } | ||
|
|
||
| impl From<oneshot::error::RecvError> for StatsError { | ||
| fn from(err: oneshot::error::RecvError) -> Self { | ||
| StatsError::RecvError(err) | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
You could probably use thiserror to avoid the boilerplate
duncanista
reviewed
Sep 19, 2025
Contributor
There was a problem hiding this comment.
Wondering if we should have a submodule called stats for all of this stuff, instead of having it as stats_...
Contributor
Author
There was a problem hiding this comment.
I might do it in a separate PR
duncanista
approved these changes
Sep 19, 2025
3c1fe3e to
46efff5
Compare
lym953
added a commit
that referenced
this pull request
Sep 22, 2025
## This PR 1. Move stats generation after trace obfuscation, which is the correct order as suggested by Trace Agent team. Right now stats generation is before trace obfuscation. 2. Also generate trace stats for OTLP agent. Right now we only do it for trace agent. ## Architecture Copied from #842 <img width="1296" height="674" alt="image" src="https://github.com/user-attachments/assets/2d4cb925-6cfc-4581-8ed6-6bd87cf0d87a" /> ## Testing Tested in the next PR #856, which implements stats concentrator. Trace stats appeared in Datadog. <img width="538" height="317" alt="image" src="https://github.com/user-attachments/assets/48b849cc-2413-41d5-8576-5ff657c21a0f" /> ## Next steps 1. Implement `StatsConcentrator` 2. Rename for clarity: - `SendingTraceStatsProcessor` -> `TraceStatsGenerator` - `stats_sender` -> `stats_generator` 3. Small refactor: consider passing around `stats_sender` instead of `stats_concentrator_handle`. Right now `SendingTraceStatsProcessor::new()` is called in three places. It might be possible to call it only once then pass it around. ## Notes Jira: https://datadoghq.atlassian.net/browse/SVLS-7593
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR
StatsConcentrator, with no implementationStatsConcentratorHandleandStatsConcentratorService, which send and process stats requests (add()andget_stats()) to/from a queue, so mutex is not needed, and lock contention can be avoided. (Thanks @duncanista for the suggestion and @astuyve for the example code Remove locks for aggregation and flushing, move to channels serverless-components#32)Next steps
StatsConcentrator, which aggregates stats data into buckets and returns it in batchAggregationKeyandStatsI'll mainly move code from this draft PR: #827
Architecture
Jira: https://datadoghq.atlassian.net/browse/SVLS-7593