Class: RailsAiBridge::Doctor::Checkers::HttpStructuredLogChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/rails_ai_bridge/doctor/checkers/http_structured_log_checker.rb

Overview

Warns when HTTP MCP is auto-mounted but Config::Mcp#http_log_json is still off.

Instance Attribute Summary

Attributes inherited from BaseChecker

#app

Instance Method Summary collapse

Methods inherited from BaseChecker

#initialize

Constructor Details

This class inherits a constructor from RailsAiBridge::Doctor::Checkers::BaseChecker

Instance Method Details

#call ⇒ Doctor::Check

Returns :pass when auto-mount is off or logs are on; :warn otherwise.

Returns:

  • (Doctor::Check) —

    :pass when auto-mount is off or logs are on; :warn otherwise



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rails_ai_bridge/doctor/checkers/http_structured_log_checker.rb', line 9

def call
  config = RailsAiBridge.configuration
  unless config.auto_mount
    return new_check(
      name: 'HTTP structured logs',
      status: :pass,
      message: 'HTTP MCP auto-mount is off; structured HTTP logs not required',
      fix: nil
    )
  end

  check(
    'HTTP structured logs',
    config.mcp.http_log_json,
    pass: { message: 'HTTP MCP structured logs are enabled (http_log_json)' },
    fail: {
      status: :warn,
      message: 'HTTP MCP is auto-mounted but structured JSON request logs are off',
      fix: 'Set `config.mcp.http_log_json = true` to emit one JSON line per MCP HTTP request'
    }
  )
end