module OpenTelemetry::Trace::Util::HttpToStatus

Convenience methods, not necessarily required by the API specification.

Public Instance Methods

http_to_status(code) click to toggle source

Maps numeric HTTP status codes to Trace::Status. This module is a mixin for Trace::Status and is not intended for standalone use.

@param code Numeric HTTP status @return Status

# File lib/opentelemetry/trace/util/http_to_status.rb, line 17
def http_to_status(code)
  case code.to_i
  when 100..399
    new(const_get(:OK))
  else
    new(const_get(:ERROR))
  end
end