struct OpenTelemetry::InstrumentationDocumentation::CrystalGC

Overview

OpenTelemetry::Instrumentation::CrystalGC

Instruments

Reference: https://crystal-lang.org/api/1.4.1/GC.html

To instrument garbage collection, the ideal world would be to have something that could record a timestamp before the GC cycle runs, and then trigger an action after it completes which would create a span, using the prerecorded GC start timestamp.

Right now I know of no way to do this. So the next best option is what we have implemented here. This instrument creates a fiber that spends most of its life sleeping. One a regular interval, which defaults to 300 seconds, it will wake, gather current GC stats, and create a span to record those. If there is a currently active trace, the span will be injected into that trace. Otherwise, it will be a standalone trace.

TODO If the API adds a mechanism for creating what is essentially a trace future, this will be changed so that it can, based on a config setting, use that. This will let people choose to have GC spans always exist only in their own traces, which is probably what makes the most sense in a world where we can't hook directly into the GC cycle.

Configuration

Version Restrictions

Methods Affected

Defined in:

opentelemetry/instrumentation/crystal/gc.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

Instance Method Detail

def initialize #