Class: QaServer::PerformanceGraphingService

Inherits:
Object
  • Object
show all
Extended by:
GruffGraph, PerformanceHistoryDataKeys
Defined in:
app/services/qa_server/performance_graphing_service.rb

Constant Summary

Constants included from PerformanceHistoryDataKeys

QaServer::PerformanceHistoryDataKeys::ALL_ACTIONS, QaServer::PerformanceHistoryDataKeys::ALL_AUTH, QaServer::PerformanceHistoryDataKeys::AVG_ACTN, QaServer::PerformanceHistoryDataKeys::AVG_FULL, QaServer::PerformanceHistoryDataKeys::AVG_GRPH, QaServer::PerformanceHistoryDataKeys::AVG_LOAD, QaServer::PerformanceHistoryDataKeys::AVG_NORM, QaServer::PerformanceHistoryDataKeys::AVG_RETR, QaServer::PerformanceHistoryDataKeys::BPMS_GRPH, QaServer::PerformanceHistoryDataKeys::BPMS_NORM, QaServer::PerformanceHistoryDataKeys::BPMS_RETR, QaServer::PerformanceHistoryDataKeys::BY_DAY, QaServer::PerformanceHistoryDataKeys::BY_HOUR, QaServer::PerformanceHistoryDataKeys::BY_MONTH, QaServer::PerformanceHistoryDataKeys::FETCH, QaServer::PerformanceHistoryDataKeys::FOR_DATATABLE, QaServer::PerformanceHistoryDataKeys::FOR_DAY, QaServer::PerformanceHistoryDataKeys::FOR_MONTH, QaServer::PerformanceHistoryDataKeys::FOR_YEAR, QaServer::PerformanceHistoryDataKeys::HIGH_ACTN, QaServer::PerformanceHistoryDataKeys::HIGH_FULL, QaServer::PerformanceHistoryDataKeys::HIGH_GRPH, QaServer::PerformanceHistoryDataKeys::HIGH_LOAD, QaServer::PerformanceHistoryDataKeys::HIGH_NORM, QaServer::PerformanceHistoryDataKeys::HIGH_RETR, QaServer::PerformanceHistoryDataKeys::LOW_ACTN, QaServer::PerformanceHistoryDataKeys::LOW_FULL, QaServer::PerformanceHistoryDataKeys::LOW_GRPH, QaServer::PerformanceHistoryDataKeys::LOW_LOAD, QaServer::PerformanceHistoryDataKeys::LOW_NORM, QaServer::PerformanceHistoryDataKeys::LOW_RETR, QaServer::PerformanceHistoryDataKeys::MSPB_GRPH, QaServer::PerformanceHistoryDataKeys::MSPB_NORM, QaServer::PerformanceHistoryDataKeys::MSPB_RETR, QaServer::PerformanceHistoryDataKeys::SEARCH, QaServer::PerformanceHistoryDataKeys::SRC_BYTES, QaServer::PerformanceHistoryDataKeys::STATS

Class Method Summary collapse

Class Method Details

.generate_day_graph(authority_name: ALL_AUTH, action:, data:) ⇒ Object

Generate one 24 hour graph for the authority and action given the graph data.

Parameters:

  • authority_name (String) (defaults to: ALL_AUTH)

    name of the authority

  • action (Symbol)

    action performed by the request (e.g. :search, :fetch, :all_actions)

  • data (Hash)

    data to use to generate the graph

See Also:



59
60
61
62
63
64
# File 'app/services/qa_server/performance_graphing_service.rb', line 59

def generate_day_graph(authority_name: ALL_AUTH, action:, data:)
  gruff_data = rework_performance_data_for_gruff(data, BY_HOUR)
  create_gruff_graph(gruff_data,
                     performance_graph_full_path(authority_name, action, FOR_DAY),
                     I18n.t('qa_server.monitor_status.performance.x_axis_hour'))
end

.generate_month_graph(authority_name: ALL_AUTH, action:, data:) ⇒ Object

Generate one 30 day graph for the authority and action given the graph data.

Parameters:

  • authority_name (String) (defaults to: ALL_AUTH)

    name of the authority

  • action (Symbol)

    action performed by the request (e.g. :search, :fetch, :all_actions)

  • data (Hash)

    data to use to generate the graph

See Also:



47
48
49
50
51
52
# File 'app/services/qa_server/performance_graphing_service.rb', line 47

def generate_month_graph(authority_name: ALL_AUTH, action:, data:)
  gruff_data = rework_performance_data_for_gruff(data, BY_DAY)
  create_gruff_graph(gruff_data,
                     performance_graph_full_path(authority_name, action, FOR_MONTH),
                     I18n.t('qa_server.monitor_status.performance.x_axis_day'))
end

.generate_year_graph(authority_name: ALL_AUTH, action:, data:) ⇒ Object

Generate one 12 month graph for the authority and action given the graph data.

Parameters:

  • authority_name (String) (defaults to: ALL_AUTH)

    name of the authority

  • action (Symbol)

    action performed by the request (e.g. :search, :fetch, :all_actions)

  • data (Hash)

    data to use to generate the graph

See Also:



34
35
36
37
38
39
40
# File 'app/services/qa_server/performance_graphing_service.rb', line 34

def generate_year_graph(authority_name: ALL_AUTH, action:, data:)
  gruff_data = rework_performance_data_for_gruff(data, BY_MONTH)
  create_gruff_graph(gruff_data,
                     performance_graph_full_path(authority_name, action, FOR_YEAR),
                     I18n.t('qa_server.monitor_status.performance.x_axis_month'))
  log_failure(authority_name, action, BY_MONTH)
end

.performance_graph_image_exists?(authority_name: ALL_AUTH, action:, time_period:) ⇒ Boolean

Returns true if image for graph exists; otherwise, false.

Parameters:

  • authority_name (String) (defaults to: ALL_AUTH)

    name of the authority

  • action (Symbol)

    action performed by the request (e.g. :search, :fetch, :all_actions)

  • time_period (Symbol)

    time period for the graph (i.e. :day, :month, :year)

Returns:

  • (Boolean)

    true if image for graph exists; otherwise, false



25
26
27
# File 'app/services/qa_server/performance_graphing_service.rb', line 25

def performance_graph_image_exists?(authority_name: ALL_AUTH, action:, time_period:)
  File.exist?(performance_graph_full_path(authority_name, action, time_period))
end

.performance_graph_image_path(authority_name: ALL_AUTH, action:, time_period:) ⇒ String Also known as: performance_graph_file

Returns Path to use with <image> tags.

Parameters:

  • authority_name (String) (defaults to: ALL_AUTH)

    name of the authority

  • action (Symbol)

    action performed by the request (e.g. :search, :fetch, :all_actions)

  • time_period (Symbol)

    time period for the graph (i.e. :day, :month, :year)

Returns:

  • (String)

    Path to use with <image> tags



16
17
18
# File 'app/services/qa_server/performance_graphing_service.rb', line 16

def performance_graph_image_path(authority_name: ALL_AUTH, action:, time_period:)
  File.join(graph_image_path, graph_filename(authority_name, action, time_period))
end