-
Notifications
You must be signed in to change notification settings - Fork 25
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
MNT: Create loggers.py and add Elasticsearch handler #49
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #49 +/- ##
=========================================
- Coverage 42.46% 42.37% -0.1%
=========================================
Files 10 11 +1
Lines 584 616 +32
=========================================
+ Hits 248 261 +13
- Misses 336 355 +19
Continue to review full report at Codecov.
|
To test, we need access to a beamline machine (so it can see
Then in IPython: import nslsii.loggers
from bluesky import RunEngine
RE = RunEngine({})
RE([]) # generates log messages that should go to Elasticsearch Notice that I have not used Next steps:
|
Also, we wondered during our Slack call about the difference between I learned that from this documentation page: https://www.elastic.co/guide/en/elasticsearch/guide/current/index-doc.html It suggest that you should use PUT if and only if there is a "natural" obvious unique ID. Otherwise, you use POST and let Elastic generate an internal unique ID for you. For these log messages*, I think there is no natural unique ID, so we should use POST. Do you agree? *There is one possible exception to this statement. The log messages from bluesky that say, "A Document has been emitted with uid=..." could use the document's uid as part of the unique ID for the log message. I am not sure that's the right thing to do here...maybe something to come back to later. |
c7bfb57
to
87ad29b
Compare
nslsii/loggers.py
Outdated
def __init__(self, url, level=logging.INFO): | ||
self.url = url | ||
self.level = level | ||
self.response = None |
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.
This is superfluous now.
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.
I think url and level are still useful, right?
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.
Yes.
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.
I'd rather separate the style/pep8 checking and the loggers feature, so that the irrelevant files are not touched. But since there are only a few of them, they can be kept. Please notice a critical problem 1000**3
-> 1000 * 3
, which should be fixed. See my comment below.
55b83ff
to
4b10252
Compare
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.
caproto/_headers.py,caproto/tests/test_pyepics_compat.py,caproto/_version.py
are not relevant. Please remove them.
[flake8] | ||
ignore = E402,W504 | ||
exclude = .git,__pycache__,doc/source/conf.py,build,dist,versioneer.py,caproto/_headers.py,caproto/tests/test_pyepics_compat.py,caproto/_version.py | ||
max-line-length = 115 |
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.
My concern here is that the line length here is 115, but in .travis.yml it's set to 79 via command-line arg (which most likely has a priority). I think we should have a single source of truth here, so that only one configuration is controlling the settings in both development environments and in the CI systems.
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.
I wonder why it was set to 79
in .travis.yml
since that is the default anyway. @ke-zhang-rd, I think the right path here is to remove --max-line-length=79
from this line as part of this PR.
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.
I agree with the plan.
The handler itself looks done to me. Next steps:
|
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.
This looks good for now. Let's let it sit (i.e. do not merge) until the caproto PR is merged, in case details change, such as the attributes on record
.
@jklynch, can it be useful and complimentary to your recent work in #80? |
We decided this is out of scope for #80. I do not want to do any further logging development until we have had time to evaluate the new state of logging on the floor. |
OK, I see. |
Create loggers for carproto, bluesky and ophyd to Elasticsearch