struct

OpenTelemetry::InstrumentationDocumentation::CrystalHttpClient

Inherits Struct / Value / Object

OpenTelemetry::Instrumentation::CrystalHttpClient

Instruments

  • HTTP::Client

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

The HTTP::Client auto-instrumentation redefactirs the HTTP::Client#io method from a large method to a very small one, and moves most of the work into two new methods, HTTP::Client#do_connect and HTTP::Client#do_connect_ssl, which can then be instrumented, and can receive some additional code to capture some information which is normally discarded, but which the semantic conventions for HTTP spans calls for. It then uses a #def_around_exec block to complete the instrumentation.

Configuration

  • OTEL_CRYSTAL_DISABLE_INSTRUMENTATION_HTTP_CLIENT

    If set, this will disable the instrumentation.

Version Restrictions

  • Crystal >= 1.0.0

Methods Affected

  • HTTP::Client.io

    Refactored from a large method to a small method that calls #do_connect.

  • HTTP::Client#do_connect

    Capture some information about the connection that is thrown away in the original method, and the utilize it in the instrumentation wrapper that follows.

  • HTTP::Client#do_connect_ssl

    Capture some information about the connection that is thrown away in the original method, and the utilize it in the instrumentation wrapper that follows.

Constructors

Instance methods

initialize
Source