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

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 (597a9ed) to head (5ed62c2).

Current head 5ed62c2 differs from pull request most recent head d1d8f00

Please upload reports for the commit d1d8f00 to get more accurate results.

Files Patch % Lines
reconcilers/cast.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #507      +/-   ##
==========================================
+ Coverage   60.46%   61.56%   +1.09%     
==========================================
  Files          32       28       -4     
  Lines        2861     2612     -249     
==========================================
- Hits         1730     1608     -122     
+ Misses       1039      917     -122     
+ Partials       92       87       -5     

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

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 <[email protected]>
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.

1 participant