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

scheduler: contextual logging - WithName and WithValue #111155

Commits on Feb 16, 2023

  1. scheduler: support contextual logging

    This replaces all log calls through the global klog logger with a logger that
    gets passed in by the caller, either through an explicit parameter or the
    context. This makes it possible to produce more informative log output by
    adding WithName and/or WithValues instrumentation (not done yet!). It also
    makes "go test" failures more useful because the log output gets associated
    with the test which produced it.
    
    Usually, context is the more future-proof option. It has happened repeatedly
    throughout the life of this commit that a function that originally had no
    context later got changed in the master branch to accept for reasons unrelated
    to contextual logging. In several places, passing a context can replace passing
    a stop channel and then serves two purposes (access to logger and cancellation).
    
    But klog.FromContext has some overhead, so for simple functions a logger is
    passed.
    pohly authored and knelasevero committed Feb 16, 2023
    Configuration menu
    Copy the full SHA
    3d64f4f View commit details
    Browse the repository at this point in the history
  2. scheduler_perf: support JSON

    This enables benchmarking with JSON selected as output.
    pohly authored and knelasevero committed Feb 16, 2023
    Configuration menu
    Copy the full SHA
    f3fb344 View commit details
    Browse the repository at this point in the history
  3. scheduler: use WithName and WithValues

    This adds a prefix to each log entry that shows which operation and/or
    component produced the log entry (WithName) and ensures that relevant
    additional values, in particular the pod that gets scheduled, are always
    included (WithValues).
    
    This makes log entries easier to understand, in particular when multiple pods
    get scheduled in parallel.
    
    The downside is the constant overhead for these additional calls: they need to
    do some work, whether log entries will be printed or not.
    pohly authored and knelasevero committed Feb 16, 2023
    Configuration menu
    Copy the full SHA
    da3ebdb View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    66014b2 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    c553787 View commit details
    Browse the repository at this point in the history
  6. logcheck and fmt

    knelasevero committed Feb 16, 2023
    Configuration menu
    Copy the full SHA
    f68989a View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5820e79 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    591592b View commit details
    Browse the repository at this point in the history