Class: OpenTelemetry::Instrumentation::HTTP::Instrumentation
- Inherits:
-
Base
- Object
- Base
- OpenTelemetry::Instrumentation::HTTP::Instrumentation
- Defined in:
- lib/opentelemetry/instrumentation/http/instrumentation.rb
Overview
The Instrumentation class contains logic to detect and install the Http instrumentation
Instance Method Summary collapse
- #determine_semconv ⇒ Object
- #emit_old_semconv_deprecation_warning(option) ⇒ Object
- #patch_dup ⇒ Object
- #patch_old ⇒ Object
- #patch_stable ⇒ Object
- #require_dependencies_dup ⇒ Object
- #require_dependencies_old ⇒ Object
- #require_dependencies_stable ⇒ Object
Instance Method Details
#determine_semconv ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/opentelemetry/instrumentation/http/instrumentation.rb', line 24 def determine_semconv stability_opt_in = ENV.fetch('OTEL_SEMCONV_STABILITY_OPT_IN', '') values = stability_opt_in.split(',').map(&:strip) if values.include?('http/dup') emit_old_semconv_deprecation_warning('http/dup') 'dup' elsif values.include?('old') emit_old_semconv_deprecation_warning('old') 'old' else 'stable' end end |
#emit_old_semconv_deprecation_warning(option) ⇒ Object
39 40 41 |
# File 'lib/opentelemetry/instrumentation/http/instrumentation.rb', line 39 def emit_old_semconv_deprecation_warning(option) OpenTelemetry.logger.warn("The `#{option}` option for OTEL_SEMCONV_STABILITY_OPT_IN is deprecated and will be removed on April 15, 2026. Please migrate to the stable HTTP semantic conventions.") end |
#patch_dup ⇒ Object
48 49 50 51 |
# File 'lib/opentelemetry/instrumentation/http/instrumentation.rb', line 48 def patch_dup ::HTTP::Client.prepend(Patches::Dup::Client) ::HTTP::Connection.prepend(Patches::Dup::Connection) end |
#patch_old ⇒ Object
43 44 45 46 |
# File 'lib/opentelemetry/instrumentation/http/instrumentation.rb', line 43 def patch_old ::HTTP::Client.prepend(Patches::Old::Client) ::HTTP::Connection.prepend(Patches::Old::Connection) end |
#patch_stable ⇒ Object
53 54 55 56 |
# File 'lib/opentelemetry/instrumentation/http/instrumentation.rb', line 53 def patch_stable ::HTTP::Client.prepend(Patches::Stable::Client) ::HTTP::Connection.prepend(Patches::Stable::Connection) end |
#require_dependencies_dup ⇒ Object
58 59 60 61 |
# File 'lib/opentelemetry/instrumentation/http/instrumentation.rb', line 58 def require_dependencies_dup require_relative 'patches/dup/client' require_relative 'patches/dup/connection' end |
#require_dependencies_old ⇒ Object
63 64 65 66 |
# File 'lib/opentelemetry/instrumentation/http/instrumentation.rb', line 63 def require_dependencies_old require_relative 'patches/old/client' require_relative 'patches/old/connection' end |
#require_dependencies_stable ⇒ Object
68 69 70 71 |
# File 'lib/opentelemetry/instrumentation/http/instrumentation.rb', line 68 def require_dependencies_stable require_relative 'patches/stable/client' require_relative 'patches/stable/connection' end |