-
Notifications
You must be signed in to change notification settings - Fork 520
Attempt to write metric tests with inmemoryexp #1382
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
Attempt to write metric tests with inmemoryexp #1382
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1382 +/- ##
=======================================
+ Coverage 55.6% 57.1% +1.4%
=======================================
Files 145 146 +1
Lines 18022 18099 +77
=======================================
+ Hits 10037 10350 +313
+ Misses 7985 7749 -236 ☔ View full report in Codecov by Sentry. |
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.
Looks like a winner to me 🤘 one step closer to stability.
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.
Good first step 👍 we can try table-driven unit tests when adding more test cases
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.
LGTM. Nicely done :)
|
||
counter.add(1, &[KeyValue::new("key1", "value2")]); | ||
counter.add(1, &[KeyValue::new("key1", "value2")]); | ||
counter.add(1, &[KeyValue::new("key1", "value2")]); |
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.
nit - attributes can be defined once, and reused - something like (not tested):
let key_value1 = KeyValue::new("key1", "value1");
let key_value2 = KeyValue::new("key1", "value2");
for _ in 0..5 {
counter.add(1, &[key_value1]); // or &[key_value1.clone()] if metrics SDK takes ownership
for _ in 0..3 {
counter.add(1, &[key_value2]);
}
This is far from ideal, but merging as is, give this works, and can be used to quickly validate that aggregations/merges are done correctly, especially when working on PRs like #1379 Expecting to improve such tests in follow ups. Thanks everyone for helping review! |
Attempting to write Metrics test to ensure SDK is doing the aggregation as expected.
This is full of "hacks" to unblock.! Need to spend some time to understand the inner workings to fix this - If anyone can help, really appreciate it!Thanks @TommyCpp who suggested the fix for flush being stuck!Such tests are very critical to make sure the aggregation is correct, especially considering we are considering big changes like the ones in this PR - #1379