-
Notifications
You must be signed in to change notification settings - Fork 60
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
Update Sphinx docs #97
Conversation
docs/source/guidelines/logging.rst
Outdated
Some general guidelines for how to log within your applications: | ||
|
||
- Log after, not before. This communicates what operation was performed, and what the result was. | ||
|
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 don't agree that logging should not be done before. Not logging information before an action means you miss crucial information when things go wrong and an exception is thrown because you haven't logged anything. Also if something takes a long time / hangs it's harder to figure out what it is.
I had a lot of trouble with debugging keiko when subprocess.run caused an exception. We had no idea what exactly keiko was executing, because that was only logged after and was thus never logged. So the time we actually needed the log information it wasn't there.
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'm ok with supplementing/updating this
docs/source/guidelines/logging.rst
Outdated
- Separate parameters and messages. | ||
This will make sure that logs are parseable, searchable, easy to extend, and read. | ||
A python package called `structlog <https://www.structlog.org/>`_ can help with this. | ||
This is one example on how to separate parameters and messages, you can also decide to for instance use a json output: |
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.
Either we make the decision to use structlog, make the changes to use it everywhere and ask all our contributores to use it, or we don't. Telling that there is a tool that might be useful is not something that is useful to put in contribution guidelines.
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.
Since the piece wasn't written with KAT in mind, we should remove this and decide what kind of output we want.
docs/source/guidelines/logging.rst
Outdated
information. So no email addresses, names, credit card numbers, etc. | ||
|
||
- Always log in UTC, log in milliseconds. Synchronize your servers with a NTP | ||
daemon. |
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 also not really useful for our contributor guidelines.
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'm ok with removing this
docs/source/guidelines/logging.rst
Outdated
|
||
.. | ||
- TODO: request guid, see if this is already done by log aggregation of them | ||
used cloud provider. |
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 also doesn't really make much sense in the context of KAT.
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 remove this
docs/source/guidelines/logging.rst
Outdated
went wrong. These severities need attention and fixing. | ||
|
||
* ``INFO`` is for business, ``DEBUG`` is for technology. The ``INFO`` log should look | ||
like a book. |
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 don't agree with this. They are levels, not a categorisation. DEBUG is less important information than INFO, there might still be "technology" stuff that is important enough to log at INFO level.
I think the Python definition of the levels make a lot more sense: https://docs.python.org/3/howto/logging.html
And I think it's also important as an Open Source project that has lots of different users to not just redefine what these log levels mean.
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'm, ok with redefining this using the python log levels
docs/source/guidelines/logging.rst
Outdated
|
||
# Do this | ||
some_stuff() | ||
log.info("Did stuff with %s [url=%s]", url, url) |
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 should be "Did stuff [url=%s]", logging the url twice isn't really useful.
Another thing that might be useful to add is to use the formatting of logger such as is done here and not f-strings, especially for debug logging. The reason is that if the log level is disabled logger won't construct the string, but a f-string as argument will always need to be constructed.
.github/ISSUE_TEMPLATE/bug_report.md
Outdated
If applicable, add screenshots to help explain your problem. | ||
|
||
**OpenKAT version** | ||
Should contain at least the commit or release of Rocky. If you think another module may be the cause of the bug, note that module's commit or release here as well. |
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 we can just assume that someone is running the same version of every component because we don't support using older and newer versions together.
.github/ISSUE_TEMPLATE/bug_report.md
Outdated
--- | ||
|
||
_Please add `bug` and one or more of the following labels to your issue:_ | ||
`frontend backend community dependencies` |
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.
What does community / dependencies label mean? Also frontend/backend doesn't always have the same meaning so I don't think they are good tags (some people see browser als frontend and server as backend, others see a UI service like rocky as frontend and the rest of the services as backend). We shouldn't ask people to tag things if we don't explain what the tags mean.
docs/source/guidelines/logging.rst
Outdated
|
||
- `<https://tuhrig.de/my-logging-best-practices/>`_ | ||
- `<https://web.archive.org/web/20201023044233/>`_ | ||
- `<https://nerds.kueski.com/better-logging/>`_ |
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.
These two links are broken
Changes
This PR makes some minor tweaks to the documentation, adds GitHub templates, and adds some logging guidelines to the documentation.
Issue ticket number and link
Linked.
Proof
Checklist for author(s):
feature
orhotfix
branch, in line with our git branching strategy;.env
files if I added, removed, or changed any config options, and I have informed others that they need to modify their.env
files if required;If a non-trivial PR: