Class: RailsPulse::Suggestions::HttpSuggestionsService

Inherits:
Base
  • Object
show all
Defined in:
app/services/rails_pulse/suggestions/http_suggestions_service.rb

Instance Attribute Summary

Attributes inherited from Base

#operation, #parent

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from RailsPulse::Suggestions::Base

Instance Method Details

#generateObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/rails_pulse/suggestions/http_suggestions_service.rb', line 4

def generate
  suggestions = []

  if operation.duration > 1000
    suggestions << build_suggestion(
      type: "performance",
      icon: "globe",
      title: "Slow External Request",
      description: "HTTP request took #{operation.duration.round(2)}ms. Consider caching responses or using background jobs.",
      priority: "high"
    )
  end

  suggestions
end