Skip to content

Enhancement Suggestion - Log Sampling #6

Closed

Description

@danilohgds

Hi there,

Before anything, great work with the Library so far. I am wondering if log sampling capability is something you guys are thinking for this repo and if so what would it take to get it implemented?

I am willing to help with the coding of this feature if I could get some pointers on where to start.

Activity

  1. heitorlessa commented on Feb 13, 2020

    @heitorlessa
    Contributor

    Hey @danilohgds - Yes, we want to add that, and I have some questions for you.

    When you say "sampling", do you mean enabling DEBUG log level for a % of invocations?

    If so, the best place to add that at the moment is in the logger_inject_lambda_context decorator. What this does is to structure logs using Lambda context object, including cold start.

    A similar implementation of sampling can be found in the DAZN Powertools lib - They receive a double to define the percentage of debug logging that should be sampled,. In our case, that decorator above could have a parameter, and env var to control when to set log level to DEBUG.

    Both implementations have one caveat that should be well understood - It samples DEBUG logs on a per function execution context basis - That is, concurrent functions are executed in isolated containers and therefore may differ in behaviour (e.g. one execution may log debug and another not).

    I'm finishing a related project by end of March and then will come back to this with full attention, so yes, any help is deeply appreciated

    <3

  2. danilohgds commented on Feb 13, 2020

    @danilohgds
    ContributorAuthor

    @heitorlessa my intent is to have the exact same capability from DAZN Nodejs lib.

    I am not an expert in python by any means, I had the feeling the decorators would be the way to go but I wanted to get your thoughts too.

    I will fork the project and then see how things go 💪

  3. heitorlessa commented on Feb 13, 2020

    @heitorlessa
    Contributor
  4. heitorlessa commented on Feb 24, 2020

    @heitorlessa
    Contributor

    Resolving as it's merged now ;) Thanks again Danilo!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions