-
Notifications
You must be signed in to change notification settings - Fork 6
docs: Add basic logging documentation #926
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #926 +/- ##
=======================================
Coverage 94.47% 94.47%
=======================================
Files 41 41
Lines 2551 2551
=======================================
Hits 2410 2410
Misses 141 141 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Minor comments. Some additional questions:
- So this isn't enabled by default? Why not just make a
bluesky
stream in graylog and log into that by default? I see no reason anyone would not want it on? - If we do just enable it as default I think the info about
fluentd
is too much detail. Instead you just need to say where it's going by default and how to change it if you need to - A link to our graylog instance would be good, even better if it's directly to the default stream
- What fields are added by default? Can the user change fields if they want to? This is probably a more "Advanced" feature
If it's enabled by default you would log to the Graylog instance by just checking out / spinning up the repo while on a Diamond computer. Would a better compromise be having Graylog enabled by default, but to The rest I agree with and will implement before requesting another review |
Hmm... Does |
I don't think there's any plans for that- development can mean so many things and a single setting can't encapsulate them all: What does dev mean in terms of behaviour?
All of these are things you sometimes need to do while developing blueapi, and half of them are things you might need to do while developing plans. I think the config should just expose as much as is reasonable, and provide convenient defaults that work without any external infrastructure, both when starting the service locally/in a container and when installing the Helm chart to a fresh cluster. |
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.
Looks good, a few suggestions
Co-authored-by: Callum Forrester <[email protected]>
Co-authored-by: Callum Forrester <[email protected]>
Co-authored-by: Callum Forrester <[email protected]>
Co-authored-by: Callum Forrester <[email protected]>
|
||
# BlueAPI Cofiguration | ||
|
||
:::{seealso} |
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.
Which version of markdown supports the :::{seealso}
tags?
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.
It's a sphinx directive.
This builds into BlueAPI's GitHub Pages entry.
Happy to park discussions of enabling by default in favour of getting documentation in.
Co-authored-by: Peter Holloway <[email protected]>
Co-authored-by: Peter Holloway <[email protected]>
Co-authored-by: Peter Holloway <[email protected]>
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.
Approving with potential rewording because if I had my way I would rewrite all of the docs myself and I don't want to do that
|
||
# Configure Logging | ||
|
||
By default BlueAPI will log to stdout at the [INFO level](https://docs.python.org/3/library/logging.html#logging-levels), but can be reconfigured to log at any level, and to output to Graylog. |
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.
By default BlueAPI will log to stdout at the [INFO level](https://docs.python.org/3/library/logging.html#logging-levels), but can be reconfigured to log at any level, and to output to Graylog. | |
By default BlueAPI will log to stdout at the [INFO level](https://docs.python.org/3/library/logging.html#logging-levels), but can be configured to log at any level, and to output simultaneously at the same level to [Graylog](https://graylog.org). |
|
||
When logging to [Graylog](https://graylog.org) is enabled, BlueAPI will also continue to log to stdout. | ||
|
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.
When logging to [Graylog](https://graylog.org) is enabled, BlueAPI will also continue to log to stdout. |
graylog: | ||
enabled: True | ||
host: "graylog-log-target.diamond.ac.uk" | ||
port: 12232 |
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.
port: 12232 | |
port: 12231 |
We should adjust the defaults to hit the right graylog too
To instrument to a custom module in BlueAPI, instantiate a logger from the [standard library logging package, then use any of its log methods](https://docs.python.org/3/library/logging.html#logger-objects). | ||
|
||
BlueAPI is configured to handle logging from any python code it executes. |
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.
To instrument to a custom module in BlueAPI, instantiate a logger from the [standard library logging package, then use any of its log methods](https://docs.python.org/3/library/logging.html#logger-objects). | |
BlueAPI is configured to handle logging from any python code it executes. | |
Logs from plans run by BlueAPI will use inherit the configured logging, simply instantiate a logger from the [standard library logging package, then use any of its log methods](https://docs.python.org/3/library/logging.html#logger-objects). |
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.
Does this mean plans are able to reconfigure the central logging system as well?
import logging | ||
logger = logging.getLogger(__name__) | ||
logger.info("FOO") |
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.
import logging | |
logger = logging.getLogger(__name__) | |
logger.info("FOO") | |
import logging | |
logger = logging.getLogger(__name__) | |
def my_plan() -> MsgGenerator: | |
logger.info("Running my_plan") | |
logger.debug("Loaded module with my_plan") |
Services hosted on the DLS clusters automatically have their stdout forwarded to Graylog via a service called fluentd. Due to this, BlueAPI services hosted on the cluster will always log to Graylog. | ||
|
||
When BlueAPI's native Graylog support is enabled it forwards structured data rather than plaintext. | ||
|
||
When BlueAPI's native Graylog is enabled fluentd will be automatically disabled to avoid log duplication. |
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.
Services hosted on the DLS clusters automatically have their stdout forwarded to Graylog via a service called fluentd. Due to this, BlueAPI services hosted on the cluster will always log to Graylog. | |
When BlueAPI's native Graylog support is enabled it forwards structured data rather than plaintext. | |
When BlueAPI's native Graylog is enabled fluentd will be automatically disabled to avoid log duplication. | |
Services hosted on the DLS clusters automatically have their stdout forwarded to Graylog via a service called fluentd. Therefore BlueAPI hosted on the cluster will always have logs available from Graylog, however BlueAPI's native Graylog forwards structured data rather than plaintext. | |
When native Graylog is enabled fluentd will be automatically disabled to avoid log duplication. |
No description provided.