Module | Analytics::Database |
In: |
lib/graph_controller_extensions/database_analytics.rb
|
This method renders the partial containing Database Usage Graphs.
# File lib/graph_controller_extensions/database_analytics.rb, line 33 33: def get_database_data(app_id) 34: @app_id = app_id 35: check_and_set_query_date 36: @percentage_db_usage_graph = get_database_usage_graph(@app_id) 37: render :partial => 'database_usage_graph' 38: end
This method is to populate the varriable graph4 and graph9 with the respective graphs data. graph4 contains the data for the Percentage time spent in database layer graph. graph9 contains the data for the Top database consuming urls graph.
# File lib/graph_controller_extensions/database_analytics.rb, line 27 27: def get_database_usage_graph(app_id) 28: @start_hour, @end_hour, start_time, end_time = get_start_and_end_time_from_session() 29: percentage_db_usage_graph = plot_graph("graph/get_percentage_db_usage_data/#{app_id}?time_slab=#{start_time}.#{end_time}", 'percentage_db_usage')#Graph depicts the % database usage 30: end
This method is used to get the data for percentage db usage from the AppTimeSample model. This data is supplied to the bar_grap method to plot the line graph.
# File lib/graph_controller_extensions/database_analytics.rb, line 55 55: def get_percentage_db_usage_data 56: start_time,end_time = get_time_range(params[:time_slab]) 57: app_id = params[:id] 58: wall_time, db_time, max, slab, step = AppTimeSample.get_application_data(app_id, start_time, end_time, "db") 59: line_graph(wall_time, db_time, PERCENTAGE_TIME_SPENT_IN_DATABASE_LAYER_GRAPH_TITLE, max, slab, step, "Wall Time", "% Time Spent") 60: end
This method is called for getting the percentage time spent graph for a specific date and time.
# File lib/graph_controller_extensions/database_analytics.rb, line 41 41: def percentage_time_spent_in_db_layer 42: app_id = params[:app_id] 43: time_array = get_start_end_time(params[:date], params[:start_time], params[:end_time]) 44: if time_array.size > 1 45: @percentage_db_usage_graph = plot_graph("graph/get_percentage_db_usage_data/#{app_id}?time_slab=#{time_array[0]}.#{time_array[1]}", 'percentage_db_usage') 46: render :text => @percentage_db_usage_graph 47: else 48: render :text => time_array[0] 49: end 50: end