Module: Hyperion

Defined in:
lib/hyperion.rb,
lib/hyperion/cli.rb,
lib/hyperion/tls.rb,
lib/hyperion/pool.rb,
lib/hyperion/config.rb,
lib/hyperion/logger.rb,
lib/hyperion/master.rb,
lib/hyperion/parser.rb,
lib/hyperion/server.rb,
lib/hyperion/worker.rb,
lib/hyperion/metrics.rb,
lib/hyperion/request.rb,
lib/hyperion/version.rb,
lib/hyperion/connection.rb,
lib/hyperion/fiber_local.rb,
lib/hyperion/thread_pool.rb,
lib/hyperion/adapter/rack.rb,
lib/hyperion/http2_handler.rb,
lib/hyperion/response_writer.rb

Defined Under Namespace

Modules: Adapter, FiberLocal, TLS Classes: CLI, CParser, Config, Connection, Error, Http2Handler, Logger, Master, Metrics, ParseError, Parser, Pool, Request, ResponseWriter, Server, ThreadPool, UnsupportedError, Worker

Constant Summary collapse

VERSION =
'1.0.0.rc18'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.log_requests=(value) ⇒ Object (writeonly)

Sets the attribute log_requests

Parameters:

  • value

    the value to set the attribute log_requests to.



18
19
20
# File 'lib/hyperion.rb', line 18

def log_requests=(value)
  @log_requests = value
end

.loggerObject



14
15
16
# File 'lib/hyperion.rb', line 14

def logger
  @logger ||= Logger.new
end

Class Method Details

.log_requests?Boolean

Per-request access logging is ON by default — matches Puma/Rails operator expectations (Rails::Rack::Logger emits one line per request out of the box). Operators can disable it via ‘–no-log-requests`, `HYPERION_LOG_REQUESTS=0|false|no|off`, or programmatically via `Hyperion.log_requests = false`. When false, Connection skips ALL access-log work — no Process.clock_gettime, no hash build, nothing.

The hot path uses Logger#access (single-interpolation line build, per-thread cached timestamp, lock-free emit) so default-ON throughput stays well above Puma’s default-OFF baseline.

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
46
47
48
# File 'lib/hyperion.rb', line 38

def log_requests?
  return @log_requests unless @log_requests.nil?

  env = ENV['HYPERION_LOG_REQUESTS']&.downcase
  @log_requests =
    case env
    when '0', 'false', 'no', 'off' then false
    when '1', 'true', 'yes', 'on'  then true
    else true # default ON
    end
end

.metricsObject



20
21
22
# File 'lib/hyperion.rb', line 20

def metrics
  @metrics ||= Metrics.new
end

.statsObject



24
25
26
# File 'lib/hyperion.rb', line 24

def stats
  metrics.snapshot
end