- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15
feat: [Trace Stats] Use the concentrator in libdatadog #887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            16 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      4acefba
              
                Use the stats concentrator in libdatadog
              
              
                lym953 f4a3b66
              
                Delete stats_concentrator.rs
              
              
                lym953 2760507
              
                Make StatsConcentratorService store tracer metadata
              
              
                lym953 43469ff
              
                Pass in config and tags_provider again
              
              
                lym953 0ed5ccb
              
                fmt
              
              
                lym953 43bc5d5
              
                Make concentrator service return None if no stats
              
              
                lym953 ed44d75
              
                Upgrade libdatadog
              
              
                lym953 08c08a7
              
                Organize code
              
              
                lym953 e7bc0da
              
                Fix tests
              
              
                lym953 9123cd1
              
                Update license
              
              
                lym953 1998ba8
              
                Update stats aggregator test
              
              
                lym953 c4b7fb3
              
                Merge branch 'main' into yiming.luo/trace-stats-14
              
              
                lym953 8a483c5
              
                Merge branch 'main' into yiming.luo/trace-stats-14
              
              
                lym953 dd44d9b
              
                Fix package name
              
              
                lym953 5396cbb
              
                Update LICENSE-3rdparty.csv
              
              
                lym953 50bd2c2
              
                Add comment for box
              
              
                lym953 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
      
      Oops, something went wrong.
      
    
  
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -3,6 +3,7 @@ addr2line,https://github.com/gimli-rs/addr2line,Apache-2.0 OR MIT,The addr2line | |
| adler2,https://github.com/oyvindln/adler2,0BSD OR MIT OR Apache-2.0,"Jonas Schievink <[email protected]>, oyvindln <[email protected]>" | ||
| ahash,https://github.com/tkaitchuck/ahash,MIT OR Apache-2.0,Tom Kaitchuck <[email protected]> | ||
| aho-corasick,https://github.com/BurntSushi/aho-corasick,Unlicense OR MIT,Andrew Gallant <[email protected]> | ||
| allocator-api2,https://github.com/zakarumych/allocator-api2,MIT OR Apache-2.0,Zakarum <[email protected]> | ||
| anyhow,https://github.com/dtolnay/anyhow,MIT OR Apache-2.0,David Tolnay <[email protected]> | ||
| async-trait,https://github.com/dtolnay/async-trait,MIT OR Apache-2.0,David Tolnay <[email protected]> | ||
| atomic,https://github.com/Amanieu/atomic-rs,Apache-2.0 OR MIT,Amanieu d'Antras <[email protected]> | ||
|  | @@ -31,11 +32,13 @@ core-foundation-sys,https://github.com/servo/core-foundation-rs,MIT OR Apache-2. | |
| cpufeatures,https://github.com/RustCrypto/utils,MIT OR Apache-2.0,RustCrypto Developers | ||
| crc32fast,https://github.com/srijs/rust-crc32fast,MIT OR Apache-2.0,"Sam Rijs <[email protected]>, Alex Crichton <[email protected]>" | ||
| crypto-common,https://github.com/RustCrypto/traits,MIT OR Apache-2.0,RustCrypto Developers | ||
| datadog-ddsketch,https://github.com/DataDog/libdatadog,Apache-2.0,The datadog-ddsketch Authors | ||
| datadog-fips,https://github.com/DataDog/serverless-components,Apache-2.0,The datadog-fips Authors | ||
| datadog-protos,https://github.com/DataDog/saluki,Apache-2.0,The datadog-protos Authors | ||
| datadog-trace-normalization,https://github.com/DataDog/libdatadog,Apache-2.0,David Lee <[email protected]> | ||
| datadog-trace-obfuscation,https://github.com/DataDog/libdatadog,Apache-2.0,David Lee <[email protected]> | ||
| datadog-trace-protobuf,https://github.com/DataDog/libdatadog,Apache-2.0,David Lee <[email protected]> | ||
| datadog-trace-stats,https://github.com/DataDog/libdatadog,Apache-2.0,The datadog-trace-stats Authors | ||
| datadog-trace-utils,https://github.com/DataDog/libdatadog,Apache-2.0,The datadog-trace-utils Authors | ||
| ddcommon,https://github.com/DataDog/libdatadog,Apache-2.0,The ddcommon Authors | ||
| ddsketch-agent,https://github.com/DataDog/saluki,Apache-2.0,The ddsketch-agent Authors | ||
|  | @@ -53,6 +56,7 @@ figment,https://github.com/SergioBenitez/Figment,MIT OR Apache-2.0,Sergio Benite | |
| flate2,https://github.com/rust-lang/flate2-rs,MIT OR Apache-2.0,"Alex Crichton <[email protected]>, Josh Triplett <[email protected]>" | ||
| float-cmp,https://github.com/mikedilger/float-cmp,MIT,Mike Dilger <[email protected]> | ||
| fnv,https://github.com/servo/rust-fnv,Apache-2.0 OR MIT,Alex Crichton <[email protected]> | ||
| foldhash,https://github.com/orlp/foldhash,Zlib,Orson Peters <[email protected]> | ||
| form_urlencoded,https://github.com/servo/rust-url,MIT OR Apache-2.0,The rust-url developers | ||
| futures,https://github.com/rust-lang/futures-rs,MIT OR Apache-2.0,The futures Authors | ||
| futures-channel,https://github.com/rust-lang/futures-rs,MIT OR Apache-2.0,The futures-channel Authors | ||
|  | ||
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -55,7 +55,9 @@ impl StatsAggregator { | |
| // Pull stats data from concentrator | ||
| match self.concentrator.flush(force_flush).await { | ||
| Ok(stats) => { | ||
| self.queue.extend(stats); | ||
| if let Some(stats) = stats { | ||
| self.queue.push_back(stats); | ||
| } | ||
| } | ||
| Err(e) => { | ||
| error!("Error getting stats from the stats concentrator: {e:?}"); | ||
|  | @@ -121,6 +123,8 @@ mod tests { | |
| tags: vec![], | ||
| git_commit_sha: "git_commit_sha".to_string(), | ||
| image_tag: "image_tag".to_string(), | ||
| process_tags: "process_tags".to_string(), | ||
| process_tags_hash: 0, | ||
| }; | ||
|  | ||
| aggregator.add(payload.clone()); | ||
|  | @@ -153,6 +157,8 @@ mod tests { | |
| tags: vec![], | ||
| git_commit_sha: "git_commit_sha".to_string(), | ||
| image_tag: "image_tag".to_string(), | ||
| process_tags: "process_tags".to_string(), | ||
| process_tags_hash: 0, | ||
| }; | ||
| aggregator.add(payload.clone()); | ||
| assert_eq!(aggregator.queue.len(), 1); | ||
|  | @@ -169,8 +175,8 @@ mod tests { | |
| &HashMap::new(), | ||
| )); | ||
| let (_, concentrator) = StatsConcentratorService::new(config, tags_provider); | ||
| let mut aggregator = StatsAggregator::new(640, concentrator); | ||
| // Payload below is 115 bytes | ||
| let mut aggregator = StatsAggregator::new(704, concentrator); | ||
| // Payload below is 352 bytes | ||
| let payload = ClientStatsPayload { | ||
| hostname: "hostname".to_string(), | ||
| env: "dev".to_string(), | ||
|  | @@ -186,6 +192,8 @@ mod tests { | |
| tags: vec![], | ||
| git_commit_sha: "git_commit_sha".to_string(), | ||
| image_tag: "image_tag".to_string(), | ||
| process_tags: "process_tags".to_string(), | ||
| process_tags_hash: 0, | ||
| 
      Comment on lines
    
      +195
     to 
      +196
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New fields resulted from upgrading libdatadog | ||
| }; | ||
|  | ||
| // Add 3 payloads | ||
|  | ||
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New field resulted from upgrading libdatadog