reconcilerio / runtime

Kubernetes reconciler framework building on controller-runtime
https://reconciler.io/runtime
Apache License 2.0
25 stars 5 forks source link

Naive Tracing sketch #507

Open scothis opened 7 months ago

scothis commented 7 months ago

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[bot] commented 7 months ago

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).

:exclamation: 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 :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.