Skip to content

Naive Tracing sketch#507

Draft
scothis wants to merge 1 commit intoreconcilerio:mainfrom
scothis:trace
Draft

Naive Tracing sketch#507
scothis wants to merge 1 commit intoreconcilerio:mainfrom
scothis:trace

Conversation

@scothis
Copy link
Copy Markdown
Member

@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

@codecov
Copy link
Copy Markdown

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 <scott@andrews.me>
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