New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a tool to process logs looking for frequency of method calls #17312

Merged
merged 1 commit into from Apr 24, 2018

Conversation

@bdunne
Member

bdunne commented Apr 18, 2018

Enhance developer insight into what is used
Depends on ManageIQ/manageiq-gems-pending#346

Example output:

Gathering method calls...
{"MiqAeYamlImportFs#add_instance"=>151953,
 "ops_controller-settings_form_field_changed"=>54376,
 "MiqAeYamlImportFs#add_method"=>54347,
 "MiqProductFeature.seed_feature"=>38162,
 "VmdbIndex.seed_for_table"=>32864,
 "MiqAeYamlImportFs#add_class_components"=>31857,
 "Vmdb::Loggers.apply_config"=>31166,
 "ops_controller-settings_update"=>29053,
 "ops_controller-explorer"=>25571,
 "MiqQueue.put"=>25161,
 "miq_request_controller-prov_field_changed"=>24062,
 "Tenant.seed"=>22630,
 "ManageIQ::Showback::InputMeasure.seed"=>20160,
 "MiqReport.sync_from_file"=>20036,
 "MiqAeYamlImportFs#process_namespace"=>19893,
 "ManageIQ::Consumption::ShowbackUsageType.seed"=>19824,
 "AuthUseridPassword#after_authentication_changed"=>17112,
 "ServerRole.seed"=>16603,
 "MiqAeYamlImportConsolidated#add_instance"=>12957,
 "VmdbTableEvm.seed_for_database"=>12681,
 "VmdbTableText.seed_for_table"=>11452,
 "MiqAeDatastore.reset"=>11215,
 "MiqEvent.raise_evm_event"=>10870,
 "MiqAeYamlExportZipfs#write_data"=>10201,
 "MiqRegion.destroy_region"=>9678,
 "MiqAlert.seed"=>8125,
 "MiqAeYamlImportFs#start_import"=>6674,
 "EvmDatabase.seed"=>6363,
 "MiqAeYamlImportConsolidated#process_namespace"=>6061,
 "MiqAeYamlImportConsolidated#start_import"=>5862,
 "MiqQueue#deliver"=>5600,
...

@bdunne bdunne requested a review from Fryguy Apr 18, 2018

@bdunne bdunne changed the title from Add a tool to process logs looking for frequency of method calls to [Depends on ...]Add a tool to process logs looking for frequency of method calls Apr 18, 2018

logfile = ARGV.shift if ARGV[0] && File.file?(ARGV[0])
logfile ||= File.join(RAILS_ROOT, "log/evm.log")
logfile = File.expand_path(logfile)

This comment has been minimized.

@carbonin

carbonin Apr 18, 2018

Member

Do we want to take a glob pattern here so that we can deal with rotated evm logs?

This comment has been minimized.

@bdunne

bdunne Apr 18, 2018

Member

¯\_(ツ)_/¯ I was keeping it consistent with one of the other files for now.

This comment has been minimized.

@kbrock

kbrock Apr 24, 2018

Member

fun: ARGF?

require 'pp'
puts method_call_hash.sort_by {|_key, value| -value}.to_h.pretty_inspect

This comment has been minimized.

@carbonin

carbonin Apr 18, 2018

Member

I think sort_by {value}.reverse would be more readable and is just a bit faster according to https://stackoverflow.com/questions/2642182/sorting-an-array-in-descending-order-in-ruby

@bdunne bdunne changed the title from [Depends on ...]Add a tool to process logs looking for frequency of method calls to Add a tool to process logs looking for frequency of method calls Apr 23, 2018

Add a tool to process logs looking for frequency of method calls
Enhance developer insight into what is used
@miq-bot

This comment has been minimized.

Member

miq-bot commented Apr 24, 2018

Checked commit bdunne@3a58f9b with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 1 offense detected

tools/log_processing/method_call_processor.rb

@bdunne

This comment has been minimized.

Member

bdunne commented Apr 24, 2018

Not really sure why the bot is unhappy with the permissions on the file...

$ ls -al tools/log_processing/method_call_processor.rb
-rwxrwxr-x. 1 bdunne bdunne 596 Apr 24 11:17 tools/log_processing/method_call_processor.rb

@bdunne bdunne requested a review from kbrock Apr 24, 2018

@kbrock

kbrock approved these changes Apr 24, 2018

LGTM

logfile = ARGV.shift if ARGV[0] && File.file?(ARGV[0])
logfile ||= File.join(RAILS_ROOT, "log/evm.log")
logfile = File.expand_path(logfile)

This comment has been minimized.

@kbrock

kbrock Apr 24, 2018

Member

fun: ARGF?

@kbrock kbrock self-assigned this Apr 24, 2018

@kbrock kbrock merged commit 4576d3f into ManageIQ:master Apr 24, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 72.619%
Details

@bdunne bdunne deleted the bdunne:evm_log_processor branch Apr 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment