Skip to content
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

Merged
merged 10 commits into from
Dec 29, 2022
Merged

Update Sphinx docs #97

merged 10 commits into from
Dec 29, 2022

Conversation

Darwinkel
Copy link
Contributor

@Darwinkel Darwinkel commented Dec 16, 2022

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

image

Checklist for author(s):

  • This PR comes from a feature or hotfix branch, in line with our git branching strategy;
  • This PR is "bite-sized" and only focuses on a single issue, problem, or feature;
  • I am not reinventing the wheel: there is no high-quality library that already has this feature;
  • I have changed the example .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;
  • I have performed a self-review of my own code;
  • I have commented my code, particularly in hard-to-understand areas;
  • I have made corresponding changes to the documentation, if necessary;
  • I have written unit, integration, and end-to-end tests for the change that I made;

If a non-trivial PR:

  • This PR is part of a milestone and has appropriate labels;
  • This PR is properly linked to the project board (either directly or via an issue);
  • I have added screenshots or some other proof that my code does what it is supposed to do;
## Checklist for functional reviewer(s):
- [ ] If a non-trivial PR: This PR is properly linked to an issue on the project board;
- [ ] I have checked out this branch, and successfully ran `make kat`;
- [ ] I have ran `make test-rf` and all end-to-end Robot Framework tests pass;
- [ ] I confirmed that the PR's advertised `feature` or `hotfix` works as intended;
- [ ] I confirmed that there are no unintended functional regressions in this branch;

### What works:
* _bullet point + screenshot (if useful) per tested functionality_

### What doesn't work:
* _bullet point + screenshot (if useful) per tested functionality_

### Bug or feature?:
* _bullet point + screenshot (if useful) if it is unclear whether something is a bug or an intended feature._
## Checklist for code reviewer(s):
- [ ] The code passes the CI tests and linters;
- [ ] The code does not bypass authentication or security mechanisms;
- [ ] The code does not introduce any dependency on a library that has not been properly vetted;
- [ ] The code does not violate Model-View-Template and our other architectural principles;
- [ ] The code contains docstrings, comments, and documentation where needed;
- [ ] The code prioritizes readability over performance where appropriate;
- [ ] The code conforms to our agreed coding standards.

@Darwinkel Darwinkel self-assigned this Dec 16, 2022
ammar92
ammar92 previously approved these changes Dec 21, 2022
@Darwinkel Darwinkel marked this pull request as ready for review December 22, 2022 12:22
@Darwinkel Darwinkel requested a review from a team as a code owner December 22, 2022 12:22
underdarknl
underdarknl previously approved these changes Dec 22, 2022
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.

Copy link
Contributor

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.

Copy link
Contributor

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

- 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:
Copy link
Contributor

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.

Copy link
Contributor

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.

information. So no email addresses, names, credit card numbers, etc.

- Always log in UTC, log in milliseconds. Synchronize your servers with a NTP
daemon.
Copy link
Contributor

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.

Copy link
Contributor

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


..
- TODO: request guid, see if this is already done by log aggregation of them
used cloud provider.
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes remove this

went wrong. These severities need attention and fixing.

* ``INFO`` is for business, ``DEBUG`` is for technology. The ``INFO`` log should look
like a book.
Copy link
Contributor

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.

Copy link
Contributor

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


# Do this
some_stuff()
log.info("Did stuff with %s [url=%s]", url, url)
Copy link
Contributor

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.

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.
Copy link
Contributor

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 Show resolved Hide resolved
---

_Please add `bug` and one or more of the following labels to your issue:_
`frontend backend community dependencies`
Copy link
Contributor

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.


- `<https://tuhrig.de/my-logging-best-practices/>`_
- `<https://web.archive.org/web/20201023044233/>`_
- `<https://nerds.kueski.com/better-logging/>`_
Copy link
Contributor

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

@Darwinkel Darwinkel dismissed stale reviews from underdarknl and ammar92 via f09d45a December 29, 2022 12:27
@Darwinkel
Copy link
Contributor Author

Per JP's request, I've removed the logging document and moved the discussion here: #100

@dekkers is the revised bug report adequate?

@dekkers dekkers changed the title Update Sphinx docs with logging guidelines Update Sphinx docs Dec 29, 2022
@dekkers dekkers merged commit 0752827 into main Dec 29, 2022
@dekkers dekkers deleted the feature/updated-docs branch December 29, 2022 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants