rails-profiler 0.44.22 → 0.44.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f168cda47e64258053fa18a7506fcd30329660496dca445f3a4681bd0900df94
4
- data.tar.gz: 9d94e8631c9339d17ae07a8527eac8e15b9e5212f8282372027733dc029ae6e1
3
+ metadata.gz: d7a25fc27ee5b1ca0d59d5e1bf5fa496e3d244d2976dd1775e8aeb7cceda94b5
4
+ data.tar.gz: f1acd32e7fe6767236b634eece97fd22b595efbf0404b97636c0e6e348b18cfe
5
5
  SHA512:
6
- metadata.gz: 733f5008d35297d51da580fda1ed0d3e09c50e89536b76ac24cbba0b95bffe40c0973524e4d6ebfade9eccf6063873575293f239461ce1cd3be79446b2593fd9
7
- data.tar.gz: fae4ddf2ac6cf21f5a5a18a963ead3a9cfac96712c10404902725aa06b7f62308a5d0bfef34a6fa77c0b6a698f6f9045bea8879d0f0b052131142f822e2046a6
6
+ metadata.gz: 616d5117bf0b185960c00129dbc7c402b88317739ca0d9106ab786f33d8e5e6659bf2db38e995f930374815cf50459956895afe7843511217a2fcf0db2e53bba
7
+ data.tar.gz: 6f10a27c8cc15adac87a61460e06e7d6e98e314f10b5a713be693a475ad45cfefdee2ae7ee6726ab630a08822b7d3af2e55342539ddfd19f01a3e248e2cc13f1
data/CHANGELOG.md CHANGED
@@ -19,6 +19,16 @@ every commit of every tag interval is accounted for one way or the other.
19
19
 
20
20
  ## [Unreleased]
21
21
 
22
+ ## [0.44.23] - 2026-10-25
23
+
24
+ <!-- stamped -->
25
+
26
+ ### Fixed
27
+
28
+ - **MCP:** `get_profile` and `get_profile_http` tools no longer crash when rendering in-flight HTTP requests with `nil` duration, safely converting to 0.0ms for comparison and display, and a `nil` status is shown as an error.
29
+ - **Cluster:** `SlaveProxy#request` now catches `SocketError`, `SystemCallError`, `Net::OpenTimeout`, `Net::ReadTimeout`, `OpenSSL::SSL::SSLError` and `IOError` and re-raises a `Profiler::Error` naming the slave, so a tool reading from an unreachable slave gets a normal error response instead of an internal `json-rpc` failure (matching `Peers::PeerProxy#get_json`).
30
+ - **Tasks:** `rake profiler:mcp` now defaults to `:stdio` transport instead of configuration-dependent behavior, aligning with the documented interface; `MCP_TRANSPORT` environment variable still overrides.
31
+
22
32
  ## [0.44.22] - 2026-10-25
23
33
 
24
34
  <!-- stamped -->
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "mcp"
4
+ require "net/http"
4
5
  require_relative "http_guard"
5
6
 
6
7
  module Profiler
@@ -467,7 +468,7 @@ module Profiler
467
468
  ::MCP::Tool.define(name: name, description: description, input_schema: input_schema) do |server_context: nil, **args|
468
469
  result = handler.call(args.transform_keys(&:to_s))
469
470
  result.is_a?(::MCP::Tool::Response) ? result : ::MCP::Tool::Response.new(result)
470
- rescue Profiler::Storage::Unavailable::Error, Profiler::Error => e
471
+ rescue Profiler::Storage::Unavailable::Error, Profiler::Error, SystemCallError, Net::OpenTimeout, Net::ReadTimeout => e
471
472
  ::MCP::Tool::Response.new([{ type: "text", text: e.message }], error: true)
472
473
  end
473
474
  end
@@ -400,9 +400,10 @@ module Profiler
400
400
  if http_data["requests"] && !http_data["requests"].empty?
401
401
  lines << "### Request List"
402
402
  http_data["requests"].each_with_index do |req, index|
403
- flag = req["duration"] >= threshold ? " [SLOW]" : ""
404
- err = req["status"] >= 400 || req["status"] == 0 ? " [ERROR]" : ""
405
- lines << "\n**#{index + 1}. #{req['method']} #{req['url']}** - #{req['status'] == 0 ? 'error' : req['status']} - #{req['duration'].round(2)} ms#{flag}#{err}"
403
+ flag = (req["duration"] || 0).to_f >= threshold ? " [SLOW]" : ""
404
+ status = req["status"].to_i
405
+ err = status >= 400 || status == 0 ? " [ERROR]" : ""
406
+ lines << "\n**#{index + 1}. #{req['method']} #{req['url']}** - #{status == 0 ? 'error' : status} - #{(req['duration'] || 0).to_f.round(2)} ms#{flag}#{err}"
406
407
 
407
408
  if req["request_body"] && !req["request_body"].empty?
408
409
  lines << "**Request Body:**"
@@ -76,15 +76,16 @@ module Profiler
76
76
  if requests && !requests.empty?
77
77
  lines << "## Request Details"
78
78
  requests.each_with_index do |req, i|
79
- slow_flag = req["duration"] >= threshold ? " [SLOW]" : ""
80
- err_flag = req["status"] >= 400 || req["status"] == 0 ? " [ERROR]" : ""
79
+ slow_flag = (req["duration"] || 0).to_f >= threshold ? " [SLOW]" : ""
80
+ status = req["status"].to_i
81
+ err_flag = status >= 400 || status == 0 ? " [ERROR]" : ""
81
82
  lines << "\n### Request #{i + 1}#{slow_flag}#{err_flag}"
82
83
  lines << "- **ID:** #{req['id']}" if req["id"]
83
84
  lines << "- **Started at:** #{req['started_at']}" if req["started_at"]
84
85
  lines << "- **Method:** #{req['method']}"
85
86
  lines << "- **URL:** #{req['url']}"
86
- lines << "- **Status:** #{req['status'] == 0 ? 'connection error' : req['status']}"
87
- lines << "- **Duration:** #{req['duration'].round(2)} ms"
87
+ lines << "- **Status:** #{status == 0 ? 'connection error' : status}"
88
+ lines << "- **Duration:** #{(req['duration'] || 0).to_f.round(2)} ms"
88
89
  lines << "- **Request Size:** #{req['request_size'].nil? ? 'unknown' : "#{'at least ' if req['request_size_is_minimum']}#{req['request_size']} bytes"}"
89
90
  lines << "- **Response Size:** #{req['response_size']} bytes"
90
91
  if req["request_body_not_captured"]
@@ -86,7 +86,7 @@ namespace :profiler do
86
86
  task mcp: :environment do
87
87
  require_relative "../mcp/server"
88
88
 
89
- transport = ENV["MCP_TRANSPORT"]&.to_sym || Profiler.configuration.mcp_transport
89
+ transport = ENV["MCP_TRANSPORT"]&.to_sym || :stdio
90
90
  $stderr.puts "Starting Profiler MCP server (#{transport} transport)..."
91
91
 
92
92
  server = Profiler::MCP::Server.new
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Profiler
4
- VERSION = "0.44.22"
4
+ VERSION = "0.44.23"
5
5
 
6
6
  GEM_ROOT = File.expand_path("../..", __dir__)
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.22
4
+ version: 0.44.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sébastien Duplessy