Kamon icon indicating copy to clipboard operation
Kamon copied to clipboard

Discard span while preserving its metrics?

Open mladens opened this issue 5 years ago • 0 comments

Im trying to track internal asynchronous operations duration (potentially hundreds within one trace) where some metric tags are collected along the way.

Initial approach was to create a span, tagMetrics on it and finish at the end resulting in span.processing-time tracking duration and being properly tagged while also reporting a span for each execution. Although having subspans for operations is desirable, in some cases i would like to make it configurable. Currently, options are having simple duration tracking via spans but producing and reporting (in case of a positive sampling decision of a parent operation) unneccessary spans (only their metrics are) or manually track start times for each operation since by disabling span creation we are loosing their metrics.

Couple of solutions that come to mind...

  • a special type of span to be used as a metric "vehicle" to propagate around which is, once finished and metrics recorded, discarded by tracer (irregardles of sampling decision). Kamon.tempSpanBuilder()

  • Additional methods to discard regular local span
    Kamon.spanBuilder("operNameIrrelevant").finishAndDiscard()

  • Make discard decision a parameter to finish span.finish(dicard = true)

Wdyt?

mladens avatar Oct 28 '19 15:10 mladens