Stats core changes#256
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
|
Please fix the CLA. A quick fix would be to squash all the commits into one: (assume upstream is https://github.com/census-instrumentation/opencensus-python.git, and origin is your personal repo) $ git fetch upstream
$ git rebase -i upstream/master
$ # In the rebase UI, pick the top one commit and mark all others as "squash" or "s". Save and exit.
$ # Resolve any potential merge conflicts.
$ # Should see: Successfully rebased and updated refs/heads/master.
$ git push -f origin |
Removing stats exporter stuff Removing unused imports Minor changes in comments and copyright Unit tests for LastValue aggregation
03462db to
f839e21
Compare
|
CLAs look good, thanks! |
|
@songy23 I think that everything is fine right now. |
| def _get_items(self): | ||
| """Get multiple items from a Queue. | ||
|
|
||
| Gets at least one (blocking) and at most ``max_items`` items |
There was a problem hiding this comment.
max_items isn't defined anywhere. Did we perhaps mean to use max_batch_size?
There was a problem hiding this comment.
Yes, it was a mistake inside the comment. I'll fix that, thanks !
| Pulls pending data off the queue and writes them in | ||
| batches to the specified tracing backend using the exporter. | ||
| """ | ||
| print('Background thread started.') |
There was a problem hiding this comment.
Perhaps this was a legacy print but it pollutes user programs, please remove it or perhaps make it a log that can be turned on
| if quit_: | ||
| break | ||
|
|
||
| print('Background thread exited.') |
There was a problem hiding this comment.
Ditto about prints polluting user code from the library.
| thread some time to finish processing before this function returns. | ||
|
|
||
| :type grace_period: float | ||
| :param grace_period: If specified, this method will block up to this |
There was a problem hiding this comment.
grace_period is mentioned as a param but I don't see it in the function signature.
There was a problem hiding this comment.
Right now we are reading its value inside the constructor, so of course do not make sense this piece of comment. I'll remove it, thanks !
| self._queue.put_nowait(datas) | ||
|
|
||
| def flush(self): | ||
| """Submit any pending datas.""" |
There was a problem hiding this comment.
s/datas/data/g, data is the plural form of datum as per https://www.merriam-webster.com/dictionary/data :)
opencensus/stats/aggregation.py
Outdated
| SUM (int): The aggreation type of the view is 'sum'. | ||
| COUNT (int): The aggreation type of the view is 'count'. | ||
| DISTRIBUTION (int): The aggreation type of the view is 'distribution'. | ||
| LASTVALUE (int): The aggreation type of the view is 'lastvalue'. |
There was a problem hiding this comment.
Minor nit: s/aggreation/aggregation/g
odeke-em
left a comment
There was a problem hiding this comment.
Nice, thanks @MarceloAquino7! I'll wait for @liyanhui1228 to take a look too and I'll also give the entire PR a full read a few more times. Thanks for incorporating the changes for the transport into opencensus.common.transports.*
opencensus/stats/aggregation.py
Outdated
| """ | ||
| The current recorded value | ||
| """ | ||
| return self._value No newline at end of file |
There was a problem hiding this comment.
Need an extra blank line at the end of file.
opencensus/stats/aggregation_data.py
Outdated
| """ | ||
| The current value recorded | ||
| """ | ||
| return self._value No newline at end of file |
There was a problem hiding this comment.
Need extra blank line.
|
|
||
|
|
||
| class _Worker(object): | ||
| """A background thread that exports batches of data. |
There was a problem hiding this comment.
The indentation of this file is different than other files in this repo, shall we change to use 4 spaces indentation to match with the repo?
opencensus/common/transports/base.py
Outdated
|
|
||
| For blocking/sync transports, this is a no-op. | ||
| """ | ||
|
|
There was a problem hiding this comment.
Remove extra blank line.
There was a problem hiding this comment.
Thanks for your reply @liyanhui1228 , I will work on these items. About the test coverage, do you guys use 4 spaces for indentation ?
There was a problem hiding this comment.
Yes we use 4 spaces indentation.
|
@liyanhui1228 they've updated the code with our requests, PTAL again :) @MarceloAquino7 please rebase from master, as Github currently reports some conflicts with master. |
|
This LGTM, will approve once the CI is green. |
|
@liyanhui1228 oh cool, I've updated the branch and now CI is running, please check back in say 10 minutes for when CI returns. |
|
@liyanhui1228 for some reason CircleCI tripped claiming that the coverage for some test failed nox > Command coverage report --show-missing --fail-under=100 failed with exit code 2 |
|
Yes we should add more test to fix that test coverage. |
| 'spans': [{}, {}], | ||
| } | ||
| transport.export(data) | ||
| self.assertTrue(True) |
This PR contains all changes inside stats core in order to support exporters and the new transport class.