Allow creating async instruments with either a callback function or generator#5
Merged
ocelotl merged 4 commits intoocelotl:issue_1835from Sep 24, 2021
Merged
Conversation
3998b9c to
657a071
Compare
Owner
|
Overall looks good, just please add test cases to ensure that the functionality is equivalent when a generator is used as a callback or when a function is ✌️ |
82d2f11 to
f14aa76
Compare
aabmass
commented
Sep 23, 2021
| with self.assertLogs(level=ERROR): | ||
| list(observable_counter.callback()) | ||
|
|
||
| def test_observable_counter_callback(self): |
Author
There was a problem hiding this comment.
@ocelotl this test case shows the callback form working
| return self.value == o.value and self.attributes == o.attributes | ||
|
|
||
|
|
||
| class TestCpuTimeIntegration(TestCase): |
Author
There was a problem hiding this comment.
This test is basically the example code I put in the docstring above. Also shows the function callback form working
ca4b408 to
87d46bd
Compare
Owner
|
@aabmass, please resolve conflicts so that we can merge this in the metrics API PR ✌️ |
0bc01e7 to
9ac4650
Compare
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.
See the docstring I added to
Meter.create_observable_counter()for usage. This gives examples of collecting CPU time from/proc/stat