Skip to content

docs(logger): improve mkdocs and examples of sample rate feature #389

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

Merged
merged 1 commit into from
Jan 4, 2022

Conversation

saragerion
Copy link
Contributor

@saragerion saragerion commented Jan 3, 2022

Description of your changes

The current version of the docs related to sample rate might be confusing and misleading, as they don't clarify the expected behaviour enough.

This PR includes some updates to mkdocs and examples of sample rate feature to clarify the feature and its behaviour.

How to verify this change

You can build and start a local docs website by running these two commands.

npm run docs-buildDockerImage OR docker build -t squidfunk/mkdocs-material ./docs/
npm run docs-runLocalDocker OR docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material

Verify: http://0.0.0.0:8000/core/logger/#sampling-logs

Screenshot 2022-01-03 at 19 29 55
Screenshot 2022-01-03 at 19 30 04
Screenshot 2022-01-03 at 19 30 26

Related issues, RFCs

#388

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published in downstream module
  • The PR title follows the conventional commit semantics

Breaking change checklist

N/A


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@saragerion saragerion added documentation Improvements or additions to documentation logger This item relates to the Logger Utility labels Jan 3, 2022
@saragerion saragerion added this to the beta-release milestone Jan 3, 2022
@saragerion saragerion self-assigned this Jan 3, 2022
@saragerion saragerion linked an issue Jan 3, 2022 that may be closed by this pull request
Copy link
Contributor

@ijemmy ijemmy left a comment

Choose a reason for hiding this comment

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

This is very clear now. Thanks!

// of being printed in a Lambda invocation
logger.debug("This is a DEBUG log that has 50% chance of being printed");
logger.info("This is an INFO log that has 50% chance of being printed");
logger.warn("This is a WARN log that has 50% chance of being printed");

// Optional: refresh sample rate calculation on runtime
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for my benefit, not trying to be annoying but only to understand myself.

Would this command reset the sample rate count, meaning that from here below all logs would have the original chance (set by sampleRateValue)? What's an example in which I'd use this?

Copy link
Contributor Author

@saragerion saragerion Jan 4, 2022

Choose a reason for hiding this comment

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

meaning that from here below all logs would have the original chance (set by sampleRateValue)?

Almost! Not "from here below", but for all logs produced by that logger instance

What's an example in which I'd use this?

If I remember correctly this was a feature request by the community for the python tool, I need to find the conversation

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Just left a minor comment/question, but already good to go for me!

@saragerion saragerion merged commit a8594b9 into main Jan 4, 2022
@saragerion saragerion deleted the docs/logger-sample-rate branch January 4, 2022 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation logger This item relates to the Logger Utility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: improve docs and examples of sample rate feature for Logger
3 participants