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

Naive Tracing sketch #507

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Naive Tracing sketch #507

wants to merge 1 commit into from

Conversation

scothis
Copy link
Contributor

@scothis scothis commented Apr 4, 2024

Introduces a Tracer interface that can be provided to the Reconciler and Webhook handler implementations when they are defined. Each provided SubReconciler is instrumented to enter a new frame when it's Reconcile method is called and exit upon return.

Two implementations are provided out of the box. DiscardTracer ignores all calls. LogrTracer logs as each frame enters and exits, capturing the elapsed time.

Custom SubReconcilers and other aspects of the call stack can be instrumented:

import "reconciler.io/runtime/trace"

...

trace.Enter(ctx, "MEANINGFUL NAME")
defer trace.Exit(ctx)

Refs #502

Introduces a Tracer interface that can be provided to the Reconciler and
Webhook handler implementations when they are defined. Each provided
SubReconciler is instrumented to enter a new frame when it's Reconcile
method is called and exit upon return.

Two implementations are provided out of the box.  DiscardTracer ignores
all calls.  LogrTracer logs as each frame enters and exits, capturing
the elapsed time.

Custom SubReconcilers and other aspects of the call stack can be
instrumented:

    import "reconciler.io/runtime/trace"

    ...

    trace.Enter(ctx, "MEANINGFUL NAME")
    defer trace.Exit(ctx)

Signed-off-by: Scott Andrews <scott@andrews.me>
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 93.93939% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 61.56%. Comparing base (ce74140) to head (5ed62c2).

Files Patch % Lines
reconcilers/cast.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #507      +/-   ##
==========================================
+ Coverage   61.13%   61.56%   +0.43%     
==========================================
  Files          28       28              
  Lines        2583     2612      +29     
==========================================
+ Hits         1579     1608      +29     
  Misses        917      917              
  Partials       87       87              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant