From 1d2b7878c614a38eef9ecd22de4c7e3ba4314c04 Mon Sep 17 00:00:00 2001 From: xuyan wang <35394786+wayyoungboy@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:31:26 +0800 Subject: [PATCH] 3.0 move code (#617) * move code * move code * move code * move code * move code * move code --- .devcontainer.json | 2 +- .github/workflows/build_base_docker.yml | 2 +- build/DockerFile => DockerFile.helper | 0 Dockerfile => Dockerfile.dev | 0 build_rpm.sh | 2 +- dependencies/check_dependencies.py | 48 ------- dev_init.sh | 24 +--- .../check}/obproxy_check_package.yaml | 0 .../check}/observer_check_package.yaml | 0 .../tasks/obproxy/version/bad_version.yaml | 0 .../check}/tasks/observer/bugs/bug_182.yaml | 0 .../check}/tasks/observer/bugs/bug_385.yaml | 0 .../check}/tasks/observer/bugs/bug_469.yaml | 0 .../tasks/observer/clog/clog_disk_full.yaml | 0 .../observer/cluster/core_file_find.yaml | 0 .../observer/cluster/data_path_settings.yaml | 0 .../tasks/observer/cluster/deadlocks.yaml | 0 .../cluster/global_indexes_too_much.yaml | 0 .../check}/tasks/observer/cluster/major.yaml | 0 .../tasks/observer/cluster/mod_too_large.yaml | 0 .../ob_enable_plan_cache_bad_version.yaml | 0 .../observer/cluster/observer_not_active.yaml | 0 ...mizer_better_inlist_costing_parmmeter.yaml | 0 .../cluster/part_trans_action_max.yaml | 0 .../resource_limit_max_session_num.yaml | 0 .../tasks/observer/cluster/sys_log_level.yaml | 0 .../cluster/table_history_too_many.yaml | 0 .../tasks/observer/cluster/task_opt_stat.yaml | 0 .../cluster/task_opt_stat_gather_fail.yaml | 0 .../tasks/observer/cluster/tenant_number.yaml | 0 .../column_storage/tenant_parameters.yaml | 0 .../check}/tasks/observer/cpu/oversold.yaml | 0 .../observer/disk/clog_abnormal_file.yaml | 0 .../check}/tasks/observer/disk/disk_full.yaml | 0 .../check}/tasks/observer/disk/disk_hole.yaml | 0 .../check}/tasks/observer/disk/disk_iops.yaml | 0 .../observer/disk/sstable_abnormal_file.yaml | 0 .../tasks/observer/disk/xfs_repair.yaml | 0 .../observer/err_code/find_err_4000.yaml | 0 .../observer/err_code/find_err_4001.yaml | 0 .../observer/err_code/find_err_4012.yaml | 0 .../observer/err_code/find_err_4013.yaml | 0 .../observer/err_code/find_err_4015.yaml | 0 .../observer/err_code/find_err_4016.yaml | 0 .../observer/err_code/find_err_4103.yaml | 0 .../observer/err_code/find_err_4105.yaml | 0 .../observer/err_code/find_err_4377.yaml | 0 .../observer/network/TCP-retransmission.yaml | 0 .../sysbench_free_test_cpu_count.yaml | 0 .../sysbench_free_test_memory_limit.yaml | 0 .../sysbench_free_test_network_speed.yaml | 0 .../sysbench_run_test_tenant_cpu_used.yaml | 0 .../sysbench_run_test_tenant_memory_used.yaml | 0 .../sysbench_test_cluster_datafile_size.yaml | 0 .../sysbench_test_cluster_log_disk_size.yaml | 0 .../sysbench_test_cluster_parameters.yaml | 0 .../sysbench_test_cpu_quota_concurrency.yaml | 0 .../sysbench/sysbench_test_log_level.yaml | 0 .../sysbench_test_sql_net_thread_count.yaml | 0 .../sysbench_test_tenant_cpu_parameters.yaml | 0 .../sysbench_test_tenant_log_disk_size.yaml | 0 .../sysbench_test_tenant_primary_zone.yaml | 0 .../check}/tasks/observer/system/aio.yaml | 0 .../tasks/observer/system/clock_source.yaml | 0 .../tasks/observer/system/core_pattern.yaml | 0 .../observer/system/dependent_software.yaml | 0 .../system/dependent_software_swapon.yaml | 0 .../tasks/observer/system/getenforce.yaml | 0 .../observer/system/instruction_set_avx2.yaml | 0 .../tasks/observer/system/parameter.yaml | 0 .../system/parameter_ip_local_port_range.yaml | 0 .../observer/system/parameter_tcp_rmem.yaml | 0 .../observer/system/parameter_tcp_wmem.yaml | 0 .../observer/system/ulimit_parameter.yaml | 0 .../information_schema_tables_two_data.yaml | 0 .../tasks/observer/version/bad_version.yaml | 0 .../tasks/observer/version/old_version.yaml | 0 .../display/tasks/observer/cluster_info.yaml | 0 .../tasks/observer/database_datasize.yaml | 0 .../display/tasks/observer/event.yaml | 0 .../display/tasks/observer/lockholder.yaml | 0 .../display/tasks/observer/plan.yaml | 0 .../display/tasks/observer/processlist.yaml | 0 .../display/tasks/observer/rs.yaml | 0 .../display/tasks/observer/server_info.yaml | 0 .../display/tasks/observer/slowsql.yaml | 0 .../tasks/observer/table_datasize.yaml | 0 .../display/tasks/observer/table_info.yaml | 0 .../display/tasks/observer/tenant_info.yaml | 0 .../display/tasks/observer/topsql.yaml | 0 .../display/tasks/observer/unit_info.yaml | 0 .../display/tasks/observer/zone_info.yaml | 0 .../gather}/redact/all_sql.py | 0 .../gather/tasks/obproxy/restart.yaml | 0 .../gather/tasks/observer/backup.yaml | 0 .../gather/tasks/observer/backup_clean.yaml | 0 .../gather/tasks/observer/base.yaml | 0 .../gather/tasks/observer/clog_disk_full.yaml | 0 .../gather/tasks/observer/cluster_down.yaml | 0 .../gather/tasks/observer/compaction.yaml | 0 .../gather/tasks/observer/cpu_high.py | 10 +- .../observer/delay_of_primary_and_backup.yaml | 0 .../gather/tasks/observer/io.yaml | 0 .../gather/tasks/observer/log_archive.yaml | 0 .../tasks/observer/long_transaction.yaml | 0 .../gather/tasks/observer/memory.yaml | 0 .../gather/tasks/observer/px_collect_log.py | 7 +- .../gather/tasks/observer/recovery.yaml | 0 .../gather/tasks/observer/restart.yaml | 0 .../tasks/observer/rootservice_switch.yaml | 0 .../gather/tasks/observer/sql_problem.py | 12 +- .../tasks/observer/suspend_transaction.yaml | 0 .../tasks/observer/unit_data_imbalance.yaml | 0 .../gather/tasks/observer/unknown.yaml | 0 .../gather/tasks/other/application_error.yaml | 0 .../scene => plugins/rca}/clog_disk_full.py | 6 +- .../scene => plugins/rca}/ddl_disk_full.py | 6 +- .../rca/scene => plugins/rca}/ddl_failure.py | 8 +- .../scene => plugins/rca}/disconnection.py | 4 +- .../scene => plugins/rca}/index_ddl_error.py | 7 +- .../scene => plugins/rca}/lock_conflict.py | 6 +- .../rca/scene => plugins/rca}/log_error.py | 6 +- .../rca/scene => plugins/rca}/major_hold.py | 8 +- .../scene => plugins/rca}/oms_full_trans.py | 4 +- .../rca}/transaction_disconnection.py | 6 +- .../rca}/transaction_execute_timeout.py | 8 +- .../rca}/transaction_not_ending.py | 8 +- .../rca}/transaction_other_error.py | 6 +- .../rca}/transaction_rollback.py | 7 +- .../rca}/transaction_wait_timeout.py | 6 +- rpm/build.sh | 117 ------------------ init.sh => rpm/init.sh | 23 +--- init_obdiag_cmd.sh => rpm/init_obdiag_cmd.sh | 0 rpm/obdiag-build.sh | 23 ---- obdiag_backup.sh => rpm/obdiag_backup.sh | 0 rpm/oceanbase-diagnostic-tool.spec | 36 ++---- {common => src/common}/__init__.py | 0 {common => src/common}/command.py | 6 +- config.py => src/common/config.py | 2 +- {common => src/common}/config_helper.py | 18 +-- {common => src/common}/constant.py | 0 context.py => src/common/context.py | 0 core.py => src/common/core.py | 73 +++++------ diag_cmd.py => src/common/diag_cmd.py | 10 +- err.py => src/common/err.py | 0 {common => src/common}/import_module.py | 2 +- {common => src/common}/log.py | 0 {common => src/common}/ob_connector.py | 0 {common => src/common}/ob_log_level.py | 0 {common => src/common}/ob_log_parser.py | 0 {common => src/common}/obdiag_exception.py | 0 {common => src/common}/ocp/__init__.py | 0 {common => src/common}/ocp/ocp_api.py | 0 {common => src/common}/ocp/ocp_task.py | 2 +- result_type.py => src/common/result_type.py | 0 {common => src/common}/scene.py | 4 +- {common => src/common}/ssh.py | 6 +- {common => src/common}/ssh_client/__init__.py | 0 {common => src/common}/ssh_client/base.py | 2 +- .../common}/ssh_client/docker_client.py | 4 +- .../common}/ssh_client/kubernetes_client.py | 2 +- .../common}/ssh_client/local_client.py | 2 +- .../common}/ssh_client/remote_client.py | 4 +- {common => src/common}/ssh_client/ssh.py | 10 +- stdio.py => src/common/stdio.py | 5 +- {common => src/common}/tool.py | 8 +- {common => src/common}/types.py | 0 {common => src/common}/version.py | 0 {handler => src/handler}/__init__.py | 0 {handler => src/handler}/analyzer/__init__.py | 0 .../handler}/analyzer/analyze_flt_trace.py | 18 +-- .../handler}/analyzer/analyze_index_space.py | 8 +- .../handler}/analyzer/analyze_log.py | 29 ++--- .../handler}/analyzer/analyze_memory.py | 16 +-- .../handler}/analyzer/analyze_parameter.py | 10 +- .../handler}/analyzer/analyze_queue.py | 33 +++-- .../handler}/analyzer/analyze_sql.py | 24 ++-- .../handler}/analyzer/analyze_sql_review.py | 14 +-- .../handler}/analyzer/analyze_variable.py | 8 +- .../handler}/analyzer/log_parser/__init__.py | 0 .../handler}/analyzer/log_parser/log_entry.py | 2 +- .../handler}/analyzer/log_parser/log_enum.py | 0 .../handler}/analyzer/log_parser/tree.py | 2 +- .../handler}/analyzer/sql/__init__.py | 0 .../handler}/analyzer/sql/engine.py | 0 .../handler}/analyzer/sql/meta/_init_.py | 0 .../handler}/analyzer/sql/meta/metadata.py | 0 .../analyzer/sql/meta/sys_tenant_meta.py | 6 +- .../handler}/analyzer/sql/rule_manager.py | 24 ++-- .../handler}/analyzer/sql/rules/__init__.py | 0 .../analyzer/sql/rules/abstract_rule.py | 0 .../handler}/analyzer/sql/rules/level.py | 0 .../handler}/analyzer/sql/rules/result.py | 0 .../analyzer/sql/rules/review/__init__.py | 0 .../analyzer/sql/rules/review/arithmetic.py | 6 +- .../analyzer/sql/rules/review/full_scan.py | 6 +- .../analyzer/sql/rules/review/is_null.py | 6 +- .../sql/rules/review/large_in_clause.py | 6 +- .../sql/rules/review/multi_table_join.py | 6 +- .../analyzer/sql/rules/review/select_all.py | 6 +- .../rules/review/update_delete_multi_table.py | 6 +- ..._delete_without_where_or_true_condition.py | 6 +- .../analyzer/sql/rules/tunning/__init__.py | 0 .../rules/tunning/index_column_fuzzy_match.py | 6 +- .../index_column_implicit_conversion.py | 6 +- .../handler}/base_shell_handler.py | 0 {handler => src/handler}/checker/__init__.py | 0 .../handler}/checker/check_exception.py | 0 .../handler}/checker/check_handler.py | 16 +-- .../handler}/checker/check_list.py | 4 +- .../handler}/checker/check_report.py | 6 +- .../handler}/checker/check_task.py | 8 +- .../handler}/checker/result/__init__.py | 0 .../handler}/checker/result/result.py | 4 +- .../handler}/checker/result/verify.py | 6 +- .../handler}/checker/step/__init__.py | 0 .../handler}/checker/step/data_size.py | 6 +- .../checker/step/get_system_parameter.py | 6 +- .../handler}/checker/step/sleep.py | 2 +- {handler => src/handler}/checker/step/sql.py | 6 +- {handler => src/handler}/checker/step/ssh.py | 8 +- .../handler}/checker/step/stepbase.py | 14 +-- {handler => src/handler}/display/__init__.py | 0 .../handler}/display/display_scenes.py | 20 +-- .../handler}/display/scenes/__init__.py | 0 .../handler}/display/scenes/base.py | 6 +- .../handler}/display/scenes/list.py | 10 +- .../handler}/display/scenes/register.py | 0 .../handler}/display/step/__init__.py | 0 {handler => src/handler}/display/step/base.py | 6 +- {handler => src/handler}/display/step/sql.py | 4 +- {handler => src/handler}/display/step/ssh.py | 6 +- {handler => src/handler}/gather/__init__.py | 0 .../handler}/gather/gather_ash_report.py | 14 +-- {handler => src/handler}/gather/gather_awr.py | 15 +-- .../handler}/gather/gather_component_log.py | 15 +-- {handler => src/handler}/gather/gather_log.py | 24 ++-- .../handler}/gather/gather_obadmin.py | 24 ++-- .../handler}/gather/gather_obproxy_log.py | 22 ++-- .../handler}/gather/gather_obstack2.py | 20 +-- .../handler}/gather/gather_parameters.py | 10 +- .../handler}/gather/gather_perf.py | 20 +-- .../handler}/gather/gather_plan_monitor.py | 20 +-- .../handler}/gather/gather_scenes.py | 20 +-- .../handler}/gather/gather_sysstat.py | 20 +-- .../handler}/gather/gather_tabledump.py | 14 +-- .../handler}/gather/gather_variables.py | 8 +- .../handler}/gather/plugins/__init__.py | 0 .../handler}/gather/plugins/redact.py | 2 +- .../handler}/gather/scenes/__init__.py | 0 .../handler}/gather/scenes/base.py | 8 +- .../handler}/gather/scenes/list.py | 10 +- .../handler}/gather/scenes/register.py | 0 .../handler}/gather/step/__init__.py | 0 {handler => src/handler}/gather/step/base.py | 12 +- {handler => src/handler}/gather/step/sql.py | 6 +- {handler => src/handler}/gather/step/ssh.py | 6 +- {handler => src/handler}/meta/__init__.py | 0 {handler => src/handler}/meta/check_meta.py | 0 {handler => src/handler}/meta/html_meta.py | 0 {handler => src/handler}/meta/ob_error.py | 0 {handler => src/handler}/meta/sql_meta.py | 0 {handler => src/handler}/rca/__init__.py | 0 .../handler}/rca/plugins/__init__.py | 0 .../handler}/rca/plugins/gather.py | 2 +- {handler => src/handler}/rca/rca_exception.py | 0 {handler => src/handler}/rca/rca_handler.py | 22 ++-- {handler => src/handler}/rca/rca_list.py | 8 +- {update => src/handler/update}/__init__.py | 0 {update => src/handler/update}/update.py | 14 +-- main.py => src/main.py | 4 +- {telemetry => src/telemetry}/__init__.py | 0 {telemetry => src/telemetry}/telemetry.py | 12 +- test/analyzer/log/test_tree.py | 2 +- test/analyzer/sql/test_arithmetic_rule.py | 4 +- test/analyzer/sql/test_full_scan_rule.py | 4 +- test/analyzer/sql/test_is_null_rule.py | 4 +- .../analyzer/sql/test_large_in_clause_rule.py | 4 +- .../sql/test_multi_table_join_rule.py | 4 +- test/analyzer/sql/test_sellect_all_rule.py | 2 +- .../test_update_delete_multi_table_rule.py | 4 +- ...te_without_where_or_true_condition_rule.py | 4 +- test/analyzer/test_level.py | 2 +- test/analyzer/test_tree.py | 2 +- test/common/ssh_client/test_docker_client.py | 8 +- .../ssh_client/test_kubernetes_client.py | 7 +- test/common/ssh_client/test_local_client.py | 6 +- test/common/ssh_client/test_remote_client.py | 4 +- test/common/test_command.py | 4 +- test/common/test_config_helper.py | 2 +- test/common/test_config_parse.py | 2 +- test/common/test_scene.py | 4 +- 292 files changed, 566 insertions(+), 813 deletions(-) rename build/DockerFile => DockerFile.helper (100%) rename Dockerfile => Dockerfile.dev (100%) delete mode 100644 dependencies/check_dependencies.py rename {handler/checker/tasks => plugins/check}/obproxy_check_package.yaml (100%) rename {handler/checker/tasks => plugins/check}/observer_check_package.yaml (100%) rename {handler/checker => plugins/check}/tasks/obproxy/version/bad_version.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/bugs/bug_182.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/bugs/bug_385.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/bugs/bug_469.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/clog/clog_disk_full.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/core_file_find.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/data_path_settings.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/deadlocks.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/global_indexes_too_much.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/major.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/mod_too_large.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/ob_enable_plan_cache_bad_version.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/observer_not_active.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/optimizer_better_inlist_costing_parmmeter.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/part_trans_action_max.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/resource_limit_max_session_num.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/sys_log_level.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/table_history_too_many.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/task_opt_stat.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/task_opt_stat_gather_fail.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cluster/tenant_number.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/column_storage/tenant_parameters.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/cpu/oversold.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/disk/clog_abnormal_file.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/disk/disk_full.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/disk/disk_hole.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/disk/disk_iops.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/disk/sstable_abnormal_file.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/disk/xfs_repair.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4000.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4001.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4012.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4013.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4015.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4016.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4103.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4105.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/err_code/find_err_4377.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/network/TCP-retransmission.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_free_test_cpu_count.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_free_test_memory_limit.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_free_test_network_speed.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_run_test_tenant_cpu_used.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_run_test_tenant_memory_used.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_cluster_datafile_size.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_cluster_log_disk_size.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_cluster_parameters.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_cpu_quota_concurrency.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_log_level.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_sql_net_thread_count.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_tenant_cpu_parameters.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_tenant_log_disk_size.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/sysbench/sysbench_test_tenant_primary_zone.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/aio.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/clock_source.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/core_pattern.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/dependent_software.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/dependent_software_swapon.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/getenforce.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/instruction_set_avx2.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/parameter.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/parameter_ip_local_port_range.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/parameter_tcp_rmem.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/parameter_tcp_wmem.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/system/ulimit_parameter.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/table/information_schema_tables_two_data.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/version/bad_version.yaml (100%) rename {handler/checker => plugins/check}/tasks/observer/version/old_version.yaml (100%) rename {handler => plugins}/display/tasks/observer/cluster_info.yaml (100%) rename {handler => plugins}/display/tasks/observer/database_datasize.yaml (100%) rename {handler => plugins}/display/tasks/observer/event.yaml (100%) rename {handler => plugins}/display/tasks/observer/lockholder.yaml (100%) rename {handler => plugins}/display/tasks/observer/plan.yaml (100%) rename {handler => plugins}/display/tasks/observer/processlist.yaml (100%) rename {handler => plugins}/display/tasks/observer/rs.yaml (100%) rename {handler => plugins}/display/tasks/observer/server_info.yaml (100%) rename {handler => plugins}/display/tasks/observer/slowsql.yaml (100%) rename {handler => plugins}/display/tasks/observer/table_datasize.yaml (100%) rename {handler => plugins}/display/tasks/observer/table_info.yaml (100%) rename {handler => plugins}/display/tasks/observer/tenant_info.yaml (100%) rename {handler => plugins}/display/tasks/observer/topsql.yaml (100%) rename {handler => plugins}/display/tasks/observer/unit_info.yaml (100%) rename {handler => plugins}/display/tasks/observer/zone_info.yaml (100%) rename {handler/gather/plugins => plugins/gather}/redact/all_sql.py (100%) rename {handler => plugins}/gather/tasks/obproxy/restart.yaml (100%) rename {handler => plugins}/gather/tasks/observer/backup.yaml (100%) rename {handler => plugins}/gather/tasks/observer/backup_clean.yaml (100%) rename {handler => plugins}/gather/tasks/observer/base.yaml (100%) rename {handler => plugins}/gather/tasks/observer/clog_disk_full.yaml (100%) rename {handler => plugins}/gather/tasks/observer/cluster_down.yaml (100%) rename {handler => plugins}/gather/tasks/observer/compaction.yaml (100%) rename {handler => plugins}/gather/tasks/observer/cpu_high.py (92%) rename {handler => plugins}/gather/tasks/observer/delay_of_primary_and_backup.yaml (100%) rename {handler => plugins}/gather/tasks/observer/io.yaml (100%) rename {handler => plugins}/gather/tasks/observer/log_archive.yaml (100%) rename {handler => plugins}/gather/tasks/observer/long_transaction.yaml (100%) rename {handler => plugins}/gather/tasks/observer/memory.yaml (100%) rename {handler => plugins}/gather/tasks/observer/px_collect_log.py (97%) rename {handler => plugins}/gather/tasks/observer/recovery.yaml (100%) rename {handler => plugins}/gather/tasks/observer/restart.yaml (100%) rename {handler => plugins}/gather/tasks/observer/rootservice_switch.yaml (100%) rename {handler => plugins}/gather/tasks/observer/sql_problem.py (94%) rename {handler => plugins}/gather/tasks/observer/suspend_transaction.yaml (100%) rename {handler => plugins}/gather/tasks/observer/unit_data_imbalance.yaml (100%) rename {handler => plugins}/gather/tasks/observer/unknown.yaml (100%) rename {handler => plugins}/gather/tasks/other/application_error.yaml (100%) rename {handler/rca/scene => plugins/rca}/clog_disk_full.py (99%) rename {handler/rca/scene => plugins/rca}/ddl_disk_full.py (98%) rename {handler/rca/scene => plugins/rca}/ddl_failure.py (96%) rename {handler/rca/scene => plugins/rca}/disconnection.py (99%) rename {handler/rca/scene => plugins/rca}/index_ddl_error.py (98%) rename {handler/rca/scene => plugins/rca}/lock_conflict.py (98%) rename {handler/rca/scene => plugins/rca}/log_error.py (98%) rename {handler/rca/scene => plugins/rca}/major_hold.py (99%) rename {handler/rca/scene => plugins/rca}/oms_full_trans.py (98%) rename {handler/rca/scene => plugins/rca}/transaction_disconnection.py (97%) rename {handler/rca/scene => plugins/rca}/transaction_execute_timeout.py (98%) rename {handler/rca/scene => plugins/rca}/transaction_not_ending.py (97%) rename {handler/rca/scene => plugins/rca}/transaction_other_error.py (97%) rename {handler/rca/scene => plugins/rca}/transaction_rollback.py (97%) rename {handler/rca/scene => plugins/rca}/transaction_wait_timeout.py (98%) delete mode 100755 rpm/build.sh rename init.sh => rpm/init.sh (61%) rename init_obdiag_cmd.sh => rpm/init_obdiag_cmd.sh (100%) delete mode 100755 rpm/obdiag-build.sh rename obdiag_backup.sh => rpm/obdiag_backup.sh (100%) rename {common => src/common}/__init__.py (100%) rename {common => src/common}/command.py (99%) rename config.py => src/common/config.py (99%) rename {common => src/common}/config_helper.py (98%) rename {common => src/common}/constant.py (100%) rename context.py => src/common/context.py (100%) rename core.py => src/common/core.py (92%) rename diag_cmd.py => src/common/diag_cmd.py (99%) rename err.py => src/common/err.py (100%) rename {common => src/common}/import_module.py (97%) rename {common => src/common}/log.py (100%) rename {common => src/common}/ob_connector.py (100%) rename {common => src/common}/ob_log_level.py (100%) rename {common => src/common}/ob_log_parser.py (100%) rename {common => src/common}/obdiag_exception.py (100%) rename {common => src/common}/ocp/__init__.py (100%) rename {common => src/common}/ocp/ocp_api.py (100%) rename {common => src/common}/ocp/ocp_task.py (98%) rename result_type.py => src/common/result_type.py (100%) rename {common => src/common}/scene.py (97%) rename {common => src/common}/ssh.py (99%) rename {common => src/common}/ssh_client/__init__.py (100%) rename {common => src/common}/ssh_client/base.py (98%) rename {common => src/common}/ssh_client/docker_client.py (96%) rename {common => src/common}/ssh_client/kubernetes_client.py (99%) rename {common => src/common}/ssh_client/local_client.py (98%) rename {common => src/common}/ssh_client/remote_client.py (98%) rename {common => src/common}/ssh_client/ssh.py (93%) rename stdio.py => src/common/stdio.py (99%) rename {common => src/common}/tool.py (99%) rename {common => src/common}/types.py (100%) rename {common => src/common}/version.py (100%) rename {handler => src/handler}/__init__.py (100%) rename {handler => src/handler}/analyzer/__init__.py (100%) rename {handler => src/handler}/analyzer/analyze_flt_trace.py (97%) rename {handler => src/handler}/analyzer/analyze_index_space.py (98%) rename {handler => src/handler}/analyzer/analyze_log.py (96%) rename {handler => src/handler}/analyzer/analyze_memory.py (99%) rename {handler => src/handler}/analyzer/analyze_parameter.py (98%) rename {handler => src/handler}/analyzer/analyze_queue.py (95%) rename {handler => src/handler}/analyzer/analyze_sql.py (96%) rename {handler => src/handler}/analyzer/analyze_sql_review.py (96%) rename {handler => src/handler}/analyzer/analyze_variable.py (97%) rename {handler => src/handler}/analyzer/log_parser/__init__.py (100%) rename {handler => src/handler}/analyzer/log_parser/log_entry.py (99%) rename {handler => src/handler}/analyzer/log_parser/log_enum.py (100%) rename {handler => src/handler}/analyzer/log_parser/tree.py (99%) rename {handler => src/handler}/analyzer/sql/__init__.py (100%) rename {handler => src/handler}/analyzer/sql/engine.py (100%) rename {handler => src/handler}/analyzer/sql/meta/_init_.py (100%) rename {handler => src/handler}/analyzer/sql/meta/metadata.py (100%) rename {handler => src/handler}/analyzer/sql/meta/sys_tenant_meta.py (96%) rename {handler => src/handler}/analyzer/sql/rule_manager.py (77%) rename {handler => src/handler}/analyzer/sql/rules/__init__.py (100%) rename {handler => src/handler}/analyzer/sql/rules/abstract_rule.py (100%) rename {handler => src/handler}/analyzer/sql/rules/level.py (100%) rename {handler => src/handler}/analyzer/sql/rules/result.py (100%) rename {handler => src/handler}/analyzer/sql/rules/review/__init__.py (100%) rename {handler => src/handler}/analyzer/sql/rules/review/arithmetic.py (91%) rename {handler => src/handler}/analyzer/sql/rules/review/full_scan.py (97%) rename {handler => src/handler}/analyzer/sql/rules/review/is_null.py (93%) rename {handler => src/handler}/analyzer/sql/rules/review/large_in_clause.py (93%) rename {handler => src/handler}/analyzer/sql/rules/review/multi_table_join.py (95%) rename {handler => src/handler}/analyzer/sql/rules/review/select_all.py (93%) rename {handler => src/handler}/analyzer/sql/rules/review/update_delete_multi_table.py (93%) rename {handler => src/handler}/analyzer/sql/rules/review/update_delete_without_where_or_true_condition.py (94%) rename {handler => src/handler}/analyzer/sql/rules/tunning/__init__.py (100%) rename {handler => src/handler}/analyzer/sql/rules/tunning/index_column_fuzzy_match.py (94%) rename {handler => src/handler}/analyzer/sql/rules/tunning/index_column_implicit_conversion.py (95%) rename {handler => src/handler}/base_shell_handler.py (100%) rename {handler => src/handler}/checker/__init__.py (100%) rename {handler => src/handler}/checker/check_exception.py (100%) rename {handler => src/handler}/checker/check_handler.py (96%) rename {handler => src/handler}/checker/check_list.py (98%) rename {handler => src/handler}/checker/check_report.py (99%) rename {handler => src/handler}/checker/check_task.py (93%) rename {handler => src/handler}/checker/result/__init__.py (100%) rename {handler => src/handler}/checker/result/result.py (94%) rename {handler => src/handler}/checker/result/verify.py (97%) rename {handler => src/handler}/checker/step/__init__.py (100%) rename {handler => src/handler}/checker/step/data_size.py (93%) rename {handler => src/handler}/checker/step/get_system_parameter.py (95%) rename {handler => src/handler}/checker/step/sleep.py (97%) rename {handler => src/handler}/checker/step/sql.py (95%) rename {handler => src/handler}/checker/step/ssh.py (93%) rename {handler => src/handler}/checker/step/stepbase.py (92%) rename {handler => src/handler}/display/__init__.py (100%) rename {handler => src/handler}/display/display_scenes.py (95%) rename {handler => src/handler}/display/scenes/__init__.py (100%) rename {handler => src/handler}/display/scenes/base.py (96%) rename {handler => src/handler}/display/scenes/list.py (96%) rename {handler => src/handler}/display/scenes/register.py (100%) rename {handler => src/handler}/display/step/__init__.py (100%) rename {handler => src/handler}/display/step/base.py (95%) rename {handler => src/handler}/display/step/sql.py (97%) rename {handler => src/handler}/display/step/ssh.py (95%) rename {handler => src/handler}/gather/__init__.py (100%) rename {handler => src/handler}/gather/gather_ash_report.py (96%) rename {handler => src/handler}/gather/gather_awr.py (97%) rename {handler => src/handler}/gather/gather_component_log.py (98%) rename {handler => src/handler}/gather/gather_log.py (97%) rename {handler => src/handler}/gather/gather_obadmin.py (96%) rename {handler => src/handler}/gather/gather_obproxy_log.py (96%) rename {handler => src/handler}/gather/gather_obstack2.py (95%) rename {handler => src/handler}/gather/gather_parameters.py (95%) rename {handler => src/handler}/gather/gather_perf.py (95%) rename {handler => src/handler}/gather/gather_plan_monitor.py (99%) rename {handler => src/handler}/gather/gather_scenes.py (95%) rename {handler => src/handler}/gather/gather_sysstat.py (96%) rename {handler => src/handler}/gather/gather_tabledump.py (97%) rename {handler => src/handler}/gather/gather_variables.py (95%) rename {handler => src/handler}/gather/plugins/__init__.py (100%) rename {handler => src/handler}/gather/plugins/redact.py (98%) rename {handler => src/handler}/gather/scenes/__init__.py (100%) rename {handler => src/handler}/gather/scenes/base.py (96%) rename {handler => src/handler}/gather/scenes/list.py (96%) rename {handler => src/handler}/gather/scenes/register.py (100%) rename {handler => src/handler}/gather/step/__init__.py (100%) rename {handler => src/handler}/gather/step/base.py (94%) rename {handler => src/handler}/gather/step/sql.py (97%) rename {handler => src/handler}/gather/step/ssh.py (95%) rename {handler => src/handler}/meta/__init__.py (100%) rename {handler => src/handler}/meta/check_meta.py (100%) rename {handler => src/handler}/meta/html_meta.py (100%) rename {handler => src/handler}/meta/ob_error.py (100%) rename {handler => src/handler}/meta/sql_meta.py (100%) rename {handler => src/handler}/rca/__init__.py (100%) rename {handler => src/handler}/rca/plugins/__init__.py (100%) rename {handler => src/handler}/rca/plugins/gather.py (98%) rename {handler => src/handler}/rca/rca_exception.py (100%) rename {handler => src/handler}/rca/rca_handler.py (98%) rename {handler => src/handler}/rca/rca_list.py (95%) rename {update => src/handler/update}/__init__.py (100%) rename {update => src/handler/update}/update.py (97%) rename main.py => src/main.py (93%) rename {telemetry => src/telemetry}/__init__.py (100%) rename {telemetry => src/telemetry}/telemetry.py (96%) diff --git a/.devcontainer.json b/.devcontainer.json index 388e614b..0926ae67 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -1,6 +1,6 @@ { "name": "OBDIAG", - "dockerFile": "Dockerfile", + "dockerFile": "Dockerfile.dev", "postAttachCommand": "bash", "customizations": { "vscode": { diff --git a/.github/workflows/build_base_docker.yml b/.github/workflows/build_base_docker.yml index 2cd8de4b..6af67340 100644 --- a/.github/workflows/build_base_docker.yml +++ b/.github/workflows/build_base_docker.yml @@ -29,7 +29,7 @@ jobs: with: context: . platforms: linux/amd64 - file: build/DockerFile + file: build/DockerFile.helper push: true tags: | ${{ vars.DOCKER_PUSH_BASE }}/obdiag-builder:latest diff --git a/build/DockerFile b/DockerFile.helper similarity index 100% rename from build/DockerFile rename to DockerFile.helper diff --git a/Dockerfile b/Dockerfile.dev similarity index 100% rename from Dockerfile rename to Dockerfile.dev diff --git a/build_rpm.sh b/build_rpm.sh index f6f83943..ceb8a50c 100644 --- a/build_rpm.sh +++ b/build_rpm.sh @@ -9,4 +9,4 @@ cat ./rpm/oceanbase-diagnostic-tool.spec yum install rpm-build -y rpmbuild -bb ./rpm/oceanbase-diagnostic-tool.spec # 展示对应的包路径 -find / -name oceanbase-diagnostic-tool-*.rpm \ No newline at end of file +find ~/ -name oceanbase-diagnostic-tool-*.rpm \ No newline at end of file diff --git a/dependencies/check_dependencies.py b/dependencies/check_dependencies.py deleted file mode 100644 index bbfc804e..00000000 --- a/dependencies/check_dependencies.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -# -*- coding: UTF-8 -* -# Copyright (c) 2022 OceanBase -# OceanBase Diagnostic Tool is licensed under Mulan PSL v2. -# You can use this software according to the terms and conditions of the Mulan PSL v2. -# You may obtain a copy of Mulan PSL v2 at: -# http://license.coscl.org.cn/MulanPSL2 -# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -""" -@file: check_dependencies.py -@desc: -""" - - -def check_client_dependencies(): - install_flag = False - try: - import pprint - import threading - import tabulate - import requests - import json - import contextlib - import os - import tarfile - import zipfile - import zstandard - import base64 - import hashlib - import argparse - import paramiko - import traceback - - install_flag = True - except Exception as err: - print("import error!!!,cause:[{0}]".format(err)) - pass - finally: - return install_flag - - -if __name__ == "__main__": - if not check_client_dependencies(): - print("\033[1;31m check dependencies failed, you need resolve dependencies \033[0m") diff --git a/dev_init.sh b/dev_init.sh index 43ae742b..93f32a59 100755 --- a/dev_init.sh +++ b/dev_init.sh @@ -41,36 +41,20 @@ copy_file(){ mkdir -p ${OBDIAG_HOME}/check mkdir -p ${OBDIAG_HOME}/gather mkdir -p ${OBDIAG_HOME}/display - if [ -d "${WORK_DIR}/handler/checker/tasks" ]; then - cp -rf ${WORK_DIR}/handler/checker/tasks ${OBDIAG_HOME}/check/ - cp -rf ${WORK_DIR}/handler/checker/tasks/obproxy_check_package.yaml ${OBDIAG_HOME}/check/ - cp -rf ${WORK_DIR}/handler/checker/tasks/observer_check_package.yaml ${OBDIAG_HOME}/check/ - fi - if [ -d "${WORK_DIR}/handler/gather/tasks" ]; then - cp -rf ${WORK_DIR}/handler/gather/tasks ${OBDIAG_HOME}/gather/ - fi - - if [ -d "${WORK_DIR}/handler/display/tasks" ]; then - cp -rf ${WORK_DIR}/handler/display/tasks ${OBDIAG_HOME}/display/ - fi - + cp -rf ${WORK_DIR}/plugins/* ${OBDIAG_HOME}/ if [ -d "${WORK_DIR}/example" ]; then cp -rf ${WORK_DIR}/example ${OBDIAG_HOME}/ fi - if [ -d "${WORK_DIR}/handler/rca/scene" ]; then - cp -rf ${WORK_DIR}/handler/rca/scene ${OBDIAG_HOME}/rca - fi - } copy_file echo "File initialization completed" check_python_version -source ${WORK_DIR}/init_obdiag_cmd.sh +source ${WORK_DIR}/rpm/init_obdiag_cmd.sh -echo "Creating or updating alias 'obdiag' to run 'python3 ${PROJECT_PATH}/main.py'" -echo "alias obdiag='python3 ${PROJECT_PATH}/main.py'" >> ~/.bashrc +echo "Creating or updating alias 'obdiag' to run 'python3 ${PROJECT_PATH}/src/main.py'" +echo "alias obdiag='python3 ${PROJECT_PATH}/src/main.py'" >> ~/.bashrc source ~/.bashrc echo "Initialization completed successfully!" \ No newline at end of file diff --git a/handler/checker/tasks/obproxy_check_package.yaml b/plugins/check/obproxy_check_package.yaml similarity index 100% rename from handler/checker/tasks/obproxy_check_package.yaml rename to plugins/check/obproxy_check_package.yaml diff --git a/handler/checker/tasks/observer_check_package.yaml b/plugins/check/observer_check_package.yaml similarity index 100% rename from handler/checker/tasks/observer_check_package.yaml rename to plugins/check/observer_check_package.yaml diff --git a/handler/checker/tasks/obproxy/version/bad_version.yaml b/plugins/check/tasks/obproxy/version/bad_version.yaml similarity index 100% rename from handler/checker/tasks/obproxy/version/bad_version.yaml rename to plugins/check/tasks/obproxy/version/bad_version.yaml diff --git a/handler/checker/tasks/observer/bugs/bug_182.yaml b/plugins/check/tasks/observer/bugs/bug_182.yaml similarity index 100% rename from handler/checker/tasks/observer/bugs/bug_182.yaml rename to plugins/check/tasks/observer/bugs/bug_182.yaml diff --git a/handler/checker/tasks/observer/bugs/bug_385.yaml b/plugins/check/tasks/observer/bugs/bug_385.yaml similarity index 100% rename from handler/checker/tasks/observer/bugs/bug_385.yaml rename to plugins/check/tasks/observer/bugs/bug_385.yaml diff --git a/handler/checker/tasks/observer/bugs/bug_469.yaml b/plugins/check/tasks/observer/bugs/bug_469.yaml similarity index 100% rename from handler/checker/tasks/observer/bugs/bug_469.yaml rename to plugins/check/tasks/observer/bugs/bug_469.yaml diff --git a/handler/checker/tasks/observer/clog/clog_disk_full.yaml b/plugins/check/tasks/observer/clog/clog_disk_full.yaml similarity index 100% rename from handler/checker/tasks/observer/clog/clog_disk_full.yaml rename to plugins/check/tasks/observer/clog/clog_disk_full.yaml diff --git a/handler/checker/tasks/observer/cluster/core_file_find.yaml b/plugins/check/tasks/observer/cluster/core_file_find.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/core_file_find.yaml rename to plugins/check/tasks/observer/cluster/core_file_find.yaml diff --git a/handler/checker/tasks/observer/cluster/data_path_settings.yaml b/plugins/check/tasks/observer/cluster/data_path_settings.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/data_path_settings.yaml rename to plugins/check/tasks/observer/cluster/data_path_settings.yaml diff --git a/handler/checker/tasks/observer/cluster/deadlocks.yaml b/plugins/check/tasks/observer/cluster/deadlocks.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/deadlocks.yaml rename to plugins/check/tasks/observer/cluster/deadlocks.yaml diff --git a/handler/checker/tasks/observer/cluster/global_indexes_too_much.yaml b/plugins/check/tasks/observer/cluster/global_indexes_too_much.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/global_indexes_too_much.yaml rename to plugins/check/tasks/observer/cluster/global_indexes_too_much.yaml diff --git a/handler/checker/tasks/observer/cluster/major.yaml b/plugins/check/tasks/observer/cluster/major.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/major.yaml rename to plugins/check/tasks/observer/cluster/major.yaml diff --git a/handler/checker/tasks/observer/cluster/mod_too_large.yaml b/plugins/check/tasks/observer/cluster/mod_too_large.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/mod_too_large.yaml rename to plugins/check/tasks/observer/cluster/mod_too_large.yaml diff --git a/handler/checker/tasks/observer/cluster/ob_enable_plan_cache_bad_version.yaml b/plugins/check/tasks/observer/cluster/ob_enable_plan_cache_bad_version.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/ob_enable_plan_cache_bad_version.yaml rename to plugins/check/tasks/observer/cluster/ob_enable_plan_cache_bad_version.yaml diff --git a/handler/checker/tasks/observer/cluster/observer_not_active.yaml b/plugins/check/tasks/observer/cluster/observer_not_active.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/observer_not_active.yaml rename to plugins/check/tasks/observer/cluster/observer_not_active.yaml diff --git a/handler/checker/tasks/observer/cluster/optimizer_better_inlist_costing_parmmeter.yaml b/plugins/check/tasks/observer/cluster/optimizer_better_inlist_costing_parmmeter.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/optimizer_better_inlist_costing_parmmeter.yaml rename to plugins/check/tasks/observer/cluster/optimizer_better_inlist_costing_parmmeter.yaml diff --git a/handler/checker/tasks/observer/cluster/part_trans_action_max.yaml b/plugins/check/tasks/observer/cluster/part_trans_action_max.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/part_trans_action_max.yaml rename to plugins/check/tasks/observer/cluster/part_trans_action_max.yaml diff --git a/handler/checker/tasks/observer/cluster/resource_limit_max_session_num.yaml b/plugins/check/tasks/observer/cluster/resource_limit_max_session_num.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/resource_limit_max_session_num.yaml rename to plugins/check/tasks/observer/cluster/resource_limit_max_session_num.yaml diff --git a/handler/checker/tasks/observer/cluster/sys_log_level.yaml b/plugins/check/tasks/observer/cluster/sys_log_level.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/sys_log_level.yaml rename to plugins/check/tasks/observer/cluster/sys_log_level.yaml diff --git a/handler/checker/tasks/observer/cluster/table_history_too_many.yaml b/plugins/check/tasks/observer/cluster/table_history_too_many.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/table_history_too_many.yaml rename to plugins/check/tasks/observer/cluster/table_history_too_many.yaml diff --git a/handler/checker/tasks/observer/cluster/task_opt_stat.yaml b/plugins/check/tasks/observer/cluster/task_opt_stat.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/task_opt_stat.yaml rename to plugins/check/tasks/observer/cluster/task_opt_stat.yaml diff --git a/handler/checker/tasks/observer/cluster/task_opt_stat_gather_fail.yaml b/plugins/check/tasks/observer/cluster/task_opt_stat_gather_fail.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/task_opt_stat_gather_fail.yaml rename to plugins/check/tasks/observer/cluster/task_opt_stat_gather_fail.yaml diff --git a/handler/checker/tasks/observer/cluster/tenant_number.yaml b/plugins/check/tasks/observer/cluster/tenant_number.yaml similarity index 100% rename from handler/checker/tasks/observer/cluster/tenant_number.yaml rename to plugins/check/tasks/observer/cluster/tenant_number.yaml diff --git a/handler/checker/tasks/observer/column_storage/tenant_parameters.yaml b/plugins/check/tasks/observer/column_storage/tenant_parameters.yaml similarity index 100% rename from handler/checker/tasks/observer/column_storage/tenant_parameters.yaml rename to plugins/check/tasks/observer/column_storage/tenant_parameters.yaml diff --git a/handler/checker/tasks/observer/cpu/oversold.yaml b/plugins/check/tasks/observer/cpu/oversold.yaml similarity index 100% rename from handler/checker/tasks/observer/cpu/oversold.yaml rename to plugins/check/tasks/observer/cpu/oversold.yaml diff --git a/handler/checker/tasks/observer/disk/clog_abnormal_file.yaml b/plugins/check/tasks/observer/disk/clog_abnormal_file.yaml similarity index 100% rename from handler/checker/tasks/observer/disk/clog_abnormal_file.yaml rename to plugins/check/tasks/observer/disk/clog_abnormal_file.yaml diff --git a/handler/checker/tasks/observer/disk/disk_full.yaml b/plugins/check/tasks/observer/disk/disk_full.yaml similarity index 100% rename from handler/checker/tasks/observer/disk/disk_full.yaml rename to plugins/check/tasks/observer/disk/disk_full.yaml diff --git a/handler/checker/tasks/observer/disk/disk_hole.yaml b/plugins/check/tasks/observer/disk/disk_hole.yaml similarity index 100% rename from handler/checker/tasks/observer/disk/disk_hole.yaml rename to plugins/check/tasks/observer/disk/disk_hole.yaml diff --git a/handler/checker/tasks/observer/disk/disk_iops.yaml b/plugins/check/tasks/observer/disk/disk_iops.yaml similarity index 100% rename from handler/checker/tasks/observer/disk/disk_iops.yaml rename to plugins/check/tasks/observer/disk/disk_iops.yaml diff --git a/handler/checker/tasks/observer/disk/sstable_abnormal_file.yaml b/plugins/check/tasks/observer/disk/sstable_abnormal_file.yaml similarity index 100% rename from handler/checker/tasks/observer/disk/sstable_abnormal_file.yaml rename to plugins/check/tasks/observer/disk/sstable_abnormal_file.yaml diff --git a/handler/checker/tasks/observer/disk/xfs_repair.yaml b/plugins/check/tasks/observer/disk/xfs_repair.yaml similarity index 100% rename from handler/checker/tasks/observer/disk/xfs_repair.yaml rename to plugins/check/tasks/observer/disk/xfs_repair.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4000.yaml b/plugins/check/tasks/observer/err_code/find_err_4000.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4000.yaml rename to plugins/check/tasks/observer/err_code/find_err_4000.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4001.yaml b/plugins/check/tasks/observer/err_code/find_err_4001.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4001.yaml rename to plugins/check/tasks/observer/err_code/find_err_4001.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4012.yaml b/plugins/check/tasks/observer/err_code/find_err_4012.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4012.yaml rename to plugins/check/tasks/observer/err_code/find_err_4012.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4013.yaml b/plugins/check/tasks/observer/err_code/find_err_4013.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4013.yaml rename to plugins/check/tasks/observer/err_code/find_err_4013.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4015.yaml b/plugins/check/tasks/observer/err_code/find_err_4015.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4015.yaml rename to plugins/check/tasks/observer/err_code/find_err_4015.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4016.yaml b/plugins/check/tasks/observer/err_code/find_err_4016.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4016.yaml rename to plugins/check/tasks/observer/err_code/find_err_4016.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4103.yaml b/plugins/check/tasks/observer/err_code/find_err_4103.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4103.yaml rename to plugins/check/tasks/observer/err_code/find_err_4103.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4105.yaml b/plugins/check/tasks/observer/err_code/find_err_4105.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4105.yaml rename to plugins/check/tasks/observer/err_code/find_err_4105.yaml diff --git a/handler/checker/tasks/observer/err_code/find_err_4377.yaml b/plugins/check/tasks/observer/err_code/find_err_4377.yaml similarity index 100% rename from handler/checker/tasks/observer/err_code/find_err_4377.yaml rename to plugins/check/tasks/observer/err_code/find_err_4377.yaml diff --git a/handler/checker/tasks/observer/network/TCP-retransmission.yaml b/plugins/check/tasks/observer/network/TCP-retransmission.yaml similarity index 100% rename from handler/checker/tasks/observer/network/TCP-retransmission.yaml rename to plugins/check/tasks/observer/network/TCP-retransmission.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_free_test_cpu_count.yaml b/plugins/check/tasks/observer/sysbench/sysbench_free_test_cpu_count.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_free_test_cpu_count.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_free_test_cpu_count.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_free_test_memory_limit.yaml b/plugins/check/tasks/observer/sysbench/sysbench_free_test_memory_limit.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_free_test_memory_limit.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_free_test_memory_limit.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_free_test_network_speed.yaml b/plugins/check/tasks/observer/sysbench/sysbench_free_test_network_speed.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_free_test_network_speed.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_free_test_network_speed.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_run_test_tenant_cpu_used.yaml b/plugins/check/tasks/observer/sysbench/sysbench_run_test_tenant_cpu_used.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_run_test_tenant_cpu_used.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_run_test_tenant_cpu_used.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_run_test_tenant_memory_used.yaml b/plugins/check/tasks/observer/sysbench/sysbench_run_test_tenant_memory_used.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_run_test_tenant_memory_used.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_run_test_tenant_memory_used.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_cluster_datafile_size.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_cluster_datafile_size.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_cluster_datafile_size.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_cluster_datafile_size.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_cluster_log_disk_size.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_cluster_log_disk_size.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_cluster_log_disk_size.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_cluster_log_disk_size.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_cluster_parameters.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_cluster_parameters.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_cluster_parameters.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_cluster_parameters.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_cpu_quota_concurrency.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_cpu_quota_concurrency.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_cpu_quota_concurrency.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_cpu_quota_concurrency.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_log_level.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_log_level.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_log_level.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_log_level.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_sql_net_thread_count.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_sql_net_thread_count.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_sql_net_thread_count.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_sql_net_thread_count.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_tenant_cpu_parameters.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_tenant_cpu_parameters.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_tenant_cpu_parameters.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_tenant_cpu_parameters.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_tenant_log_disk_size.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_tenant_log_disk_size.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_tenant_log_disk_size.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_tenant_log_disk_size.yaml diff --git a/handler/checker/tasks/observer/sysbench/sysbench_test_tenant_primary_zone.yaml b/plugins/check/tasks/observer/sysbench/sysbench_test_tenant_primary_zone.yaml similarity index 100% rename from handler/checker/tasks/observer/sysbench/sysbench_test_tenant_primary_zone.yaml rename to plugins/check/tasks/observer/sysbench/sysbench_test_tenant_primary_zone.yaml diff --git a/handler/checker/tasks/observer/system/aio.yaml b/plugins/check/tasks/observer/system/aio.yaml similarity index 100% rename from handler/checker/tasks/observer/system/aio.yaml rename to plugins/check/tasks/observer/system/aio.yaml diff --git a/handler/checker/tasks/observer/system/clock_source.yaml b/plugins/check/tasks/observer/system/clock_source.yaml similarity index 100% rename from handler/checker/tasks/observer/system/clock_source.yaml rename to plugins/check/tasks/observer/system/clock_source.yaml diff --git a/handler/checker/tasks/observer/system/core_pattern.yaml b/plugins/check/tasks/observer/system/core_pattern.yaml similarity index 100% rename from handler/checker/tasks/observer/system/core_pattern.yaml rename to plugins/check/tasks/observer/system/core_pattern.yaml diff --git a/handler/checker/tasks/observer/system/dependent_software.yaml b/plugins/check/tasks/observer/system/dependent_software.yaml similarity index 100% rename from handler/checker/tasks/observer/system/dependent_software.yaml rename to plugins/check/tasks/observer/system/dependent_software.yaml diff --git a/handler/checker/tasks/observer/system/dependent_software_swapon.yaml b/plugins/check/tasks/observer/system/dependent_software_swapon.yaml similarity index 100% rename from handler/checker/tasks/observer/system/dependent_software_swapon.yaml rename to plugins/check/tasks/observer/system/dependent_software_swapon.yaml diff --git a/handler/checker/tasks/observer/system/getenforce.yaml b/plugins/check/tasks/observer/system/getenforce.yaml similarity index 100% rename from handler/checker/tasks/observer/system/getenforce.yaml rename to plugins/check/tasks/observer/system/getenforce.yaml diff --git a/handler/checker/tasks/observer/system/instruction_set_avx2.yaml b/plugins/check/tasks/observer/system/instruction_set_avx2.yaml similarity index 100% rename from handler/checker/tasks/observer/system/instruction_set_avx2.yaml rename to plugins/check/tasks/observer/system/instruction_set_avx2.yaml diff --git a/handler/checker/tasks/observer/system/parameter.yaml b/plugins/check/tasks/observer/system/parameter.yaml similarity index 100% rename from handler/checker/tasks/observer/system/parameter.yaml rename to plugins/check/tasks/observer/system/parameter.yaml diff --git a/handler/checker/tasks/observer/system/parameter_ip_local_port_range.yaml b/plugins/check/tasks/observer/system/parameter_ip_local_port_range.yaml similarity index 100% rename from handler/checker/tasks/observer/system/parameter_ip_local_port_range.yaml rename to plugins/check/tasks/observer/system/parameter_ip_local_port_range.yaml diff --git a/handler/checker/tasks/observer/system/parameter_tcp_rmem.yaml b/plugins/check/tasks/observer/system/parameter_tcp_rmem.yaml similarity index 100% rename from handler/checker/tasks/observer/system/parameter_tcp_rmem.yaml rename to plugins/check/tasks/observer/system/parameter_tcp_rmem.yaml diff --git a/handler/checker/tasks/observer/system/parameter_tcp_wmem.yaml b/plugins/check/tasks/observer/system/parameter_tcp_wmem.yaml similarity index 100% rename from handler/checker/tasks/observer/system/parameter_tcp_wmem.yaml rename to plugins/check/tasks/observer/system/parameter_tcp_wmem.yaml diff --git a/handler/checker/tasks/observer/system/ulimit_parameter.yaml b/plugins/check/tasks/observer/system/ulimit_parameter.yaml similarity index 100% rename from handler/checker/tasks/observer/system/ulimit_parameter.yaml rename to plugins/check/tasks/observer/system/ulimit_parameter.yaml diff --git a/handler/checker/tasks/observer/table/information_schema_tables_two_data.yaml b/plugins/check/tasks/observer/table/information_schema_tables_two_data.yaml similarity index 100% rename from handler/checker/tasks/observer/table/information_schema_tables_two_data.yaml rename to plugins/check/tasks/observer/table/information_schema_tables_two_data.yaml diff --git a/handler/checker/tasks/observer/version/bad_version.yaml b/plugins/check/tasks/observer/version/bad_version.yaml similarity index 100% rename from handler/checker/tasks/observer/version/bad_version.yaml rename to plugins/check/tasks/observer/version/bad_version.yaml diff --git a/handler/checker/tasks/observer/version/old_version.yaml b/plugins/check/tasks/observer/version/old_version.yaml similarity index 100% rename from handler/checker/tasks/observer/version/old_version.yaml rename to plugins/check/tasks/observer/version/old_version.yaml diff --git a/handler/display/tasks/observer/cluster_info.yaml b/plugins/display/tasks/observer/cluster_info.yaml similarity index 100% rename from handler/display/tasks/observer/cluster_info.yaml rename to plugins/display/tasks/observer/cluster_info.yaml diff --git a/handler/display/tasks/observer/database_datasize.yaml b/plugins/display/tasks/observer/database_datasize.yaml similarity index 100% rename from handler/display/tasks/observer/database_datasize.yaml rename to plugins/display/tasks/observer/database_datasize.yaml diff --git a/handler/display/tasks/observer/event.yaml b/plugins/display/tasks/observer/event.yaml similarity index 100% rename from handler/display/tasks/observer/event.yaml rename to plugins/display/tasks/observer/event.yaml diff --git a/handler/display/tasks/observer/lockholder.yaml b/plugins/display/tasks/observer/lockholder.yaml similarity index 100% rename from handler/display/tasks/observer/lockholder.yaml rename to plugins/display/tasks/observer/lockholder.yaml diff --git a/handler/display/tasks/observer/plan.yaml b/plugins/display/tasks/observer/plan.yaml similarity index 100% rename from handler/display/tasks/observer/plan.yaml rename to plugins/display/tasks/observer/plan.yaml diff --git a/handler/display/tasks/observer/processlist.yaml b/plugins/display/tasks/observer/processlist.yaml similarity index 100% rename from handler/display/tasks/observer/processlist.yaml rename to plugins/display/tasks/observer/processlist.yaml diff --git a/handler/display/tasks/observer/rs.yaml b/plugins/display/tasks/observer/rs.yaml similarity index 100% rename from handler/display/tasks/observer/rs.yaml rename to plugins/display/tasks/observer/rs.yaml diff --git a/handler/display/tasks/observer/server_info.yaml b/plugins/display/tasks/observer/server_info.yaml similarity index 100% rename from handler/display/tasks/observer/server_info.yaml rename to plugins/display/tasks/observer/server_info.yaml diff --git a/handler/display/tasks/observer/slowsql.yaml b/plugins/display/tasks/observer/slowsql.yaml similarity index 100% rename from handler/display/tasks/observer/slowsql.yaml rename to plugins/display/tasks/observer/slowsql.yaml diff --git a/handler/display/tasks/observer/table_datasize.yaml b/plugins/display/tasks/observer/table_datasize.yaml similarity index 100% rename from handler/display/tasks/observer/table_datasize.yaml rename to plugins/display/tasks/observer/table_datasize.yaml diff --git a/handler/display/tasks/observer/table_info.yaml b/plugins/display/tasks/observer/table_info.yaml similarity index 100% rename from handler/display/tasks/observer/table_info.yaml rename to plugins/display/tasks/observer/table_info.yaml diff --git a/handler/display/tasks/observer/tenant_info.yaml b/plugins/display/tasks/observer/tenant_info.yaml similarity index 100% rename from handler/display/tasks/observer/tenant_info.yaml rename to plugins/display/tasks/observer/tenant_info.yaml diff --git a/handler/display/tasks/observer/topsql.yaml b/plugins/display/tasks/observer/topsql.yaml similarity index 100% rename from handler/display/tasks/observer/topsql.yaml rename to plugins/display/tasks/observer/topsql.yaml diff --git a/handler/display/tasks/observer/unit_info.yaml b/plugins/display/tasks/observer/unit_info.yaml similarity index 100% rename from handler/display/tasks/observer/unit_info.yaml rename to plugins/display/tasks/observer/unit_info.yaml diff --git a/handler/display/tasks/observer/zone_info.yaml b/plugins/display/tasks/observer/zone_info.yaml similarity index 100% rename from handler/display/tasks/observer/zone_info.yaml rename to plugins/display/tasks/observer/zone_info.yaml diff --git a/handler/gather/plugins/redact/all_sql.py b/plugins/gather/redact/all_sql.py similarity index 100% rename from handler/gather/plugins/redact/all_sql.py rename to plugins/gather/redact/all_sql.py diff --git a/handler/gather/tasks/obproxy/restart.yaml b/plugins/gather/tasks/obproxy/restart.yaml similarity index 100% rename from handler/gather/tasks/obproxy/restart.yaml rename to plugins/gather/tasks/obproxy/restart.yaml diff --git a/handler/gather/tasks/observer/backup.yaml b/plugins/gather/tasks/observer/backup.yaml similarity index 100% rename from handler/gather/tasks/observer/backup.yaml rename to plugins/gather/tasks/observer/backup.yaml diff --git a/handler/gather/tasks/observer/backup_clean.yaml b/plugins/gather/tasks/observer/backup_clean.yaml similarity index 100% rename from handler/gather/tasks/observer/backup_clean.yaml rename to plugins/gather/tasks/observer/backup_clean.yaml diff --git a/handler/gather/tasks/observer/base.yaml b/plugins/gather/tasks/observer/base.yaml similarity index 100% rename from handler/gather/tasks/observer/base.yaml rename to plugins/gather/tasks/observer/base.yaml diff --git a/handler/gather/tasks/observer/clog_disk_full.yaml b/plugins/gather/tasks/observer/clog_disk_full.yaml similarity index 100% rename from handler/gather/tasks/observer/clog_disk_full.yaml rename to plugins/gather/tasks/observer/clog_disk_full.yaml diff --git a/handler/gather/tasks/observer/cluster_down.yaml b/plugins/gather/tasks/observer/cluster_down.yaml similarity index 100% rename from handler/gather/tasks/observer/cluster_down.yaml rename to plugins/gather/tasks/observer/cluster_down.yaml diff --git a/handler/gather/tasks/observer/compaction.yaml b/plugins/gather/tasks/observer/compaction.yaml similarity index 100% rename from handler/gather/tasks/observer/compaction.yaml rename to plugins/gather/tasks/observer/compaction.yaml diff --git a/handler/gather/tasks/observer/cpu_high.py b/plugins/gather/tasks/observer/cpu_high.py similarity index 92% rename from handler/gather/tasks/observer/cpu_high.py rename to plugins/gather/tasks/observer/cpu_high.py index 075eebf8..a5a0a26e 100644 --- a/handler/gather/tasks/observer/cpu_high.py +++ b/plugins/gather/tasks/observer/cpu_high.py @@ -17,11 +17,11 @@ """ import os -from common.ssh_client.ssh import SshClient -from handler.gather.gather_component_log import GatherComponentLogHandler -from stdio import SafeStdio -from handler.gather.gather_obstack2 import GatherObstack2Handler -from handler.gather.gather_perf import GatherPerfHandler +from src.common.ssh_client.ssh import SshClient +from src.handler.gather.gather_component_log import GatherComponentLogHandler +from src.common.stdio import SafeStdio +from src.handler.gather.gather_obstack2 import GatherObstack2Handler +from src.handler.gather.gather_perf import GatherPerfHandler class CPUHigh(SafeStdio): diff --git a/handler/gather/tasks/observer/delay_of_primary_and_backup.yaml b/plugins/gather/tasks/observer/delay_of_primary_and_backup.yaml similarity index 100% rename from handler/gather/tasks/observer/delay_of_primary_and_backup.yaml rename to plugins/gather/tasks/observer/delay_of_primary_and_backup.yaml diff --git a/handler/gather/tasks/observer/io.yaml b/plugins/gather/tasks/observer/io.yaml similarity index 100% rename from handler/gather/tasks/observer/io.yaml rename to plugins/gather/tasks/observer/io.yaml diff --git a/handler/gather/tasks/observer/log_archive.yaml b/plugins/gather/tasks/observer/log_archive.yaml similarity index 100% rename from handler/gather/tasks/observer/log_archive.yaml rename to plugins/gather/tasks/observer/log_archive.yaml diff --git a/handler/gather/tasks/observer/long_transaction.yaml b/plugins/gather/tasks/observer/long_transaction.yaml similarity index 100% rename from handler/gather/tasks/observer/long_transaction.yaml rename to plugins/gather/tasks/observer/long_transaction.yaml diff --git a/handler/gather/tasks/observer/memory.yaml b/plugins/gather/tasks/observer/memory.yaml similarity index 100% rename from handler/gather/tasks/observer/memory.yaml rename to plugins/gather/tasks/observer/memory.yaml diff --git a/handler/gather/tasks/observer/px_collect_log.py b/plugins/gather/tasks/observer/px_collect_log.py similarity index 97% rename from handler/gather/tasks/observer/px_collect_log.py rename to plugins/gather/tasks/observer/px_collect_log.py index 03b4fa75..6ae19a91 100644 --- a/handler/gather/tasks/observer/px_collect_log.py +++ b/plugins/gather/tasks/observer/px_collect_log.py @@ -15,12 +15,11 @@ @file: px_collect_log.py @desc: """ -import os import shutil -from common.ssh_client.ssh import SshClient -from handler.gather.gather_component_log import GatherComponentLogHandler -from common.command import uzip_dir_local, analyze_log_get_sqc_addr, find_home_path_by_port +from src.common.ssh_client.ssh import SshClient +from src.handler.gather.gather_component_log import GatherComponentLogHandler +from src.common.command import uzip_dir_local, analyze_log_get_sqc_addr, find_home_path_by_port import datetime diff --git a/handler/gather/tasks/observer/recovery.yaml b/plugins/gather/tasks/observer/recovery.yaml similarity index 100% rename from handler/gather/tasks/observer/recovery.yaml rename to plugins/gather/tasks/observer/recovery.yaml diff --git a/handler/gather/tasks/observer/restart.yaml b/plugins/gather/tasks/observer/restart.yaml similarity index 100% rename from handler/gather/tasks/observer/restart.yaml rename to plugins/gather/tasks/observer/restart.yaml diff --git a/handler/gather/tasks/observer/rootservice_switch.yaml b/plugins/gather/tasks/observer/rootservice_switch.yaml similarity index 100% rename from handler/gather/tasks/observer/rootservice_switch.yaml rename to plugins/gather/tasks/observer/rootservice_switch.yaml diff --git a/handler/gather/tasks/observer/sql_problem.py b/plugins/gather/tasks/observer/sql_problem.py similarity index 94% rename from handler/gather/tasks/observer/sql_problem.py rename to plugins/gather/tasks/observer/sql_problem.py index 0d0f0352..75416cc6 100644 --- a/handler/gather/tasks/observer/sql_problem.py +++ b/plugins/gather/tasks/observer/sql_problem.py @@ -15,12 +15,12 @@ @file: sql_problem.py @desc: """ -from handler.gather.gather_component_log import GatherComponentLogHandler -from stdio import SafeStdio -from handler.gather.gather_plan_monitor import GatherPlanMonitorHandler -from common.tool import StringUtils -from common.ssh_client.ssh import SshClient -from common.command import find_home_path_by_port +from src.handler.gather.gather_component_log import GatherComponentLogHandler +from src.common.stdio import SafeStdio +from src.handler.gather.gather_plan_monitor import GatherPlanMonitorHandler +from src.common.tool import StringUtils +from src.common.ssh_client.ssh import SshClient +from src.common.command import find_home_path_by_port class SQLProblem(SafeStdio): diff --git a/handler/gather/tasks/observer/suspend_transaction.yaml b/plugins/gather/tasks/observer/suspend_transaction.yaml similarity index 100% rename from handler/gather/tasks/observer/suspend_transaction.yaml rename to plugins/gather/tasks/observer/suspend_transaction.yaml diff --git a/handler/gather/tasks/observer/unit_data_imbalance.yaml b/plugins/gather/tasks/observer/unit_data_imbalance.yaml similarity index 100% rename from handler/gather/tasks/observer/unit_data_imbalance.yaml rename to plugins/gather/tasks/observer/unit_data_imbalance.yaml diff --git a/handler/gather/tasks/observer/unknown.yaml b/plugins/gather/tasks/observer/unknown.yaml similarity index 100% rename from handler/gather/tasks/observer/unknown.yaml rename to plugins/gather/tasks/observer/unknown.yaml diff --git a/handler/gather/tasks/other/application_error.yaml b/plugins/gather/tasks/other/application_error.yaml similarity index 100% rename from handler/gather/tasks/other/application_error.yaml rename to plugins/gather/tasks/other/application_error.yaml diff --git a/handler/rca/scene/clog_disk_full.py b/plugins/rca/clog_disk_full.py similarity index 99% rename from handler/rca/scene/clog_disk_full.py rename to plugins/rca/clog_disk_full.py index 65bb50aa..10423419 100644 --- a/handler/rca/scene/clog_disk_full.py +++ b/plugins/rca/clog_disk_full.py @@ -19,9 +19,9 @@ import os import re -from handler.rca.rca_exception import RCAInitException, RCAExecuteException, RCANotNeedExecuteException -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_exception import RCAInitException, RCAExecuteException, RCANotNeedExecuteException +from src.handler.rca.rca_handler import RcaScene, RCA_ResultRecord +from src.common.tool import StringUtils class ClogDiskFullScene(RcaScene): diff --git a/handler/rca/scene/ddl_disk_full.py b/plugins/rca/ddl_disk_full.py similarity index 98% rename from handler/rca/scene/ddl_disk_full.py rename to plugins/rca/ddl_disk_full.py index 60f57574..9f7e7e12 100644 --- a/handler/rca/scene/ddl_disk_full.py +++ b/plugins/rca/ddl_disk_full.py @@ -16,9 +16,9 @@ @desc: """ -from handler.rca.rca_exception import RCAInitException, RCAExecuteException -from handler.rca.rca_handler import RcaScene -from common.tool import StringUtils +from src.handler.rca.rca_exception import RCAInitException, RCAExecuteException +from src.handler.rca.rca_handler import RcaScene +from src.common.tool import StringUtils def translate_byte(B): diff --git a/handler/rca/scene/ddl_failure.py b/plugins/rca/ddl_failure.py similarity index 96% rename from handler/rca/scene/ddl_failure.py rename to plugins/rca/ddl_failure.py index 6420a267..ed0cc485 100644 --- a/handler/rca/scene/ddl_failure.py +++ b/plugins/rca/ddl_failure.py @@ -15,13 +15,11 @@ @file: ddl_failure_scene.py @desc: """ -import datetime import os -import re -from handler.rca.rca_exception import RCAInitException, RCAExecuteException, RCANotNeedExecuteException -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_exception import RCAInitException, RCAExecuteException, RCANotNeedExecuteException +from src.handler.rca.rca_handler import RcaScene, RCA_ResultRecord +from src.common.tool import StringUtils class DDLFailureScene(RcaScene): diff --git a/handler/rca/scene/disconnection.py b/plugins/rca/disconnection.py similarity index 99% rename from handler/rca/scene/disconnection.py rename to plugins/rca/disconnection.py index f7904e93..89791365 100644 --- a/handler/rca/scene/disconnection.py +++ b/plugins/rca/disconnection.py @@ -16,8 +16,8 @@ @desc: """ import re -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_handler import RcaScene, RCA_ResultRecord +from src.common.tool import StringUtils class DisconnectionScene(RcaScene): diff --git a/handler/rca/scene/index_ddl_error.py b/plugins/rca/index_ddl_error.py similarity index 98% rename from handler/rca/scene/index_ddl_error.py rename to plugins/rca/index_ddl_error.py index e9ffc39e..88157fdd 100644 --- a/handler/rca/scene/index_ddl_error.py +++ b/plugins/rca/index_ddl_error.py @@ -15,11 +15,10 @@ @file: index_ddl_error_scene.py @desc: """ -import re -from handler.rca.rca_exception import RCAInitException, RCAExecuteException -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_exception import RCAInitException, RCAExecuteException +from src.handler.rca.rca_handler import RcaScene, RCA_ResultRecord +from src.common.tool import StringUtils class IndexDDLErrorScene(RcaScene): diff --git a/handler/rca/scene/lock_conflict.py b/plugins/rca/lock_conflict.py similarity index 98% rename from handler/rca/scene/lock_conflict.py rename to plugins/rca/lock_conflict.py index ecdb6020..57338c67 100644 --- a/handler/rca/scene/lock_conflict.py +++ b/plugins/rca/lock_conflict.py @@ -16,9 +16,9 @@ @desc: """ import json -from handler.rca.rca_exception import RCAInitException, RCANotNeedExecuteException -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils, DateTimeEncoder +from src.handler.rca.rca_exception import RCAInitException, RCANotNeedExecuteException +from src.handler.rca.rca_handler import RcaScene, RCA_ResultRecord +from src.common.tool import StringUtils, DateTimeEncoder class LockConflictScene(RcaScene): diff --git a/handler/rca/scene/log_error.py b/plugins/rca/log_error.py similarity index 98% rename from handler/rca/scene/log_error.py rename to plugins/rca/log_error.py index 1d677b5c..6c41d189 100644 --- a/handler/rca/scene/log_error.py +++ b/plugins/rca/log_error.py @@ -18,9 +18,9 @@ import os import re -from handler.rca.rca_exception import RCAInitException, RCAExecuteException -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_exception import RCAInitException, RCAExecuteException +from src.handler.rca.rca_handler import RcaScene, RCA_ResultRecord +from src.common.tool import StringUtils class LogErrorScene(RcaScene): diff --git a/handler/rca/scene/major_hold.py b/plugins/rca/major_hold.py similarity index 99% rename from handler/rca/scene/major_hold.py rename to plugins/rca/major_hold.py index 01603187..5f60fa45 100644 --- a/handler/rca/scene/major_hold.py +++ b/plugins/rca/major_hold.py @@ -18,14 +18,14 @@ import json import os.path import re -from handler.rca.rca_exception import ( +from src.handler.rca.rca_exception import ( RCAInitException, RCAExecuteException, RCANotNeedExecuteException, ) -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import DateTimeEncoder -from common.tool import StringUtils +from src.handler.rca.rca_handler import RcaScene, RCA_ResultRecord +from src.common.tool import DateTimeEncoder +from src.common.tool import StringUtils class MajorHoldScene(RcaScene): diff --git a/handler/rca/scene/oms_full_trans.py b/plugins/rca/oms_full_trans.py similarity index 98% rename from handler/rca/scene/oms_full_trans.py rename to plugins/rca/oms_full_trans.py index ebb41077..27b2b8c0 100644 --- a/handler/rca/scene/oms_full_trans.py +++ b/plugins/rca/oms_full_trans.py @@ -17,11 +17,11 @@ """ import os.path -from handler.rca.rca_exception import ( +from src.handler.rca.rca_exception import ( RCAInitException, RCAExecuteException, ) -from handler.rca.rca_handler import RcaScene +from src.handler.rca.rca_handler import RcaScene class OMSFullTransScene(RcaScene): diff --git a/handler/rca/scene/transaction_disconnection.py b/plugins/rca/transaction_disconnection.py similarity index 97% rename from handler/rca/scene/transaction_disconnection.py rename to plugins/rca/transaction_disconnection.py index fd38b9ed..ee9b1e9d 100644 --- a/handler/rca/scene/transaction_disconnection.py +++ b/plugins/rca/transaction_disconnection.py @@ -18,9 +18,9 @@ import os import re -from handler.rca.rca_exception import RCAInitException -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_exception import RCAInitException +from src.handler.rca.rca_handler import RcaScene +from src.common.tool import StringUtils class TransactionDisconnectionScene(RcaScene): diff --git a/handler/rca/scene/transaction_execute_timeout.py b/plugins/rca/transaction_execute_timeout.py similarity index 98% rename from handler/rca/scene/transaction_execute_timeout.py rename to plugins/rca/transaction_execute_timeout.py index e0be5ed1..c2d8b9fb 100644 --- a/handler/rca/scene/transaction_execute_timeout.py +++ b/plugins/rca/transaction_execute_timeout.py @@ -15,17 +15,15 @@ @file: transaction_execute_timeout_scene.py @desc: """ -import datetime import os import re -from handler.rca.rca_exception import ( +from src.handler.rca.rca_exception import ( RCAInitException, RCAExecuteException, - RCANotNeedExecuteException, ) -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_handler import RcaScene +from src.common.tool import StringUtils class TransactionExecuteTimeoutScene(RcaScene): diff --git a/handler/rca/scene/transaction_not_ending.py b/plugins/rca/transaction_not_ending.py similarity index 97% rename from handler/rca/scene/transaction_not_ending.py rename to plugins/rca/transaction_not_ending.py index 23a83a04..443efad8 100644 --- a/handler/rca/scene/transaction_not_ending.py +++ b/plugins/rca/transaction_not_ending.py @@ -15,17 +15,15 @@ @file: transaction_not_ending_scene.py @desc: """ -import datetime import os -import re -from handler.rca.rca_exception import ( +from src.handler.rca.rca_exception import ( RCAInitException, RCAExecuteException, RCANotNeedExecuteException, ) -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_handler import RcaScene +from src.common.tool import StringUtils class TransactionNotEndingScene(RcaScene): diff --git a/handler/rca/scene/transaction_other_error.py b/plugins/rca/transaction_other_error.py similarity index 97% rename from handler/rca/scene/transaction_other_error.py rename to plugins/rca/transaction_other_error.py index 769ac2e1..fa912b70 100644 --- a/handler/rca/scene/transaction_other_error.py +++ b/plugins/rca/transaction_other_error.py @@ -17,13 +17,13 @@ """ import os -from handler.rca.rca_exception import ( +from src.handler.rca.rca_exception import ( RCAInitException, RCAExecuteException, RCANotNeedExecuteException, ) -from handler.rca.rca_handler import RcaScene -from common.tool import StringUtils +from src.handler.rca.rca_handler import RcaScene +from src.common.tool import StringUtils class TransactionOtherErrorScene(RcaScene): diff --git a/handler/rca/scene/transaction_rollback.py b/plugins/rca/transaction_rollback.py similarity index 97% rename from handler/rca/scene/transaction_rollback.py rename to plugins/rca/transaction_rollback.py index c7cbfe85..ac5ecbec 100644 --- a/handler/rca/scene/transaction_rollback.py +++ b/plugins/rca/transaction_rollback.py @@ -19,13 +19,12 @@ import os import re -from handler.rca.rca_exception import ( +from src.handler.rca.rca_exception import ( RCAInitException, RCAExecuteException, - RCANotNeedExecuteException, ) -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_handler import RcaScene +from src.common.tool import StringUtils class TransactionRollbackScene(RcaScene): diff --git a/handler/rca/scene/transaction_wait_timeout.py b/plugins/rca/transaction_wait_timeout.py similarity index 98% rename from handler/rca/scene/transaction_wait_timeout.py rename to plugins/rca/transaction_wait_timeout.py index 3a0816dd..30901b91 100644 --- a/handler/rca/scene/transaction_wait_timeout.py +++ b/plugins/rca/transaction_wait_timeout.py @@ -18,13 +18,13 @@ import os import re -from handler.rca.rca_exception import ( +from src.handler.rca.rca_exception import ( RCAInitException, RCAExecuteException, RCANotNeedExecuteException, ) -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord -from common.tool import StringUtils +from src.handler.rca.rca_handler import RcaScene +from src.common.tool import StringUtils class TransactionWaitTimeoutScene(RcaScene): diff --git a/rpm/build.sh b/rpm/build.sh deleted file mode 100755 index 0cbd886d..00000000 --- a/rpm/build.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env bash - -python_bin='python' -W_DIR=`pwd` -VERSION=${VERSION:-'3.0.0'} - - -function python_version() -{ - return `$python_bin -c 'import sys; print (sys.version_info.major)'` -} - -function ispy3() -{ - python_version - if [ $? != 3 ]; then - echo "No switch command is provided, so use the default switch command: 'source py-env-activate py38'" - source py-env-activate py38 - fi -} - -function ispy2() -{ - python_version - if [ $? != 2 ]; then - echo 'need python2' - exit 1 - fi -} - -function cd2workdir() -{ - cd $W_DIR - DIR=`dirname $0` - cd $DIR -} - -function pacakge_obdiag() -{ - ispy3 - cd2workdir - DIR=`pwd` - RELEASE=${RELEASE:-'1'} - export RELEASE=$RELEASE - export VERSION=$VERSION - pip install -r ../requirements3.txt - rm -fr rpmbuild - mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - rpmbuild --define "_topdir $DIR/rpmbuild" -bb oceanbase-diagnostic-tool.spec - rpms=`find rpmbuild/RPMS/ -name oceanbase-diagnostic-tool-\*` || exit 1 - for rpm in ${rpms[@]}; do - cp $rpm ./ - done - rm -fr rpmbuild -} - -function get_python() -{ - if [ `id -u` != 0 ] ; then - echo "Please use root to run" - fi - - obd_dir=`dirname $0` - python_path=`which python` - for bin in ${python_path[@]}; do - if [ -e $bin ]; then - python_bin=$bin - break 1 - fi - done - - if [ ${#python_path[*]} -gt 1 ]; then - read -p "Enter python path [default $python_bin]:" - if [ "x$REPLY" != "x" ]; then - python_bin=$REPLY - fi - fi -} - -function build() -{ - ispy3 - req_fn='requirements3' - cd2workdir - DIR=`pwd` - cd .. - if [ `git log |head -n1 | awk -F' ' '{print $2}'` ]; then - CID=`git log |head -n1 | awk -F' ' '{print $2}'` - BRANCH=`git rev-parse --abbrev-ref HEAD` - else - CID='UNKNOWN' - BRANCH='UNKNOWN' - fi - DATE=`date '+%b %d %Y %H:%M:%S'` - VERSION="$VERSION".`date +%s` - BUILD_DIR="$DIR/.build" - rm -fr $BUILD_DIR - mkdir -p $BUILD_DIR/lib/site-packages - cp -f obdiag_main.py obdiag.py - pip install -r $req_fn.txt || exit 1 - rm -f obdiag.py oceanbase-diagnostic-tool.spec - chmod +x /usr/bin/obdiag - chmod -R 755 /usr/obdiag/* - chown -R root:root /usr/obdiag/* - find /usr/obdiag -type f -exec chmod 644 {} \; - echo -e 'Installation of obdiag finished successfully\n' -} - -case "x$1" in - xrpm_obdiag) - pacakge_obdiag - ;; - xbuild) - get_python - build - ;; -esac diff --git a/init.sh b/rpm/init.sh similarity index 61% rename from init.sh rename to rpm/init.sh index 2e9b09b2..53599660 100755 --- a/init.sh +++ b/rpm/init.sh @@ -18,25 +18,8 @@ mkdir -p ${OBDIAG_HOME} && cd ${OBDIAG_HOME} mkdir -p ${OBDIAG_HOME}/check mkdir -p ${OBDIAG_HOME}/log mkdir -p ${OBDIAG_HOME}/display -if [ -d "${WORK_DIR}/check" ]; then - cp -rf ${WORK_DIR}/check ${OBDIAG_HOME}/ -fi - -if [ -d "${WORK_DIR}/gather" ]; then - cp -rf ${WORK_DIR}/gather ${OBDIAG_HOME}/ -fi - -if [ -d "${WORK_DIR}/example" ]; then - cp -rf ${WORK_DIR}/example ${OBDIAG_HOME}/ -fi +cp -rf ${WORK_DIR}/plugins/* ${OBDIAG_HOME}/ -if [ -d "${WORK_DIR}/rca" ]; then - cp -rf ${WORK_DIR}/rca ${OBDIAG_HOME}/ -fi - -if [ -d "${WORK_DIR}/display" ]; then - cp -rf ${WORK_DIR}/display ${OBDIAG_HOME}/ -fi ALIAS_OBDIAG_EXIST=$(grep "alias obdiag='sh" ~/.bashrc | head -n 1) if [[ "${ALIAS_OBDIAG_EXIST}" != "" ]]; then @@ -46,10 +29,6 @@ fi source ${WORK_DIR}/init_obdiag_cmd.sh -if [ -d "${OBDIAG_HOME}/check_package.yaml" ]; then - echo "${OBDIAG_HOME}/*check_package.yaml and ${OBDIAG_HOME}/tasks has been discarded. If you have made any changes to these files on your own, please transfer the relevant data to *check_package.yaml in ${OBDIAG_HOME}/check/" -fi - cd - output_file=${OBDIAG_HOME}/version.yaml version_line=$(/usr/local/oceanbase-diagnostic-tool/obdiag --version 2>&1 | grep -oP 'OceanBase Diagnostic Tool: \K[\d.]+') diff --git a/init_obdiag_cmd.sh b/rpm/init_obdiag_cmd.sh similarity index 100% rename from init_obdiag_cmd.sh rename to rpm/init_obdiag_cmd.sh diff --git a/rpm/obdiag-build.sh b/rpm/obdiag-build.sh deleted file mode 100755 index facb3e6b..00000000 --- a/rpm/obdiag-build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -PROJECT_DIR=$1 -PROJECT_NAME=$2 -VERSION=$3 -RELEASE=$4 -PYTHON3_SWITCH=$5 - -if [[ x"$PYTHON3_SWITCH" == x"" ]]; then - echo "No switch command is provided, so use the default switch command: 'source py-env-activate py38'" - PYTHON3_SWITCH="source py-env-activate py38" -fi - -CURDIR=$PWD -DIR=`dirname $0` -cd $DIR - -echo "[BUILD] args: CURDIR=${CURDIR} PROJECT_NAME=${PROJECT_NAME} VERSION=${VERSION} RELEASE=${RELEASE}" - -export PROJECT_NAME=${PROJECT_NAME} -export VERSION=${VERSION} -export RELEASE=${RELEASE} -eval "./build.sh rpm '$PYTHON3_SWITCH'" diff --git a/obdiag_backup.sh b/rpm/obdiag_backup.sh similarity index 100% rename from obdiag_backup.sh rename to rpm/obdiag_backup.sh diff --git a/rpm/oceanbase-diagnostic-tool.spec b/rpm/oceanbase-diagnostic-tool.spec index 160ef8b6..1af12869 100644 --- a/rpm/oceanbase-diagnostic-tool.spec +++ b/rpm/oceanbase-diagnostic-tool.spec @@ -26,42 +26,31 @@ VERSION="$RPM_PACKAGE_VERSION" cd $SRC_DIR pwd pip install -r requirements3.txt -cp -f main.py obdiag.py +cp -f src/main.py src/obdiag.py sed -i "s//$DATE/" ./common/version.py && sed -i "s//$VERSION/" ./common/version.py mkdir -p $BUILD_DIR/SOURCES ${RPM_BUILD_ROOT} mkdir -p $BUILD_DIR/SOURCES/site-packages mkdir -p $BUILD_DIR/SOURCES/resources -mkdir -p $BUILD_DIR/SOURCES/check/tasks -mkdir -p $BUILD_DIR/SOURCES/gather/tasks -mkdir -p $BUILD_DIR/SOURCES/display/tasks -mkdir -p $BUILD_DIR/SOURCES/rca -mkdir -p $BUILD_DIR/SOURCES/gather/redact mkdir -p $BUILD_DIR/SOURCES/dependencies/bin mkdir -p ${RPM_BUILD_ROOT}/usr/bin mkdir -p ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool +cd src pyinstaller --hidden-import=decimal -p $BUILD_DIR/SOURCES/site-packages -F obdiag.py rm -f obdiag.py oceanbase-diagnostic-tool.spec +cd $SRC_DIR \cp -rf $SRC_DIR/example $BUILD_DIR/SOURCES/example \cp -rf $SRC_DIR/resources $BUILD_DIR/SOURCES/ \cp -rf $SRC_DIR/dependencies/bin $BUILD_DIR/SOURCES/dependencies -\cp -rf $SRC_DIR/handler/checker/tasks $BUILD_DIR/SOURCES/check -\cp -rf $SRC_DIR/handler/gather/tasks $BUILD_DIR/SOURCES/gather -\cp -rf $SRC_DIR/handler/rca/scene/* $BUILD_DIR/SOURCES/rca -\cp -rf $SRC_DIR/handler/display/tasks $BUILD_DIR/SOURCES/display -\cp -rf $SRC_DIR/handler/gather/plugins/redact/*.py $BUILD_DIR/SOURCES/gather/redact -\cp -rf $SRC_DIR/init.sh $BUILD_DIR/SOURCES/init.sh -\cp -rf $SRC_DIR/init_obdiag_cmd.sh $BUILD_DIR/SOURCES/init_obdiag_cmd.sh -\cp -rf $SRC_DIR/obdiag_backup.sh $BUILD_DIR/SOURCES/obdiag_backup.sh +\cp -rf $SRC_DIR/plugins $BUILD_DIR/plugins +\cp -rf $SRC_DIR/rpm/init.sh $BUILD_DIR/SOURCES/init.sh +\cp -rf $SRC_DIR/rpm/init_obdiag_cmd.sh $BUILD_DIR/SOURCES/init_obdiag_cmd.sh +\cp -rf $SRC_DIR/rpm/obdiag_backup.sh $BUILD_DIR/SOURCES/obdiag_backup.sh \cp -rf $SRC_DIR/conf $BUILD_DIR/SOURCES/conf mkdir -p ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/lib/ mkdir -p ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/dependencies/bin -mkdir -p ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/gather -mkdir -p ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/check -mkdir -p ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/rca -mkdir -p ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/display - -\cp -rf $SRC_DIR/dist/obdiag ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/obdiag +find $SRC_DIR -name "obdiag" +\cp -rf $SRC_DIR/src/dist/obdiag ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/obdiag \cp -rf $BUILD_DIR/SOURCES/site-packages ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/lib/site-packages \cp -rf $BUILD_DIR/SOURCES/resources ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/resources \cp -rf $BUILD_DIR/SOURCES/dependencies/bin ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/dependencies @@ -70,12 +59,7 @@ mkdir -p ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/display \cp -rf $BUILD_DIR/SOURCES/init.sh ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/ \cp -rf $BUILD_DIR/SOURCES/init_obdiag_cmd.sh ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/ \cp -rf $BUILD_DIR/SOURCES/obdiag_backup.sh ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/ -\cp -rf $BUILD_DIR/SOURCES/check/* ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/check -mv ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/check/tasks/*.yaml ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/check/ -\cp -rf $BUILD_DIR/SOURCES/gather/tasks ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/gather -\cp -rf $BUILD_DIR/SOURCES/rca/* ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/rca -\cp -rf $BUILD_DIR/SOURCES/display/tasks ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/display -\cp -rf $BUILD_DIR/SOURCES/gather/redact ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/gather +\cp -rf $BUILD_DIR/plugins ${RPM_BUILD_ROOT}/usr/local/oceanbase-diagnostic-tool/ %files diff --git a/common/__init__.py b/src/common/__init__.py similarity index 100% rename from common/__init__.py rename to src/common/__init__.py diff --git a/common/command.py b/src/common/command.py similarity index 99% rename from common/command.py rename to src/common/command.py index 71755cfe..76edca2c 100644 --- a/common/command.py +++ b/src/common/command.py @@ -18,9 +18,9 @@ import re import subprocess import traceback -from common.ob_connector import OBConnector -from common.ssh_client.ssh import SshClient -from common.tool import TimeUtils +from src.common.ob_connector import OBConnector +from src.common.ssh_client.ssh import SshClient +from src.common.tool import TimeUtils class LocalClient(object): diff --git a/config.py b/src/common/config.py similarity index 99% rename from config.py rename to src/common/config.py index fd871781..6f66154a 100644 --- a/config.py +++ b/src/common/config.py @@ -17,7 +17,7 @@ from __future__ import absolute_import, division, print_function import os -from common.tool import ConfigOptionsParserUtil, DirectoryUtil +from src.common.tool import ConfigOptionsParserUtil, DirectoryUtil from stdio import SafeStdio import oyaml as yaml import pathlib diff --git a/common/config_helper.py b/src/common/config_helper.py similarity index 98% rename from common/config_helper.py rename to src/common/config_helper.py index dbf2b030..7c3bb616 100644 --- a/common/config_helper.py +++ b/src/common/config_helper.py @@ -21,15 +21,15 @@ from collections import OrderedDict import yaml -from common.command import get_observer_version -from common.constant import const -from common.ob_connector import OBConnector -from common.ssh_client.base import SsherClient -from common.tool import DirectoryUtil -from common.tool import TimeUtils -from common.tool import StringUtils -from common.tool import YamlUtils -from common.tool import Util +from src.common.command import get_observer_version +from src.common.constant import const +from src.common.ob_connector import OBConnector +from src.common.ssh_client.base import SsherClient +from src.common.tool import DirectoryUtil +from src.common.tool import TimeUtils +from src.common.tool import StringUtils +from src.common.tool import YamlUtils +from src.common.tool import Util class ConfigHelper(object): diff --git a/common/constant.py b/src/common/constant.py similarity index 100% rename from common/constant.py rename to src/common/constant.py diff --git a/context.py b/src/common/context.py similarity index 100% rename from context.py rename to src/common/context.py diff --git a/core.py b/src/common/core.py similarity index 92% rename from core.py rename to src/common/core.py index 0a2e0c80..c0d2caee 100644 --- a/core.py +++ b/src/common/core.py @@ -22,48 +22,48 @@ from optparse import Values from copy import copy -from common.ssh_client.remote_client import dis_rsa_algorithms -from handler.gather.gather_ash_report import GatherAshReportHandler -from handler.gather.gather_component_log import GatherComponentLogHandler -from handler.rca.rca_handler import RCAHandler -from handler.rca.rca_list import RcaScenesListHandler -from common.ssh import SshClient, SshConfig +from src.common.ssh_client.remote_client import dis_rsa_algorithms +from src.handler.gather.gather_ash_report import GatherAshReportHandler +from src.handler.gather.gather_component_log import GatherComponentLogHandler +from src.handler.rca.rca_handler import RCAHandler +from src.handler.rca.rca_list import RcaScenesListHandler +from src.common.ssh import SshClient, SshConfig from context import HandlerContextNamespace, HandlerContext from config import ConfigManager, InnerConfigManager from err import CheckStatus, SUG_SSH_FAILED -from handler.analyzer.analyze_flt_trace import AnalyzeFltTraceHandler -from handler.analyzer.analyze_log import AnalyzeLogHandler -from handler.analyzer.analyze_sql import AnalyzeSQLHandler -from handler.analyzer.analyze_sql_review import AnalyzeSQLReviewHandler -from handler.analyzer.analyze_parameter import AnalyzeParameterHandler -from handler.analyzer.analyze_variable import AnalyzeVariableHandler -from handler.analyzer.analyze_memory import AnalyzeMemoryHandler -from handler.analyzer.analyze_index_space import AnalyzeIndexSpaceHandler -from handler.checker.check_handler import CheckHandler -from handler.checker.check_list import CheckListHandler -from handler.gather.gather_awr import GatherAwrHandler -from handler.gather.gather_sysstat import GatherOsInfoHandler -from handler.gather.gather_obstack2 import GatherObstack2Handler -from handler.gather.gather_obadmin import GatherObAdminHandler -from handler.gather.gather_perf import GatherPerfHandler -from handler.gather.gather_plan_monitor import GatherPlanMonitorHandler -from handler.gather.gather_scenes import GatherSceneHandler -from handler.gather.scenes.list import GatherScenesListHandler -from handler.gather.gather_tabledump import GatherTableDumpHandler -from handler.gather.gather_parameters import GatherParametersHandler -from handler.gather.gather_variables import GatherVariablesHandler -from handler.display.display_scenes import DisplaySceneHandler -from handler.display.scenes.list import DisplayScenesListHandler +from src.handler.analyzer.analyze_flt_trace import AnalyzeFltTraceHandler +from src.handler.analyzer.analyze_log import AnalyzeLogHandler +from src.handler.analyzer.analyze_sql import AnalyzeSQLHandler +from src.handler.analyzer.analyze_sql_review import AnalyzeSQLReviewHandler +from src.handler.analyzer.analyze_parameter import AnalyzeParameterHandler +from src.handler.analyzer.analyze_variable import AnalyzeVariableHandler +from src.handler.analyzer.analyze_memory import AnalyzeMemoryHandler +from src.handler.analyzer.analyze_index_space import AnalyzeIndexSpaceHandler +from src.handler.checker.check_handler import CheckHandler +from src.handler.checker.check_list import CheckListHandler +from src.handler.gather.gather_awr import GatherAwrHandler +from src.handler.gather.gather_sysstat import GatherOsInfoHandler +from src.handler.gather.gather_obstack2 import GatherObstack2Handler +from src.handler.gather.gather_obadmin import GatherObAdminHandler +from src.handler.gather.gather_perf import GatherPerfHandler +from src.handler.gather.gather_plan_monitor import GatherPlanMonitorHandler +from src.handler.gather.gather_scenes import GatherSceneHandler +from src.handler.gather.scenes.list import GatherScenesListHandler +from src.handler.gather.gather_tabledump import GatherTableDumpHandler +from src.handler.gather.gather_parameters import GatherParametersHandler +from src.handler.gather.gather_variables import GatherVariablesHandler +from src.handler.display.display_scenes import DisplaySceneHandler +from src.handler.display.scenes.list import DisplayScenesListHandler +from src.handler.update.update import UpdateHandler from result_type import ObdiagResult -from telemetry.telemetry import telemetry -from update.update import UpdateHandler +from src.telemetry.telemetry import telemetry from colorama import Fore, Style -from common.config_helper import ConfigHelper -from handler.analyzer.analyze_queue import AnalyzeQueueHandler +from src.common.config_helper import ConfigHelper +from src.handler.analyzer.analyze_queue import AnalyzeQueueHandler -from common.tool import TimeUtils, Util -from common.command import get_observer_version_by_sql -from common.ob_connector import OBConnector +from src.common.tool import TimeUtils, Util +from src.common.command import get_observer_version_by_sql +from src.common.ob_connector import OBConnector class ObdiagHome(object): @@ -547,6 +547,7 @@ def update(self, opts): self.stdio.print("update start ...") self.set_offline_context('update', 'update') handler = UpdateHandler(self.context) + UpdateHandler.context = self.context return handler.handle() def config(self, opt): diff --git a/diag_cmd.py b/src/common/diag_cmd.py similarity index 99% rename from diag_cmd.py rename to src/common/diag_cmd.py index 58ec79bc..cdbbba2d 100644 --- a/diag_cmd.py +++ b/src/common/diag_cmd.py @@ -16,7 +16,7 @@ """ from __future__ import absolute_import, division, print_function -from common.tool import Util, StringUtils +from src.common.tool import Util, StringUtils import os import sys import textwrap @@ -27,9 +27,9 @@ from core import ObdiagHome from result_type import ObdiagResult from stdio import IO -from common.version import get_obdiag_version -from telemetry.telemetry import telemetry -from common.version import OBDIAG_VERSION +from src.common.version import get_obdiag_version +from src.telemetry.telemetry import telemetry +from src.common.version import OBDIAG_VERSION # TODO when obdiag_version ≥ 3.0, the default value of err_stream will be changed to sys.stderr ROOT_IO = IO(1, error_stream=sys.stdout) @@ -355,7 +355,7 @@ def enable_log(self): return False def _do_command(self, obdiag): - from common.ssh import LocalClient + from src.common.ssh import LocalClient if not self.cmds: return self._show_help() diff --git a/err.py b/src/common/err.py similarity index 100% rename from err.py rename to src/common/err.py diff --git a/common/import_module.py b/src/common/import_module.py similarity index 97% rename from common/import_module.py rename to src/common/import_module.py index d0caf074..97dc9863 100644 --- a/common/import_module.py +++ b/src/common/import_module.py @@ -17,7 +17,7 @@ """ import os -from common.tool import DynamicLoading +from src.common.tool import DynamicLoading class ImportModulesException(Exception): diff --git a/common/log.py b/src/common/log.py similarity index 100% rename from common/log.py rename to src/common/log.py diff --git a/common/ob_connector.py b/src/common/ob_connector.py similarity index 100% rename from common/ob_connector.py rename to src/common/ob_connector.py diff --git a/common/ob_log_level.py b/src/common/ob_log_level.py similarity index 100% rename from common/ob_log_level.py rename to src/common/ob_log_level.py diff --git a/common/ob_log_parser.py b/src/common/ob_log_parser.py similarity index 100% rename from common/ob_log_parser.py rename to src/common/ob_log_parser.py diff --git a/common/obdiag_exception.py b/src/common/obdiag_exception.py similarity index 100% rename from common/obdiag_exception.py rename to src/common/obdiag_exception.py diff --git a/common/ocp/__init__.py b/src/common/ocp/__init__.py similarity index 100% rename from common/ocp/__init__.py rename to src/common/ocp/__init__.py diff --git a/common/ocp/ocp_api.py b/src/common/ocp/ocp_api.py similarity index 100% rename from common/ocp/ocp_api.py rename to src/common/ocp/ocp_api.py diff --git a/common/ocp/ocp_task.py b/src/common/ocp/ocp_task.py similarity index 98% rename from common/ocp/ocp_task.py rename to src/common/ocp/ocp_task.py index 878f5407..5bd252f9 100644 --- a/common/ocp/ocp_task.py +++ b/src/common/ocp/ocp_task.py @@ -20,7 +20,7 @@ import time import requests -from common.ocp import ocp_api +from src.common.ocp import ocp_api logger = logging.getLogger("run") diff --git a/result_type.py b/src/common/result_type.py similarity index 100% rename from result_type.py rename to src/common/result_type.py diff --git a/common/scene.py b/src/common/scene.py similarity index 97% rename from common/scene.py rename to src/common/scene.py index c9378923..994a514f 100644 --- a/common/scene.py +++ b/src/common/scene.py @@ -15,8 +15,8 @@ @file: scene.py @desc: """ -from common.tool import StringUtils -from common.command import get_observer_version, get_obproxy_version +from src.common.tool import StringUtils +from src.common.command import get_observer_version, get_obproxy_version def filter_by_version(scene, cluster, stdio=None): diff --git a/common/ssh.py b/src/common/ssh.py similarity index 99% rename from common/ssh.py rename to src/common/ssh.py index 699d5d2c..27afdd35 100644 --- a/common/ssh.py +++ b/src/common/ssh.py @@ -29,9 +29,9 @@ from paramiko.ssh_exception import NoValidConnectionsError, SSHException from multiprocessing import Queue from multiprocessing.pool import ThreadPool -from common.tool import COMMAND_ENV, DirectoryUtil, FileUtil, Timeout -from stdio import SafeStdio -from err import EC_SSH_CONNECT +from src.common.tool import COMMAND_ENV, DirectoryUtil, FileUtil, Timeout +from src.common.stdio import SafeStdio +from src.common.err import EC_SSH_CONNECT from subprocess import Popen, PIPE warnings.filterwarnings("ignore") diff --git a/common/ssh_client/__init__.py b/src/common/ssh_client/__init__.py similarity index 100% rename from common/ssh_client/__init__.py rename to src/common/ssh_client/__init__.py diff --git a/common/ssh_client/base.py b/src/common/ssh_client/base.py similarity index 98% rename from common/ssh_client/base.py rename to src/common/ssh_client/base.py index 5b6f9a5b..7d3013a9 100644 --- a/common/ssh_client/base.py +++ b/src/common/ssh_client/base.py @@ -17,7 +17,7 @@ """ import sys -from stdio import SafeStdio +from src.common.stdio import SafeStdio class SsherClient(SafeStdio): diff --git a/common/ssh_client/docker_client.py b/src/common/ssh_client/docker_client.py similarity index 96% rename from common/ssh_client/docker_client.py rename to src/common/ssh_client/docker_client.py index 6a74a97a..c4f0d1b1 100644 --- a/common/ssh_client/docker_client.py +++ b/src/common/ssh_client/docker_client.py @@ -17,8 +17,8 @@ """ import docker -from common.obdiag_exception import OBDIAGShellCmdException -from common.ssh_client.base import SsherClient +from src.common.obdiag_exception import OBDIAGShellCmdException +from src.common.ssh_client.base import SsherClient class DockerClient(SsherClient): diff --git a/common/ssh_client/kubernetes_client.py b/src/common/ssh_client/kubernetes_client.py similarity index 99% rename from common/ssh_client/kubernetes_client.py rename to src/common/ssh_client/kubernetes_client.py index 04833195..8c9d3a92 100644 --- a/common/ssh_client/kubernetes_client.py +++ b/src/common/ssh_client/kubernetes_client.py @@ -16,7 +16,7 @@ @desc: """ -from common.ssh_client.base import SsherClient +from src.common.ssh_client.base import SsherClient from kubernetes import client, config from kubernetes.stream import stream diff --git a/common/ssh_client/local_client.py b/src/common/ssh_client/local_client.py similarity index 98% rename from common/ssh_client/local_client.py rename to src/common/ssh_client/local_client.py index 59797e9f..5636c6e7 100644 --- a/common/ssh_client/local_client.py +++ b/src/common/ssh_client/local_client.py @@ -16,7 +16,7 @@ @desc: """ -from common.ssh_client.base import SsherClient +from src.common.ssh_client.base import SsherClient import subprocess import shutil diff --git a/common/ssh_client/remote_client.py b/src/common/ssh_client/remote_client.py similarity index 98% rename from common/ssh_client/remote_client.py rename to src/common/ssh_client/remote_client.py index 509d5f0a..e046c628 100644 --- a/common/ssh_client/remote_client.py +++ b/src/common/ssh_client/remote_client.py @@ -23,8 +23,8 @@ import time import paramiko from paramiko.ssh_exception import SSHException, AuthenticationException -from common.obdiag_exception import OBDIAGShellCmdException, OBDIAGSSHConnException -from common.ssh_client.base import SsherClient +from src.common.obdiag_exception import OBDIAGShellCmdException, OBDIAGSSHConnException +from src.common.ssh_client.base import SsherClient ENV_DISABLE_RSA_ALGORITHMS = 0 diff --git a/common/ssh_client/ssh.py b/src/common/ssh_client/ssh.py similarity index 93% rename from common/ssh_client/ssh.py rename to src/common/ssh_client/ssh.py index 69486cdc..0cae8fc3 100644 --- a/common/ssh_client/ssh.py +++ b/src/common/ssh_client/ssh.py @@ -17,11 +17,11 @@ """ import re import socket -from common.ssh_client.docker_client import DockerClient -from common.ssh_client.kubernetes_client import KubernetesClient -from common.ssh_client.local_client import LocalClient -from common.ssh_client.remote_client import RemoteClient -from stdio import SafeStdio +from src.common.ssh_client.docker_client import DockerClient +from src.common.ssh_client.kubernetes_client import KubernetesClient +from src.common.ssh_client.local_client import LocalClient +from src.common.ssh_client.remote_client import RemoteClient +from src.common.stdio import SafeStdio class SshClient(SafeStdio): diff --git a/stdio.py b/src/common/stdio.py similarity index 99% rename from stdio.py rename to src/common/stdio.py index fa547c0c..43f81d31 100644 --- a/stdio.py +++ b/src/common/stdio.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function -import json import os import signal import sys @@ -26,13 +25,13 @@ from enum import Enum from halo import Halo, cursor -from colorama import Fore, Style +from colorama import Fore from prettytable import PrettyTable from progressbar import AdaptiveETA, Bar, SimpleProgress, ETA, FileTransferSpeed, Percentage, ProgressBar from types import MethodType from inspect2 import Parameter -from common.log import Logger +from src.common.log import Logger if sys.version_info.major == 3: diff --git a/common/tool.py b/src/common/tool.py similarity index 99% rename from common/tool.py rename to src/common/tool.py index 4d47a1d5..5f7654bc 100644 --- a/common/tool.py +++ b/src/common/tool.py @@ -49,8 +49,8 @@ import copy from colorama import Fore, Style from ruamel.yaml import YAML -from err import EC_SQL_EXECUTE_FAILED -from stdio import SafeStdio +from src.common.err import EC_SQL_EXECUTE_FAILED +from src.common.stdio import SafeStdio _open = open encoding_open = open @@ -388,7 +388,7 @@ class FileUtil(object): @staticmethod def checksum(target_path, stdio=None): - from common.ssh import LocalClient + from src.common.ssh import LocalClient if not os.path.isfile(target_path): info = 'No such file: ' + target_path @@ -451,7 +451,7 @@ def copy(src, dst, stdio=None): return True except Exception as e: if int(getattr(e, 'errno', -1)) == 26: - from common.ssh import LocalClient + from src.common.ssh import LocalClient if LocalClient.execute_command('/usr/bin/cp -f %s %s' % (src, dst), stdio=stdio): return True diff --git a/common/types.py b/src/common/types.py similarity index 100% rename from common/types.py rename to src/common/types.py diff --git a/common/version.py b/src/common/version.py similarity index 100% rename from common/version.py rename to src/common/version.py diff --git a/handler/__init__.py b/src/handler/__init__.py similarity index 100% rename from handler/__init__.py rename to src/handler/__init__.py diff --git a/handler/analyzer/__init__.py b/src/handler/analyzer/__init__.py similarity index 100% rename from handler/analyzer/__init__.py rename to src/handler/analyzer/__init__.py diff --git a/handler/analyzer/analyze_flt_trace.py b/src/handler/analyzer/analyze_flt_trace.py similarity index 97% rename from handler/analyzer/analyze_flt_trace.py rename to src/handler/analyzer/analyze_flt_trace.py index c8eb25d3..5f576dc8 100644 --- a/handler/analyzer/analyze_flt_trace.py +++ b/src/handler/analyzer/analyze_flt_trace.py @@ -20,15 +20,15 @@ import sys from concurrent.futures import ProcessPoolExecutor, as_completed import traceback -from common.constant import const -from common.command import LocalClient, SshClient, delete_file -from handler.analyzer.log_parser.tree import Tree -from common.command import download_file, mkdir -from common.tool import TimeUtils -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import FileUtil -from result_type import ObdiagResult +from src.common.constant import const +from src.common.command import LocalClient, SshClient, delete_file +from src.handler.analyzer.log_parser.tree import Tree +from src.common.command import download_file, mkdir +from src.common.tool import TimeUtils +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.result_type import ObdiagResult class AnalyzeFltTraceHandler(object): diff --git a/handler/analyzer/analyze_index_space.py b/src/handler/analyzer/analyze_index_space.py similarity index 98% rename from handler/analyzer/analyze_index_space.py rename to src/handler/analyzer/analyze_index_space.py index abcc868d..c51187c6 100644 --- a/handler/analyzer/analyze_index_space.py +++ b/src/handler/analyzer/analyze_index_space.py @@ -18,10 +18,10 @@ from prettytable import PrettyTable -from common.tool import StringUtils, Util -from common.ob_connector import OBConnector -from common.command import get_observer_version -from result_type import ObdiagResult +from src.common.tool import StringUtils, Util +from src.common.ob_connector import OBConnector +from src.common.command import get_observer_version +from src.common.result_type import ObdiagResult def translate_byte(B): diff --git a/handler/analyzer/analyze_log.py b/src/handler/analyzer/analyze_log.py similarity index 96% rename from handler/analyzer/analyze_log.py rename to src/handler/analyzer/analyze_log.py index b84ef6ae..21dfee5f 100644 --- a/handler/analyzer/analyze_log.py +++ b/src/handler/analyzer/analyze_log.py @@ -23,19 +23,20 @@ import tabulate -from handler.base_shell_handler import BaseShellHandler -from common.obdiag_exception import OBDIAGFormatException -from common.constant import const -from common.command import SshClient -from common.ob_log_level import OBLogLevel -from handler.meta.ob_error import OB_RET_DICT -from common.command import download_file, get_logfile_name_list, mkdir, delete_file -from common.tool import Util, NetUtils -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import TimeUtils -import common.ssh_client.local_client as ssh_client_local_client -from result_type import ObdiagResult +from src.common.ssh_client.local_client import LocalClient +from src.handler.base_shell_handler import BaseShellHandler +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.constant import const +from src.common.command import SshClient +from src.common.ob_log_level import OBLogLevel +from src.handler.meta.ob_error import OB_RET_DICT +from src.common.command import download_file, get_logfile_name_list, mkdir, delete_file +from src.common.tool import Util, NetUtils +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import TimeUtils +from src import common as ssh_client_local_client +from src.common.result_type import ObdiagResult class AnalyzeLogHandler(BaseShellHandler): @@ -321,7 +322,7 @@ def __pharse_offline_log_file(self, ssh_client, log_name, local_store_dir): :return: """ - ssh_client = ssh_client_local_client.LocalClient(context=self.context, node={"ssh_type": "local"}) + ssh_client = LocalClient(context=self.context, node={"ssh_type": "local"}) local_store_path = "{0}/{1}".format(local_store_dir, str(log_name).strip(".").replace("/", "_")) if self.grep_args is not None: grep_cmd = "grep -e '{grep_args}' {log_name} >> {local_store_path} ".format(grep_args=self.grep_args, log_name=log_name, local_store_path=local_store_path) diff --git a/handler/analyzer/analyze_memory.py b/src/handler/analyzer/analyze_memory.py similarity index 99% rename from handler/analyzer/analyze_memory.py rename to src/handler/analyzer/analyze_memory.py index 980c438b..931b41ef 100644 --- a/handler/analyzer/analyze_memory.py +++ b/src/handler/analyzer/analyze_memory.py @@ -23,14 +23,14 @@ import tabulate import threading import uuid -import common.ssh_client.local_client as ssh_client_local_client -from common.command import get_observer_version_by_sql -from common.tool import DirectoryUtil, TimeUtils, Util, NetUtils, FileUtil -from common.obdiag_exception import OBDIAGFormatException -from common.constant import const -from common.command import download_file, get_logfile_name_list, mkdir, delete_file -from common.command import SshClient -from result_type import ObdiagResult +from src import common as ssh_client_local_client +from src.common.command import get_observer_version_by_sql +from src.common.tool import DirectoryUtil, TimeUtils, Util, NetUtils, FileUtil +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.constant import const +from src.common.command import download_file, get_logfile_name_list, mkdir, delete_file +from src.common.command import SshClient +from src.common.result_type import ObdiagResult class AnalyzeMemoryHandler(object): diff --git a/handler/analyzer/analyze_parameter.py b/src/handler/analyzer/analyze_parameter.py similarity index 98% rename from handler/analyzer/analyze_parameter.py rename to src/handler/analyzer/analyze_parameter.py index 7f8df5d3..5fbd185f 100644 --- a/handler/analyzer/analyze_parameter.py +++ b/src/handler/analyzer/analyze_parameter.py @@ -16,17 +16,17 @@ @desc: """ import os -from common.command import get_observer_version_by_sql -from common.tool import DirectoryUtil, TimeUtils, Util, StringUtils -from common.obdiag_exception import OBDIAGFormatException -from common.ob_connector import OBConnector +from src.common.command import get_observer_version_by_sql +from src.common.tool import DirectoryUtil, TimeUtils, Util, StringUtils +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.ob_connector import OBConnector import csv from prettytable import PrettyTable import json import datetime from colorama import Fore, Style -from result_type import ObdiagResult +from src.common.result_type import ObdiagResult class AnalyzeParameterHandler(object): diff --git a/handler/analyzer/analyze_queue.py b/src/handler/analyzer/analyze_queue.py similarity index 95% rename from handler/analyzer/analyze_queue.py rename to src/handler/analyzer/analyze_queue.py index 6a0b721d..4aebb723 100644 --- a/handler/analyzer/analyze_queue.py +++ b/src/handler/analyzer/analyze_queue.py @@ -19,22 +19,21 @@ import os import csv from tabulate import tabulate -from common.command import get_observer_version_by_sql -from handler.base_shell_handler import BaseShellHandler -from common.obdiag_exception import OBDIAGFormatException, OBDIAGDBConnException -from common.constant import const -from common.command import SshClient -from common.ob_log_level import OBLogLevel -from common.command import download_file, get_logfile_name_list, mkdir, delete_file -from common.tool import StringUtils -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import TimeUtils -import common.ssh_client.local_client as ssh_client_local_client -from result_type import ObdiagResult - -from common.ob_connector import OBConnector +from src.common.command import get_observer_version_by_sql +from src.common.ssh_client.local_client import LocalClient +from src.handler.base_shell_handler import BaseShellHandler +from src.common.obdiag_exception import OBDIAGFormatException, OBDIAGDBConnException +from src.common.constant import const +from src.common.command import SshClient +from src.common.ob_log_level import OBLogLevel +from src.common.command import download_file, get_logfile_name_list, mkdir, delete_file +from src.common.tool import StringUtils +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import TimeUtils +from src.common.result_type import ObdiagResult +from src.common.ob_connector import OBConnector import re @@ -342,7 +341,7 @@ def __pharse_offline_log_file(self, ssh_client, log_name, local_store_dir): :return: """ - ssh_client = ssh_client_local_client.LocalClient(context=self.context, node={"ssh_type": "local"}) + ssh_client = LocalClient(context=self.context, node={"ssh_type": "local"}) local_store_path = "{0}/{1}".format(local_store_dir, str(log_name).strip(".").replace("/", "_")) grep_cmd = "grep -e 'dump tenant info(tenant={id:{tenant_id},' {log_name} >> {local_store_path} ".format(tenant_id=self.tenant_id, log_name=log_name, local_store_path=local_store_path) self.stdio.verbose("grep files, run cmd = [{0}]".format(grep_cmd)) diff --git a/handler/analyzer/analyze_sql.py b/src/handler/analyzer/analyze_sql.py similarity index 96% rename from handler/analyzer/analyze_sql.py rename to src/handler/analyzer/analyze_sql.py index 98cb38ef..5cd7a43b 100644 --- a/handler/analyzer/analyze_sql.py +++ b/src/handler/analyzer/analyze_sql.py @@ -19,18 +19,18 @@ import time import os from tabulate import tabulate -from common.constant import const -from common.tool import StringUtils, Util -from common.tool import TimeUtils -from common.ob_connector import OBConnector -from handler.meta.sql_meta import GlobalSqlMeta -from handler.meta.html_meta import GlobalHtmlMeta -from common.tool import FileUtil -from handler.analyzer.sql.rule_manager import SQLReviewRuleManager -from handler.analyzer.sql.meta.sys_tenant_meta import SysTenantMeta -from handler.gather.gather_scenes import GatherSceneHandler -from common.command import get_observer_version -from result_type import ObdiagResult +from src.common.constant import const +from src.common.tool import StringUtils, Util +from src.common.tool import TimeUtils +from src.common.ob_connector import OBConnector +from src.handler.meta.sql_meta import GlobalSqlMeta +from src.handler.meta.html_meta import GlobalHtmlMeta +from src.common.tool import FileUtil +from src.handler.analyzer.sql.rule_manager import SQLReviewRuleManager +from src.handler.analyzer.sql.meta.sys_tenant_meta import SysTenantMeta +from src.handler.gather.gather_scenes import GatherSceneHandler +from src.common.command import get_observer_version +from src.common.result_type import ObdiagResult class AnalyzeSQLHandler(object): diff --git a/handler/analyzer/analyze_sql_review.py b/src/handler/analyzer/analyze_sql_review.py similarity index 96% rename from handler/analyzer/analyze_sql_review.py rename to src/handler/analyzer/analyze_sql_review.py index 0afdf67d..a373b28b 100644 --- a/handler/analyzer/analyze_sql_review.py +++ b/src/handler/analyzer/analyze_sql_review.py @@ -19,13 +19,13 @@ import time import sqlparse from tabulate import tabulate -from common.constant import const -from common.tool import StringUtils, Util -from common.tool import TimeUtils -from common.tool import FileUtil -from common.ob_connector import OBConnector -from handler.analyzer.sql.rule_manager import SQLReviewRuleManager -from handler.meta.html_meta import GlobalHtmlMeta +from src.common.constant import const +from src.common.tool import StringUtils, Util +from src.common.tool import TimeUtils +from src.common.tool import FileUtil +from src.common.ob_connector import OBConnector +from src.handler.analyzer.sql.rule_manager import SQLReviewRuleManager +from src.handler.meta.html_meta import GlobalHtmlMeta class AnalyzeSQLReviewHandler(object): diff --git a/handler/analyzer/analyze_variable.py b/src/handler/analyzer/analyze_variable.py similarity index 97% rename from handler/analyzer/analyze_variable.py rename to src/handler/analyzer/analyze_variable.py index ce882b82..29ee4406 100644 --- a/handler/analyzer/analyze_variable.py +++ b/src/handler/analyzer/analyze_variable.py @@ -16,15 +16,15 @@ @desc: """ import os -from common.tool import DirectoryUtil, TimeUtils, Util -from common.obdiag_exception import OBDIAGFormatException -from common.ob_connector import OBConnector +from src.common.tool import DirectoryUtil, TimeUtils, Util +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.ob_connector import OBConnector import csv from prettytable import PrettyTable import datetime from colorama import Fore, Style -from result_type import ObdiagResult +from src.common.result_type import ObdiagResult class AnalyzeVariableHandler(object): diff --git a/handler/analyzer/log_parser/__init__.py b/src/handler/analyzer/log_parser/__init__.py similarity index 100% rename from handler/analyzer/log_parser/__init__.py rename to src/handler/analyzer/log_parser/__init__.py diff --git a/handler/analyzer/log_parser/log_entry.py b/src/handler/analyzer/log_parser/log_entry.py similarity index 99% rename from handler/analyzer/log_parser/log_entry.py rename to src/handler/analyzer/log_parser/log_entry.py index c56c5b25..69d898f6 100644 --- a/handler/analyzer/log_parser/log_entry.py +++ b/src/handler/analyzer/log_parser/log_entry.py @@ -16,7 +16,7 @@ @desc: """ import time -from common.tool import TimeUtils +from src.common.tool import TimeUtils def find_field_end(data, end_chs=",)}({|][", start=0, end=-1): diff --git a/handler/analyzer/log_parser/log_enum.py b/src/handler/analyzer/log_parser/log_enum.py similarity index 100% rename from handler/analyzer/log_parser/log_enum.py rename to src/handler/analyzer/log_parser/log_enum.py diff --git a/handler/analyzer/log_parser/tree.py b/src/handler/analyzer/log_parser/tree.py similarity index 99% rename from handler/analyzer/log_parser/tree.py rename to src/handler/analyzer/log_parser/tree.py index 7587b801..dabeb363 100644 --- a/handler/analyzer/log_parser/tree.py +++ b/src/handler/analyzer/log_parser/tree.py @@ -17,7 +17,7 @@ """ import heapq from typing import List, Dict, Union -from common.tool import TimeUtils +from src.common.tool import TimeUtils from prettytable import PrettyTable diff --git a/handler/analyzer/sql/__init__.py b/src/handler/analyzer/sql/__init__.py similarity index 100% rename from handler/analyzer/sql/__init__.py rename to src/handler/analyzer/sql/__init__.py diff --git a/handler/analyzer/sql/engine.py b/src/handler/analyzer/sql/engine.py similarity index 100% rename from handler/analyzer/sql/engine.py rename to src/handler/analyzer/sql/engine.py diff --git a/handler/analyzer/sql/meta/_init_.py b/src/handler/analyzer/sql/meta/_init_.py similarity index 100% rename from handler/analyzer/sql/meta/_init_.py rename to src/handler/analyzer/sql/meta/_init_.py diff --git a/handler/analyzer/sql/meta/metadata.py b/src/handler/analyzer/sql/meta/metadata.py similarity index 100% rename from handler/analyzer/sql/meta/metadata.py rename to src/handler/analyzer/sql/meta/metadata.py diff --git a/handler/analyzer/sql/meta/sys_tenant_meta.py b/src/handler/analyzer/sql/meta/sys_tenant_meta.py similarity index 96% rename from handler/analyzer/sql/meta/sys_tenant_meta.py rename to src/handler/analyzer/sql/meta/sys_tenant_meta.py index d1bf40d3..23b3dbcb 100644 --- a/handler/analyzer/sql/meta/sys_tenant_meta.py +++ b/src/handler/analyzer/sql/meta/sys_tenant_meta.py @@ -15,9 +15,9 @@ @file: sys_tenant_meta.py @desc: """ -from handler.meta.sql_meta import GlobalSqlMeta -from common.ob_connector import OBConnector -from common.tool import StringUtils +from src.handler.meta.sql_meta import GlobalSqlMeta +from src.common.ob_connector import OBConnector +from src.common.tool import StringUtils class SysTenantMeta(object): diff --git a/handler/analyzer/sql/rule_manager.py b/src/handler/analyzer/sql/rule_manager.py similarity index 77% rename from handler/analyzer/sql/rule_manager.py rename to src/handler/analyzer/sql/rule_manager.py index c2e7db48..ea483d68 100644 --- a/handler/analyzer/sql/rule_manager.py +++ b/src/handler/analyzer/sql/rule_manager.py @@ -18,18 +18,18 @@ from typing import Dict, Type, List from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result -from handler.analyzer.sql.rules.review.arithmetic import ArithmeticRule -from handler.analyzer.sql.rules.review.full_scan import FullScanRule -from handler.analyzer.sql.rules.review.is_null import IsNullRule -from handler.analyzer.sql.rules.review.large_in_clause import LargeInClauseAdjustedRule -from handler.analyzer.sql.rules.review.multi_table_join import MultiTableJoinRule -from handler.analyzer.sql.rules.review.select_all import SelectAllRule -from handler.analyzer.sql.rules.review.update_delete_multi_table import UpdateDeleteMultiTableRule -from handler.analyzer.sql.rules.review.update_delete_without_where_or_true_condition import UpdateDeleteWithoutWhereOrTrueConditionRule -from handler.analyzer.sql.rules.level import Level -from common.tool import SQLUtil +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.review.arithmetic import ArithmeticRule +from src.handler.analyzer.sql.rules.review.full_scan import FullScanRule +from src.handler.analyzer.sql.rules.review.is_null import IsNullRule +from src.handler.analyzer.sql.rules.review.large_in_clause import LargeInClauseAdjustedRule +from src.handler.analyzer.sql.rules.review.multi_table_join import MultiTableJoinRule +from src.handler.analyzer.sql.rules.review.select_all import SelectAllRule +from src.handler.analyzer.sql.rules.review.update_delete_multi_table import UpdateDeleteMultiTableRule +from src.handler.analyzer.sql.rules.review.update_delete_without_where_or_true_condition import UpdateDeleteWithoutWhereOrTrueConditionRule +from src.handler.analyzer.sql.rules.level import Level +from src.common.tool import SQLUtil class RuleManager(object): diff --git a/handler/analyzer/sql/rules/__init__.py b/src/handler/analyzer/sql/rules/__init__.py similarity index 100% rename from handler/analyzer/sql/rules/__init__.py rename to src/handler/analyzer/sql/rules/__init__.py diff --git a/handler/analyzer/sql/rules/abstract_rule.py b/src/handler/analyzer/sql/rules/abstract_rule.py similarity index 100% rename from handler/analyzer/sql/rules/abstract_rule.py rename to src/handler/analyzer/sql/rules/abstract_rule.py diff --git a/handler/analyzer/sql/rules/level.py b/src/handler/analyzer/sql/rules/level.py similarity index 100% rename from handler/analyzer/sql/rules/level.py rename to src/handler/analyzer/sql/rules/level.py diff --git a/handler/analyzer/sql/rules/result.py b/src/handler/analyzer/sql/rules/result.py similarity index 100% rename from handler/analyzer/sql/rules/result.py rename to src/handler/analyzer/sql/rules/result.py diff --git a/handler/analyzer/sql/rules/review/__init__.py b/src/handler/analyzer/sql/rules/review/__init__.py similarity index 100% rename from handler/analyzer/sql/rules/review/__init__.py rename to src/handler/analyzer/sql/rules/review/__init__.py diff --git a/handler/analyzer/sql/rules/review/arithmetic.py b/src/handler/analyzer/sql/rules/review/arithmetic.py similarity index 91% rename from handler/analyzer/sql/rules/review/arithmetic.py rename to src/handler/analyzer/sql/rules/review/arithmetic.py index 550b7811..67dcc6f5 100644 --- a/handler/analyzer/sql/rules/review/arithmetic.py +++ b/src/handler/analyzer/sql/rules/review/arithmetic.py @@ -15,12 +15,12 @@ @file: arithmetic.py @desc: """ -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level from sqlgpt_parser.parser.tree.expression import QualifiedNameReference from sqlgpt_parser.parser.tree.statement import Statement from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result class ArithmeticRule(AbstractRule): diff --git a/handler/analyzer/sql/rules/review/full_scan.py b/src/handler/analyzer/sql/rules/review/full_scan.py similarity index 97% rename from handler/analyzer/sql/rules/review/full_scan.py rename to src/handler/analyzer/sql/rules/review/full_scan.py index 9a747de8..b40b841a 100644 --- a/handler/analyzer/sql/rules/review/full_scan.py +++ b/src/handler/analyzer/sql/rules/review/full_scan.py @@ -15,10 +15,10 @@ @file: select_all.py @desc: """ -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.result import Result -from handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule from sqlgpt_parser.parser.tree.literal import StringLiteral from sqlgpt_parser.parser.tree.statement import Statement diff --git a/handler/analyzer/sql/rules/review/is_null.py b/src/handler/analyzer/sql/rules/review/is_null.py similarity index 93% rename from handler/analyzer/sql/rules/review/is_null.py rename to src/handler/analyzer/sql/rules/review/is_null.py index 76a537ce..ab73dcbc 100644 --- a/handler/analyzer/sql/rules/review/is_null.py +++ b/src/handler/analyzer/sql/rules/review/is_null.py @@ -18,10 +18,10 @@ from sqlgpt_parser.parser.tree.literal import NullLiteral from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level from sqlgpt_parser.parser.tree.statement import Statement -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result class IsNullRule(AbstractRule): diff --git a/handler/analyzer/sql/rules/review/large_in_clause.py b/src/handler/analyzer/sql/rules/review/large_in_clause.py similarity index 93% rename from handler/analyzer/sql/rules/review/large_in_clause.py rename to src/handler/analyzer/sql/rules/review/large_in_clause.py index 2d17411c..5b381a53 100644 --- a/handler/analyzer/sql/rules/review/large_in_clause.py +++ b/src/handler/analyzer/sql/rules/review/large_in_clause.py @@ -16,10 +16,10 @@ @file: large_in_clause_adjusted.py @desc: """ -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result from sqlgpt_parser.parser.tree.statement import Statement diff --git a/handler/analyzer/sql/rules/review/multi_table_join.py b/src/handler/analyzer/sql/rules/review/multi_table_join.py similarity index 95% rename from handler/analyzer/sql/rules/review/multi_table_join.py rename to src/handler/analyzer/sql/rules/review/multi_table_join.py index b925086f..6cf0210f 100644 --- a/handler/analyzer/sql/rules/review/multi_table_join.py +++ b/src/handler/analyzer/sql/rules/review/multi_table_join.py @@ -15,12 +15,12 @@ @file: multi_table_join.py @desc: """ -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level from sqlgpt_parser.parser.tree.join_criteria import JoinOn, JoinUsing from sqlgpt_parser.parser.tree.statement import Statement from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result class MultiTableJoinRule(AbstractRule): diff --git a/handler/analyzer/sql/rules/review/select_all.py b/src/handler/analyzer/sql/rules/review/select_all.py similarity index 93% rename from handler/analyzer/sql/rules/review/select_all.py rename to src/handler/analyzer/sql/rules/review/select_all.py index f8706336..c4927e1b 100644 --- a/handler/analyzer/sql/rules/review/select_all.py +++ b/src/handler/analyzer/sql/rules/review/select_all.py @@ -15,14 +15,14 @@ @file: full_scan.py @desc: """ -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level from sqlgpt_parser.parser.tree.statement import Statement from sqlgpt_parser.parser.tree.expression import QualifiedNameReference from sqlgpt_parser.parser.tree.qualified_name import QualifiedName from sqlgpt_parser.parser.tree.select_item import SingleColumn from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.result import Result -from handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule class SelectAllRule(AbstractRule): diff --git a/handler/analyzer/sql/rules/review/update_delete_multi_table.py b/src/handler/analyzer/sql/rules/review/update_delete_multi_table.py similarity index 93% rename from handler/analyzer/sql/rules/review/update_delete_multi_table.py rename to src/handler/analyzer/sql/rules/review/update_delete_multi_table.py index ee76e22f..6608dd3e 100644 --- a/handler/analyzer/sql/rules/review/update_delete_multi_table.py +++ b/src/handler/analyzer/sql/rules/review/update_delete_multi_table.py @@ -19,9 +19,9 @@ from sqlgpt_parser.parser.tree.relation import Join from sqlgpt_parser.parser.tree.statement import Statement from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.level import Level -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result class UpdateDeleteMultiTableRule(AbstractRule): diff --git a/handler/analyzer/sql/rules/review/update_delete_without_where_or_true_condition.py b/src/handler/analyzer/sql/rules/review/update_delete_without_where_or_true_condition.py similarity index 94% rename from handler/analyzer/sql/rules/review/update_delete_without_where_or_true_condition.py rename to src/handler/analyzer/sql/rules/review/update_delete_without_where_or_true_condition.py index abf3d1de..3d7be229 100644 --- a/handler/analyzer/sql/rules/review/update_delete_without_where_or_true_condition.py +++ b/src/handler/analyzer/sql/rules/review/update_delete_without_where_or_true_condition.py @@ -19,9 +19,9 @@ from sqlgpt_parser.parser.tree.statement import Statement from sqlgpt_parser.parser.tree.expression import ComparisonExpression from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.level import Level -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result class UpdateDeleteWithoutWhereOrTrueConditionRule(AbstractRule): diff --git a/handler/analyzer/sql/rules/tunning/__init__.py b/src/handler/analyzer/sql/rules/tunning/__init__.py similarity index 100% rename from handler/analyzer/sql/rules/tunning/__init__.py rename to src/handler/analyzer/sql/rules/tunning/__init__.py diff --git a/handler/analyzer/sql/rules/tunning/index_column_fuzzy_match.py b/src/handler/analyzer/sql/rules/tunning/index_column_fuzzy_match.py similarity index 94% rename from handler/analyzer/sql/rules/tunning/index_column_fuzzy_match.py rename to src/handler/analyzer/sql/rules/tunning/index_column_fuzzy_match.py index 73f27a66..c3fb0fac 100644 --- a/handler/analyzer/sql/rules/tunning/index_column_fuzzy_match.py +++ b/src/handler/analyzer/sql/rules/tunning/index_column_fuzzy_match.py @@ -15,11 +15,11 @@ @file: index_column_fuzzy_search.py @desc: """ -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level from sqlgpt_parser.parser.tree.expression import QualifiedNameReference from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result from sqlgpt_parser.parser.tree.statement import Statement diff --git a/handler/analyzer/sql/rules/tunning/index_column_implicit_conversion.py b/src/handler/analyzer/sql/rules/tunning/index_column_implicit_conversion.py similarity index 95% rename from handler/analyzer/sql/rules/tunning/index_column_implicit_conversion.py rename to src/handler/analyzer/sql/rules/tunning/index_column_implicit_conversion.py index b3c1fdca..49806227 100644 --- a/handler/analyzer/sql/rules/tunning/index_column_implicit_conversion.py +++ b/src/handler/analyzer/sql/rules/tunning/index_column_implicit_conversion.py @@ -15,11 +15,11 @@ @file: index_column_implicit_conversion.py @desc: """ -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level from sqlgpt_parser.parser.tree.expression import QualifiedNameReference from sqlgpt_parser.parser.tree.visitor import DefaultTraversalVisitor -from handler.analyzer.sql.rules.abstract_rule import AbstractRule -from handler.analyzer.sql.rules.result import Result +from src.handler.analyzer.sql.rules.abstract_rule import AbstractRule +from src.handler.analyzer.sql.rules.result import Result from sqlgpt_parser.parser.tree.statement import Statement diff --git a/handler/base_shell_handler.py b/src/handler/base_shell_handler.py similarity index 100% rename from handler/base_shell_handler.py rename to src/handler/base_shell_handler.py diff --git a/handler/checker/__init__.py b/src/handler/checker/__init__.py similarity index 100% rename from handler/checker/__init__.py rename to src/handler/checker/__init__.py diff --git a/handler/checker/check_exception.py b/src/handler/checker/check_exception.py similarity index 100% rename from handler/checker/check_exception.py rename to src/handler/checker/check_exception.py diff --git a/handler/checker/check_handler.py b/src/handler/checker/check_handler.py similarity index 96% rename from handler/checker/check_handler.py rename to src/handler/checker/check_handler.py index a5fc20c9..0a18bc0d 100644 --- a/handler/checker/check_handler.py +++ b/src/handler/checker/check_handler.py @@ -22,15 +22,15 @@ import yaml -from common.ob_connector import OBConnector -from common.scene import get_version_by_type -from common.ssh_client.ssh import SshClient -from handler.checker.check_exception import CheckException -from handler.checker.check_report import TaskReport, CheckReport, CheckrReportException -from handler.checker.check_task import TaskBase +from src.common.ob_connector import OBConnector +from src.common.scene import get_version_by_type +from src.common.ssh_client.ssh import SshClient +from src.handler.checker.check_exception import CheckException +from src.handler.checker.check_report import TaskReport, CheckReport, CheckrReportException +from src.handler.checker.check_task import TaskBase import re -from common.tool import Util -from common.tool import StringUtils +from src.common.tool import Util +from src.common.tool import StringUtils class CheckHandler: diff --git a/handler/checker/check_list.py b/src/handler/checker/check_list.py similarity index 98% rename from handler/checker/check_list.py rename to src/handler/checker/check_list.py index cc3d86fc..d60a5377 100644 --- a/handler/checker/check_list.py +++ b/src/handler/checker/check_list.py @@ -19,8 +19,8 @@ import yaml -from common.tool import Util -from result_type import ObdiagResult +from src.common.tool import Util +from src.common.result_type import ObdiagResult class CheckListHandler: diff --git a/handler/checker/check_report.py b/src/handler/checker/check_report.py similarity index 99% rename from handler/checker/check_report.py rename to src/handler/checker/check_report.py index e1f92155..87c781c4 100644 --- a/handler/checker/check_report.py +++ b/src/handler/checker/check_report.py @@ -29,10 +29,10 @@ import json from io import open -from handler.checker.check_exception import CheckException -from telemetry.telemetry import telemetry +from src.handler.checker.check_exception import CheckException +from src.telemetry.telemetry import telemetry from jinja2 import Template -from common.version import OBDIAG_VERSION +from src.common.version import OBDIAG_VERSION class CheckReport: diff --git a/handler/checker/check_task.py b/src/handler/checker/check_task.py similarity index 93% rename from handler/checker/check_task.py rename to src/handler/checker/check_task.py index 16da9a97..4e37cc96 100644 --- a/handler/checker/check_task.py +++ b/src/handler/checker/check_task.py @@ -17,10 +17,10 @@ """ import threading -from handler.checker.check_exception import StepResultFailException, StepExecuteFailException, StepResultFalseException, TaskException -from handler.checker.step.stepbase import StepBase -from common.tool import StringUtils -from common.scene import filter_by_version +from src.handler.checker.check_exception import StepResultFailException, StepExecuteFailException, StepResultFalseException, TaskException +from src.handler.checker.step.stepbase import StepBase +from src.common.tool import StringUtils +from src.common.scene import filter_by_version class TaskBase(object): diff --git a/handler/checker/result/__init__.py b/src/handler/checker/result/__init__.py similarity index 100% rename from handler/checker/result/__init__.py rename to src/handler/checker/result/__init__.py diff --git a/handler/checker/result/result.py b/src/handler/checker/result/result.py similarity index 94% rename from handler/checker/result/result.py rename to src/handler/checker/result/result.py index b132479d..04d7819e 100644 --- a/handler/checker/result/result.py +++ b/src/handler/checker/result/result.py @@ -15,8 +15,8 @@ @file: result.py @desc: """ -from handler.checker.check_exception import ResultFalseException, ResultFailException -from handler.checker.result.verify import VerifyResult +from src.handler.checker.check_exception import ResultFalseException, ResultFailException +from src.handler.checker.result.verify import VerifyResult import re diff --git a/handler/checker/result/verify.py b/src/handler/checker/result/verify.py similarity index 97% rename from handler/checker/result/verify.py rename to src/handler/checker/result/verify.py index ce21ea43..25bb24f7 100644 --- a/handler/checker/result/verify.py +++ b/src/handler/checker/result/verify.py @@ -18,9 +18,9 @@ import decimal import re import subprocess -from handler.checker.check_exception import VerifyFalseException, VerifyFailException -from handler.meta.check_meta import GlobalCheckMeta -from common.tool import StringUtils +from src.handler.checker.check_exception import VerifyFalseException, VerifyFailException +from src.handler.meta.check_meta import GlobalCheckMeta +from src.common.tool import StringUtils class VerifyResult(object): diff --git a/handler/checker/step/__init__.py b/src/handler/checker/step/__init__.py similarity index 100% rename from handler/checker/step/__init__.py rename to src/handler/checker/step/__init__.py diff --git a/handler/checker/step/data_size.py b/src/handler/checker/step/data_size.py similarity index 93% rename from handler/checker/step/data_size.py rename to src/handler/checker/step/data_size.py index 053d5068..25ffb88b 100644 --- a/handler/checker/step/data_size.py +++ b/src/handler/checker/step/data_size.py @@ -15,9 +15,9 @@ @file: data_size.py @desc: """ -from common.types import Capacity -from handler.checker.check_exception import StepExecuteFailException -from handler.checker.check_report import TaskReport +from src.common.types import Capacity +from src.handler.checker.check_exception import StepExecuteFailException +from src.handler.checker.check_report import TaskReport class DataSizeHandler: diff --git a/handler/checker/step/get_system_parameter.py b/src/handler/checker/step/get_system_parameter.py similarity index 95% rename from handler/checker/step/get_system_parameter.py rename to src/handler/checker/step/get_system_parameter.py index 6a762579..2b89902b 100644 --- a/handler/checker/step/get_system_parameter.py +++ b/src/handler/checker/step/get_system_parameter.py @@ -16,9 +16,9 @@ @desc: """ -from handler.checker.check_exception import StepExecuteFailException -from handler.checker.check_report import TaskReport -from common.tool import Util +from src.handler.checker.check_exception import StepExecuteFailException +from src.handler.checker.check_report import TaskReport +from src.common.tool import Util class GetSystemParameterHandler: diff --git a/handler/checker/step/sleep.py b/src/handler/checker/step/sleep.py similarity index 97% rename from handler/checker/step/sleep.py rename to src/handler/checker/step/sleep.py index e5fe2363..bdefd8d1 100644 --- a/handler/checker/step/sleep.py +++ b/src/handler/checker/step/sleep.py @@ -17,7 +17,7 @@ """ import time -from handler.checker.check_exception import StepExecuteFailException +from src.handler.checker.check_exception import StepExecuteFailException class StepSleepHandler: diff --git a/handler/checker/step/sql.py b/src/handler/checker/step/sql.py similarity index 95% rename from handler/checker/step/sql.py rename to src/handler/checker/step/sql.py index 0fd475e7..549800ee 100644 --- a/handler/checker/step/sql.py +++ b/src/handler/checker/step/sql.py @@ -16,9 +16,9 @@ @desc: """ -from handler.checker.check_exception import StepExecuteFailException -from common.tool import StringUtils -from common.tool import Util +from src.handler.checker.check_exception import StepExecuteFailException +from src.common.tool import StringUtils +from src.common.tool import Util class StepSQLHandler: diff --git a/handler/checker/step/ssh.py b/src/handler/checker/step/ssh.py similarity index 93% rename from handler/checker/step/ssh.py rename to src/handler/checker/step/ssh.py index adbfb27e..ac0cd956 100644 --- a/handler/checker/step/ssh.py +++ b/src/handler/checker/step/ssh.py @@ -16,10 +16,10 @@ @desc: """ -from handler.checker.check_exception import StepExecuteFailException -from handler.checker.check_report import TaskReport -from common.tool import StringUtils -from common.tool import Util +from src.handler.checker.check_exception import StepExecuteFailException +from src.handler.checker.check_report import TaskReport +from src.common.tool import StringUtils +from src.common.tool import Util class SshHandler: diff --git a/handler/checker/step/stepbase.py b/src/handler/checker/step/stepbase.py similarity index 92% rename from handler/checker/step/stepbase.py rename to src/handler/checker/step/stepbase.py index f0b429ce..fb79f8b2 100644 --- a/handler/checker/step/stepbase.py +++ b/src/handler/checker/step/stepbase.py @@ -16,13 +16,13 @@ @desc: """ -from handler.checker.check_exception import StepResultFailException, StepExecuteFailException, ResultFalseException, ResultFailException, StepResultFalseException -from handler.checker.step.data_size import DataSizeHandler -from handler.checker.step.get_system_parameter import GetSystemParameterHandler -from handler.checker.result.result import CheckResult -from handler.checker.step.ssh import SshHandler -from handler.checker.step.sql import StepSQLHandler -from common.ssh_client.ssh import SshClient +from src.handler.checker.check_exception import StepResultFailException, StepExecuteFailException, ResultFalseException, ResultFailException, StepResultFalseException +from src.handler.checker.step.data_size import DataSizeHandler +from src.handler.checker.step.get_system_parameter import GetSystemParameterHandler +from src.handler.checker.result.result import CheckResult +from src.handler.checker.step.ssh import SshHandler +from src.handler.checker.step.sql import StepSQLHandler +from src.common.ssh_client.ssh import SshClient class StepBase(object): diff --git a/handler/display/__init__.py b/src/handler/display/__init__.py similarity index 100% rename from handler/display/__init__.py rename to src/handler/display/__init__.py diff --git a/handler/display/display_scenes.py b/src/handler/display/display_scenes.py similarity index 95% rename from handler/display/display_scenes.py rename to src/handler/display/display_scenes.py index 25bc0867..d142a5c3 100644 --- a/handler/display/display_scenes.py +++ b/src/handler/display/display_scenes.py @@ -17,17 +17,17 @@ """ import re -from result_type import ObdiagResult -from stdio import SafeStdio +from src.common.result_type import ObdiagResult +from src.common.stdio import SafeStdio import datetime -from handler.display.scenes.base import SceneBase -from common.obdiag_exception import OBDIAGFormatException -from handler.display.scenes.list import DisplayScenesListHandler -from common.tool import StringUtils -from common.scene import get_version_by_type -from common.tool import Util -from common.tool import TimeUtils -from common.ob_connector import OBConnector +from src.handler.display.scenes.base import SceneBase +from src.common.obdiag_exception import OBDIAGFormatException +from src.handler.display.scenes.list import DisplayScenesListHandler +from src.common.tool import StringUtils +from src.common.scene import get_version_by_type +from src.common.tool import Util +from src.common.tool import TimeUtils +from src.common.ob_connector import OBConnector class DisplaySceneHandler(SafeStdio): diff --git a/handler/display/scenes/__init__.py b/src/handler/display/scenes/__init__.py similarity index 100% rename from handler/display/scenes/__init__.py rename to src/handler/display/scenes/__init__.py diff --git a/handler/display/scenes/base.py b/src/handler/display/scenes/base.py similarity index 96% rename from handler/display/scenes/base.py rename to src/handler/display/scenes/base.py index 936af7d2..9f451f86 100644 --- a/handler/display/scenes/base.py +++ b/src/handler/display/scenes/base.py @@ -15,9 +15,9 @@ @file: base.py @desc: """ -from stdio import SafeStdio -from common.scene import filter_by_version -from handler.display.step.base import Base +from src.common.stdio import SafeStdio +from src.common.scene import filter_by_version +from src.handler.display.step.base import Base class SceneBase(SafeStdio): diff --git a/handler/display/scenes/list.py b/src/handler/display/scenes/list.py similarity index 96% rename from handler/display/scenes/list.py rename to src/handler/display/scenes/list.py index a31ee784..97c089c4 100644 --- a/handler/display/scenes/list.py +++ b/src/handler/display/scenes/list.py @@ -18,11 +18,11 @@ import os -from result_type import ObdiagResult -from stdio import SafeStdio -from common.tool import YamlUtils -from handler.display.scenes.register import hardcode_scene_list -from common.tool import Util +from src.common.result_type import ObdiagResult +from src.common.stdio import SafeStdio +from src.common.tool import YamlUtils +from src.handler.display.scenes.register import hardcode_scene_list +from src.common.tool import Util class DisplayScenesListHandler(SafeStdio): diff --git a/handler/display/scenes/register.py b/src/handler/display/scenes/register.py similarity index 100% rename from handler/display/scenes/register.py rename to src/handler/display/scenes/register.py diff --git a/handler/display/step/__init__.py b/src/handler/display/step/__init__.py similarity index 100% rename from handler/display/step/__init__.py rename to src/handler/display/step/__init__.py diff --git a/handler/display/step/base.py b/src/handler/display/step/base.py similarity index 95% rename from handler/display/step/base.py rename to src/handler/display/step/base.py index 52141c79..c8f445e6 100644 --- a/handler/display/step/base.py +++ b/src/handler/display/step/base.py @@ -15,9 +15,9 @@ @file: base.py @desc: """ -from common.ssh_client.ssh import SshClient -from stdio import SafeStdio -from handler.display.step.sql import StepSQLHandler +from src.common.ssh_client.ssh import SshClient +from src.common.stdio import SafeStdio +from src.handler.display.step.sql import StepSQLHandler class Base(SafeStdio): diff --git a/handler/display/step/sql.py b/src/handler/display/step/sql.py similarity index 97% rename from handler/display/step/sql.py rename to src/handler/display/step/sql.py index a5ad8fc3..ea5001c5 100644 --- a/handler/display/step/sql.py +++ b/src/handler/display/step/sql.py @@ -15,8 +15,8 @@ @file: sql.py @desc: """ -from stdio import SafeStdio -from common.tool import StringUtils +from src.common.stdio import SafeStdio +from src.common.tool import StringUtils from prettytable import PrettyTable diff --git a/handler/display/step/ssh.py b/src/handler/display/step/ssh.py similarity index 95% rename from handler/display/step/ssh.py rename to src/handler/display/step/ssh.py index d0620f85..4dcc377a 100644 --- a/handler/display/step/ssh.py +++ b/src/handler/display/step/ssh.py @@ -17,9 +17,9 @@ """ import os -from common.ssh_client.ssh import SshClient -from stdio import SafeStdio -from common.tool import StringUtils +from src.common.ssh_client.ssh import SshClient +from src.common.stdio import SafeStdio +from src.common.tool import StringUtils class SshHandler(SafeStdio): diff --git a/handler/gather/__init__.py b/src/handler/gather/__init__.py similarity index 100% rename from handler/gather/__init__.py rename to src/handler/gather/__init__.py diff --git a/handler/gather/gather_ash_report.py b/src/handler/gather/gather_ash_report.py similarity index 96% rename from handler/gather/gather_ash_report.py rename to src/handler/gather/gather_ash_report.py index cac8e8a9..1b4d69c7 100644 --- a/handler/gather/gather_ash_report.py +++ b/src/handler/gather/gather_ash_report.py @@ -19,12 +19,12 @@ import os import traceback -from common.command import get_observer_version -from common.ob_connector import OBConnector -from common.obdiag_exception import OBDIAGFormatException, OBDIAGException -from common.tool import DirectoryUtil, TimeUtils, Util, StringUtils -from result_type import ObdiagResult -from stdio import SafeStdio +from src.common.command import get_observer_version +from src.common.ob_connector import OBConnector +from src.common.obdiag_exception import OBDIAGFormatException, OBDIAGException +from src.common.tool import DirectoryUtil, TimeUtils, Util, StringUtils +from src.common.result_type import ObdiagResult +from src.common.stdio import SafeStdio from colorama import Fore, Style @@ -190,7 +190,7 @@ def init_option(self): if store_dir_option: self.gather_pack_dir = store_dir_option else: - self.gather_pack_dir = "./" + self.gather_pack_dir = "/" self.stdio.print( "from_time: {0}, to_time: {1}, sql_id: {2}, trace_id: {3}, report_type: {4}, wait_class: {5}, store_dir: {6}".format(self.from_time_str, self.to_time_str, self.sql_id, self.trace_id, self.report_type, self.wait_class, self.gather_pack_dir) ) diff --git a/handler/gather/gather_awr.py b/src/handler/gather/gather_awr.py similarity index 97% rename from handler/gather/gather_awr.py rename to src/handler/gather/gather_awr.py index ae6b60f5..b2f1b0b6 100644 --- a/handler/gather/gather_awr.py +++ b/src/handler/gather/gather_awr.py @@ -21,13 +21,14 @@ import datetime import tabulate import requests -from common.obdiag_exception import OBDIAGFormatException -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import Util -from common.tool import TimeUtils -from common.ocp import ocp_task, ocp_api -from result_type import ObdiagResult +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import Util +from src.common.tool import TimeUtils +from src.common.ocp import ocp_api +from src.common.ocp import ocp_task +from src.common.result_type import ObdiagResult class GatherAwrHandler(object): diff --git a/handler/gather/gather_component_log.py b/src/handler/gather/gather_component_log.py similarity index 98% rename from handler/gather/gather_component_log.py rename to src/handler/gather/gather_component_log.py index 58d717dc..7e08f102 100644 --- a/handler/gather/gather_component_log.py +++ b/src/handler/gather/gather_component_log.py @@ -25,13 +25,13 @@ import shutil from prettytable import PrettyTable -from common.command import get_file_start_time, get_file_size, is_empty_dir -from common.constant import const -from common.ssh_client.ssh import SshClient -from common.tool import FileUtil, TimeUtils -from handler.base_shell_handler import BaseShellHandler -from handler.gather.plugins.redact import Redact -from result_type import ObdiagResult +from src.common.command import get_file_start_time, get_file_size, is_empty_dir +from src.common.constant import const +from src.common.ssh_client.ssh import SshClient +from src.common.tool import FileUtil, TimeUtils +from src.handler.base_shell_handler import BaseShellHandler +from src.handler.gather.plugins.redact import Redact +from src.common.result_type import ObdiagResult class GatherComponentLogHandler(BaseShellHandler): @@ -160,6 +160,7 @@ def __check_option(self): pass elif isinstance(self.grep, str): self.grep = self.grep.strip() + self.grep = [self.grep] # check since from_option and to_option from_timestamp = None diff --git a/handler/gather/gather_log.py b/src/handler/gather/gather_log.py similarity index 97% rename from handler/gather/gather_log.py rename to src/handler/gather/gather_log.py index 80ebf05c..2017f321 100644 --- a/handler/gather/gather_log.py +++ b/src/handler/gather/gather_log.py @@ -20,18 +20,18 @@ import time import tabulate import threading -from handler.base_shell_handler import BaseShellHandler -from common.obdiag_exception import OBDIAGFormatException -from common.constant import const -from common.command import get_file_size, download_file, is_empty_dir, rm_rf_file, get_logfile_name_list, mkdir, delete_empty_file, zip_encrypt_dir, zip_dir -from common.command import SshClient -from common.tool import TimeUtils -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import NetUtils -from handler.gather.plugins.redact import Redact -from result_type import ObdiagResult +from src.handler.base_shell_handler import BaseShellHandler +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.constant import const +from src.common.command import get_file_size, download_file, is_empty_dir, rm_rf_file, get_logfile_name_list, mkdir, delete_empty_file, zip_encrypt_dir, zip_dir +from src.common.command import SshClient +from src.common.tool import TimeUtils +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import NetUtils +from src.handler.gather.plugins.redact import Redact +from src.common.result_type import ObdiagResult class GatherLogHandler(BaseShellHandler): diff --git a/handler/gather/gather_obadmin.py b/src/handler/gather/gather_obadmin.py similarity index 96% rename from handler/gather/gather_obadmin.py rename to src/handler/gather/gather_obadmin.py index 1b05d8eb..2f3bc7a5 100644 --- a/handler/gather/gather_obadmin.py +++ b/src/handler/gather/gather_obadmin.py @@ -20,18 +20,18 @@ import datetime import tabulate -from common.obdiag_exception import OBDIAGFormatException -from common.constant import const -from common.command import SshClient, is_empty_dir -from handler.base_shell_handler import BaseShellHandler -from common.command import download_file, rm_rf_file, get_file_size, get_observer_version, tar_gz_dir -from common.tool import TimeUtils -from common.tool import StringUtils -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import NetUtils -from result_type import ObdiagResult +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.constant import const +from src.common.command import SshClient, is_empty_dir +from src.handler.base_shell_handler import BaseShellHandler +from src.common.command import download_file, rm_rf_file, get_file_size, get_observer_version, tar_gz_dir +from src.common.tool import TimeUtils +from src.common.tool import StringUtils +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import NetUtils +from src.common.result_type import ObdiagResult class GatherObAdminHandler(BaseShellHandler): diff --git a/handler/gather/gather_obproxy_log.py b/src/handler/gather/gather_obproxy_log.py similarity index 96% rename from handler/gather/gather_obproxy_log.py rename to src/handler/gather/gather_obproxy_log.py index bbec3e49..7f538114 100644 --- a/handler/gather/gather_obproxy_log.py +++ b/src/handler/gather/gather_obproxy_log.py @@ -22,17 +22,17 @@ import tabulate -from handler.base_shell_handler import BaseShellHandler -from common.obdiag_exception import OBDIAGFormatException -from common.command import SshClient -from common.constant import const -from common.command import get_file_size, download_file, is_empty_dir, get_logfile_name_list, mkdir, delete_empty_file, rm_rf_file, zip_encrypt_dir, zip_dir -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import NetUtils -from common.tool import TimeUtils -from result_type import ObdiagResult +from src.handler.base_shell_handler import BaseShellHandler +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.command import SshClient +from src.common.constant import const +from src.common.command import get_file_size, download_file, is_empty_dir, get_logfile_name_list, mkdir, delete_empty_file, rm_rf_file, zip_encrypt_dir, zip_dir +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import NetUtils +from src.common.tool import TimeUtils +from src.common.result_type import ObdiagResult class GatherObProxyLogHandler(BaseShellHandler): diff --git a/handler/gather/gather_obstack2.py b/src/handler/gather/gather_obstack2.py similarity index 95% rename from handler/gather/gather_obstack2.py rename to src/handler/gather/gather_obstack2.py index fe30d9c0..a43cbdff 100644 --- a/handler/gather/gather_obstack2.py +++ b/src/handler/gather/gather_obstack2.py @@ -22,16 +22,16 @@ import tabulate -from common.command import download_file, is_empty_dir, is_support_arch, get_observer_version, get_observer_pid, mkdir, zip_dir, get_file_size, delete_file_force, is_empty_file, upload_file -from common.constant import const -from common.command import SshClient -from handler.base_shell_handler import BaseShellHandler -from common.tool import TimeUtils -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import StringUtils -from result_type import ObdiagResult +from src.common.command import download_file, is_empty_dir, is_support_arch, get_observer_version, get_observer_pid, mkdir, zip_dir, get_file_size, delete_file_force, is_empty_file, upload_file +from src.common.constant import const +from src.common.command import SshClient +from src.handler.base_shell_handler import BaseShellHandler +from src.common.tool import TimeUtils +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import StringUtils +from src.common.result_type import ObdiagResult class GatherObstack2Handler(BaseShellHandler): diff --git a/handler/gather/gather_parameters.py b/src/handler/gather/gather_parameters.py similarity index 95% rename from handler/gather/gather_parameters.py rename to src/handler/gather/gather_parameters.py index 439536f2..44950cd1 100644 --- a/handler/gather/gather_parameters.py +++ b/src/handler/gather/gather_parameters.py @@ -16,14 +16,14 @@ @desc: """ import os -from common.command import get_observer_version_by_sql -from common.tool import DirectoryUtil, TimeUtils, Util, StringUtils -from common.obdiag_exception import OBDIAGFormatException -from common.ob_connector import OBConnector +from src.common.command import get_observer_version_by_sql +from src.common.tool import DirectoryUtil, TimeUtils, Util, StringUtils +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.ob_connector import OBConnector import csv from colorama import Fore, Style -from result_type import ObdiagResult +from src.common.result_type import ObdiagResult class GatherParametersHandler(object): diff --git a/handler/gather/gather_perf.py b/src/handler/gather/gather_perf.py similarity index 95% rename from handler/gather/gather_perf.py rename to src/handler/gather/gather_perf.py index 84b217ce..d3da96dc 100644 --- a/handler/gather/gather_perf.py +++ b/src/handler/gather/gather_perf.py @@ -21,16 +21,16 @@ import tabulate -from common.command import get_observer_pid, mkdir, zip_dir, get_file_size, download_file, delete_file_force -from common.command import SshClient -from common.constant import const -from handler.base_shell_handler import BaseShellHandler -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import NetUtils -from common.tool import TimeUtils -from result_type import ObdiagResult +from src.common.command import get_observer_pid, mkdir, zip_dir, get_file_size, download_file, delete_file_force +from src.common.command import SshClient +from src.common.constant import const +from src.handler.base_shell_handler import BaseShellHandler +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import NetUtils +from src.common.tool import TimeUtils +from src.common.result_type import ObdiagResult class GatherPerfHandler(BaseShellHandler): diff --git a/handler/gather/gather_plan_monitor.py b/src/handler/gather/gather_plan_monitor.py similarity index 99% rename from handler/gather/gather_plan_monitor.py rename to src/handler/gather/gather_plan_monitor.py index 908c9a48..bf3ada90 100644 --- a/handler/gather/gather_plan_monitor.py +++ b/src/handler/gather/gather_plan_monitor.py @@ -23,16 +23,16 @@ from decimal import Decimal import tabulate from prettytable import from_db_cursor -from common.ob_connector import OBConnector -from handler.meta.html_meta import GlobalHtmlMeta -from handler.meta.sql_meta import GlobalSqlMeta -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import StringUtils -from common.tool import FileUtil -from common.tool import TimeUtils -from handler.gather.gather_tabledump import GatherTableDumpHandler -from result_type import ObdiagResult +from src.common.ob_connector import OBConnector +from src.handler.meta.html_meta import GlobalHtmlMeta +from src.handler.meta.sql_meta import GlobalSqlMeta +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import StringUtils +from src.common.tool import FileUtil +from src.common.tool import TimeUtils +from src.handler.gather.gather_tabledump import GatherTableDumpHandler +from src.common.result_type import ObdiagResult class GatherPlanMonitorHandler(object): diff --git a/handler/gather/gather_scenes.py b/src/handler/gather/gather_scenes.py similarity index 95% rename from handler/gather/gather_scenes.py rename to src/handler/gather/gather_scenes.py index 8d2613bc..da0de3c2 100644 --- a/handler/gather/gather_scenes.py +++ b/src/handler/gather/gather_scenes.py @@ -18,18 +18,18 @@ import os import re -from result_type import ObdiagResult -from stdio import SafeStdio +from src.common.result_type import ObdiagResult +from src.common.stdio import SafeStdio import datetime -from handler.gather.scenes.base import SceneBase -from common.obdiag_exception import OBDIAGFormatException -from handler.gather.scenes.list import GatherScenesListHandler -from common.tool import DirectoryUtil -from common.tool import StringUtils -from common.scene import get_version_by_type +from src.handler.gather.scenes.base import SceneBase +from src.common.obdiag_exception import OBDIAGFormatException +from src.handler.gather.scenes.list import GatherScenesListHandler +from src.common.tool import DirectoryUtil +from src.common.tool import StringUtils +from src.common.scene import get_version_by_type from colorama import Fore, Style -from common.tool import Util -from common.tool import TimeUtils +from src.common.tool import Util +from src.common.tool import TimeUtils class GatherSceneHandler(SafeStdio): diff --git a/handler/gather/gather_sysstat.py b/src/handler/gather/gather_sysstat.py similarity index 96% rename from handler/gather/gather_sysstat.py rename to src/handler/gather/gather_sysstat.py index ed7285a9..7dddc2ca 100644 --- a/handler/gather/gather_sysstat.py +++ b/src/handler/gather/gather_sysstat.py @@ -20,16 +20,16 @@ import datetime import tabulate -from common.constant import const -from common.command import SshClient -from common.command import get_file_size, download_file, mkdir, zip_dir -from handler.base_shell_handler import BaseShellHandler -from common.tool import Util -from common.tool import DirectoryUtil -from common.tool import FileUtil -from common.tool import NetUtils -from common.tool import TimeUtils -from result_type import ObdiagResult +from src.common.constant import const +from src.common.command import SshClient +from src.common.command import get_file_size, download_file, mkdir, zip_dir +from src.handler.base_shell_handler import BaseShellHandler +from src.common.tool import Util +from src.common.tool import DirectoryUtil +from src.common.tool import FileUtil +from src.common.tool import NetUtils +from src.common.tool import TimeUtils +from src.common.result_type import ObdiagResult class GatherOsInfoHandler(BaseShellHandler): diff --git a/handler/gather/gather_tabledump.py b/src/handler/gather/gather_tabledump.py similarity index 97% rename from handler/gather/gather_tabledump.py rename to src/handler/gather/gather_tabledump.py index f9c77c7b..cd5fd343 100644 --- a/handler/gather/gather_tabledump.py +++ b/src/handler/gather/gather_tabledump.py @@ -19,13 +19,13 @@ import os import time -from result_type import ObdiagResult -from stdio import SafeStdio -from common.ob_connector import OBConnector -from common.tool import StringUtils -from common.command import get_observer_version -from common.tool import Util -from common.tool import TimeUtils +from src.common.result_type import ObdiagResult +from src.common.stdio import SafeStdio +from src.common.ob_connector import OBConnector +from src.common.tool import StringUtils +from src.common.command import get_observer_version +from src.common.tool import Util +from src.common.tool import TimeUtils from tabulate import tabulate diff --git a/handler/gather/gather_variables.py b/src/handler/gather/gather_variables.py similarity index 95% rename from handler/gather/gather_variables.py rename to src/handler/gather/gather_variables.py index 1c620abc..fe20705e 100644 --- a/handler/gather/gather_variables.py +++ b/src/handler/gather/gather_variables.py @@ -16,13 +16,13 @@ @desc: """ import os -from common.tool import DirectoryUtil, TimeUtils, Util -from common.obdiag_exception import OBDIAGFormatException -from common.ob_connector import OBConnector +from src.common.tool import DirectoryUtil, TimeUtils, Util +from src.common.obdiag_exception import OBDIAGFormatException +from src.common.ob_connector import OBConnector import csv from colorama import Fore, Style -from result_type import ObdiagResult +from src.common.result_type import ObdiagResult class GatherVariablesHandler(object): diff --git a/handler/gather/plugins/__init__.py b/src/handler/gather/plugins/__init__.py similarity index 100% rename from handler/gather/plugins/__init__.py rename to src/handler/gather/plugins/__init__.py diff --git a/handler/gather/plugins/redact.py b/src/handler/gather/plugins/redact.py similarity index 98% rename from handler/gather/plugins/redact.py rename to src/handler/gather/plugins/redact.py index 1c945e01..fbe8ff07 100644 --- a/handler/gather/plugins/redact.py +++ b/src/handler/gather/plugins/redact.py @@ -2,7 +2,7 @@ import shutil import tarfile -from common.import_module import import_modules +from src.common.import_module import import_modules import multiprocessing as mp diff --git a/handler/gather/scenes/__init__.py b/src/handler/gather/scenes/__init__.py similarity index 100% rename from handler/gather/scenes/__init__.py rename to src/handler/gather/scenes/__init__.py diff --git a/handler/gather/scenes/base.py b/src/handler/gather/scenes/base.py similarity index 96% rename from handler/gather/scenes/base.py rename to src/handler/gather/scenes/base.py index e71aec9f..b82156ef 100644 --- a/handler/gather/scenes/base.py +++ b/src/handler/gather/scenes/base.py @@ -15,10 +15,10 @@ @file: base.py @desc: """ -from stdio import SafeStdio -from common.scene import filter_by_version -from handler.gather.step.base import Base -from common.tool import StringUtils +from src.common.stdio import SafeStdio +from src.common.scene import filter_by_version +from src.handler.gather.step.base import Base +from src.common.tool import StringUtils class SceneBase(SafeStdio): diff --git a/handler/gather/scenes/list.py b/src/handler/gather/scenes/list.py similarity index 96% rename from handler/gather/scenes/list.py rename to src/handler/gather/scenes/list.py index 99e676a3..2b7d8894 100644 --- a/handler/gather/scenes/list.py +++ b/src/handler/gather/scenes/list.py @@ -18,11 +18,11 @@ import os -from result_type import ObdiagResult -from stdio import SafeStdio -from common.tool import YamlUtils -from handler.gather.scenes.register import hardcode_scene_list -from common.tool import Util, DynamicLoading +from src.common.result_type import ObdiagResult +from src.common.stdio import SafeStdio +from src.common.tool import YamlUtils +from src.handler.gather.scenes.register import hardcode_scene_list +from src.common.tool import Util, DynamicLoading class GatherScenesListHandler(SafeStdio): diff --git a/handler/gather/scenes/register.py b/src/handler/gather/scenes/register.py similarity index 100% rename from handler/gather/scenes/register.py rename to src/handler/gather/scenes/register.py diff --git a/handler/gather/step/__init__.py b/src/handler/gather/step/__init__.py similarity index 100% rename from handler/gather/step/__init__.py rename to src/handler/gather/step/__init__.py diff --git a/handler/gather/step/base.py b/src/handler/gather/step/base.py similarity index 94% rename from handler/gather/step/base.py rename to src/handler/gather/step/base.py index 76963637..8b1d8e7a 100644 --- a/handler/gather/step/base.py +++ b/src/handler/gather/step/base.py @@ -15,12 +15,12 @@ @file: base.py @desc: """ -from common.ssh_client.ssh import SshClient -from handler.gather.gather_component_log import GatherComponentLogHandler -from stdio import SafeStdio -from handler.gather.step.ssh import SshHandler -from handler.gather.step.sql import StepSQLHandler -from handler.gather.gather_sysstat import GatherOsInfoHandler +from src.common.ssh_client.ssh import SshClient +from src.handler.gather.gather_component_log import GatherComponentLogHandler +from src.common.stdio import SafeStdio +from src.handler.gather.step.ssh import SshHandler +from src.handler.gather.step.sql import StepSQLHandler +from src.handler.gather.gather_sysstat import GatherOsInfoHandler class Base(SafeStdio): diff --git a/handler/gather/step/sql.py b/src/handler/gather/step/sql.py similarity index 97% rename from handler/gather/step/sql.py rename to src/handler/gather/step/sql.py index c754fca6..5fb79ec2 100644 --- a/handler/gather/step/sql.py +++ b/src/handler/gather/step/sql.py @@ -17,10 +17,10 @@ """ import os import re -from stdio import SafeStdio -from common.ob_connector import OBConnector +from src.common.stdio import SafeStdio +from src.common.ob_connector import OBConnector from tabulate import tabulate -from common.tool import StringUtils +from src.common.tool import StringUtils class StepSQLHandler(SafeStdio): diff --git a/handler/gather/step/ssh.py b/src/handler/gather/step/ssh.py similarity index 95% rename from handler/gather/step/ssh.py rename to src/handler/gather/step/ssh.py index 859c0fc2..71655262 100644 --- a/handler/gather/step/ssh.py +++ b/src/handler/gather/step/ssh.py @@ -17,9 +17,9 @@ """ import os -from common.ssh_client.ssh import SshClient -from stdio import SafeStdio -from common.tool import StringUtils +from src.common.ssh_client.ssh import SshClient +from src.common.stdio import SafeStdio +from src.common.tool import StringUtils class SshHandler(SafeStdio): diff --git a/handler/meta/__init__.py b/src/handler/meta/__init__.py similarity index 100% rename from handler/meta/__init__.py rename to src/handler/meta/__init__.py diff --git a/handler/meta/check_meta.py b/src/handler/meta/check_meta.py similarity index 100% rename from handler/meta/check_meta.py rename to src/handler/meta/check_meta.py diff --git a/handler/meta/html_meta.py b/src/handler/meta/html_meta.py similarity index 100% rename from handler/meta/html_meta.py rename to src/handler/meta/html_meta.py diff --git a/handler/meta/ob_error.py b/src/handler/meta/ob_error.py similarity index 100% rename from handler/meta/ob_error.py rename to src/handler/meta/ob_error.py diff --git a/handler/meta/sql_meta.py b/src/handler/meta/sql_meta.py similarity index 100% rename from handler/meta/sql_meta.py rename to src/handler/meta/sql_meta.py diff --git a/handler/rca/__init__.py b/src/handler/rca/__init__.py similarity index 100% rename from handler/rca/__init__.py rename to src/handler/rca/__init__.py diff --git a/handler/rca/plugins/__init__.py b/src/handler/rca/plugins/__init__.py similarity index 100% rename from handler/rca/plugins/__init__.py rename to src/handler/rca/plugins/__init__.py diff --git a/handler/rca/plugins/gather.py b/src/handler/rca/plugins/gather.py similarity index 98% rename from handler/rca/plugins/gather.py rename to src/handler/rca/plugins/gather.py index 3c5fcdc0..058e9c24 100644 --- a/handler/rca/plugins/gather.py +++ b/src/handler/rca/plugins/gather.py @@ -17,7 +17,7 @@ """ import os.path -from handler.gather.gather_component_log import GatherComponentLogHandler +from src.handler.gather.gather_component_log import GatherComponentLogHandler class Gather_log: diff --git a/handler/rca/rca_exception.py b/src/handler/rca/rca_exception.py similarity index 100% rename from handler/rca/rca_exception.py rename to src/handler/rca/rca_exception.py diff --git a/handler/rca/rca_handler.py b/src/handler/rca/rca_handler.py similarity index 98% rename from handler/rca/rca_handler.py rename to src/handler/rca/rca_handler.py index a51d8d8b..445109a2 100644 --- a/handler/rca/rca_handler.py +++ b/src/handler/rca/rca_handler.py @@ -21,24 +21,24 @@ import xmltodict import yaml from textwrap import fill -from common.command import ( +from src.common.command import ( get_obproxy_version, get_observer_version, ) import traceback from prettytable import PrettyTable -from common.ob_connector import OBConnector -from common.ssh_client.ssh import SshClient -from handler.rca.plugins.gather import Gather_log -from handler.rca.rca_exception import RCANotNeedExecuteException, RCAReportException -from handler.rca.rca_list import RcaScenesListHandler -from common.tool import Util -from common.tool import StringUtils +from src.common.ob_connector import OBConnector +from src.common.ssh_client.ssh import SshClient +from src.handler.rca.plugins.gather import Gather_log +from src.handler.rca.rca_exception import RCANotNeedExecuteException, RCAReportException +from src.handler.rca.rca_list import RcaScenesListHandler +from src.common.tool import Util +from src.common.tool import StringUtils from colorama import Fore, Style from jinja2 import Template -from result_type import ObdiagResult -from common.version import OBDIAG_VERSION -from common.scene import get_version_by_type +from src.common.result_type import ObdiagResult +from src.common.version import OBDIAG_VERSION +from src.common.scene import get_version_by_type class RCAHandler: diff --git a/handler/rca/rca_list.py b/src/handler/rca/rca_list.py similarity index 95% rename from handler/rca/rca_list.py rename to src/handler/rca/rca_list.py index 515298a0..e293037a 100644 --- a/handler/rca/rca_list.py +++ b/src/handler/rca/rca_list.py @@ -16,10 +16,10 @@ @desc: """ import os.path -from common.constant import const -from common.tool import DynamicLoading -from common.tool import Util -from result_type import ObdiagResult +from src.common.constant import const +from src.common.tool import DynamicLoading +from src.common.tool import Util +from src.common.result_type import ObdiagResult class RcaScenesListHandler: diff --git a/update/__init__.py b/src/handler/update/__init__.py similarity index 100% rename from update/__init__.py rename to src/handler/update/__init__.py diff --git a/update/update.py b/src/handler/update/update.py similarity index 97% rename from update/update.py rename to src/handler/update/update.py index 0390bad3..6224ae6c 100644 --- a/update/update.py +++ b/src/handler/update/update.py @@ -18,15 +18,15 @@ import os import shutil import time -from common.constant import const -from common.tool import FileUtil -from common.tool import NetUtils -from common.tool import StringUtils -from common.tool import Util -from common.version import OBDIAG_VERSION +from src.common.constant import const +from src.common.tool import FileUtil +from src.common.tool import NetUtils +from src.common.tool import StringUtils +from src.common.tool import Util +from src.common.version import OBDIAG_VERSION import yaml -from result_type import ObdiagResult +from src.common.result_type import ObdiagResult # for update obdiag files without obdiag diff --git a/main.py b/src/main.py similarity index 93% rename from main.py rename to src/main.py index f3434a45..ef157c50 100644 --- a/main.py +++ b/src/main.py @@ -16,8 +16,8 @@ """ import sys -from diag_cmd import MainCommand -from stdio import IO +from common.diag_cmd import MainCommand +from common.stdio import IO ROOT_IO = IO(1) diff --git a/telemetry/__init__.py b/src/telemetry/__init__.py similarity index 100% rename from telemetry/__init__.py rename to src/telemetry/__init__.py diff --git a/telemetry/telemetry.py b/src/telemetry/telemetry.py similarity index 96% rename from telemetry/telemetry.py rename to src/telemetry/telemetry.py index 680510e8..378d91ef 100644 --- a/telemetry/telemetry.py +++ b/src/telemetry/telemetry.py @@ -22,13 +22,13 @@ import time import hashlib from io import open -from common.constant import const -from common.ob_connector import OBConnector -from common.tool import NetUtils -from common.tool import DateTimeEncoder -from common.version import get_obdiag_version +from src.common.constant import const +from src.common.ob_connector import OBConnector +from src.common.tool import NetUtils +from src.common.tool import DateTimeEncoder +from src.common.version import get_obdiag_version import ssl -from stdio import IO +from src.common.stdio import IO ssl._create_default_https_context = ssl._create_unverified_context diff --git a/test/analyzer/log/test_tree.py b/test/analyzer/log/test_tree.py index f26520a9..8ae269ff 100644 --- a/test/analyzer/log/test_tree.py +++ b/test/analyzer/log/test_tree.py @@ -16,7 +16,7 @@ @desc: """ -from handler.analyzer.log_parser.tree import Tree +from src.handler.analyzer.log_parser.tree import Tree file_datas = [ {'host_ip': '192.168.1.1', 'host_type': 'OBSERVER', 'trace_data': {"trace_id": "1", "name": "open1", "id": "1", "parent_id": "00000000-0000-0000-0000-000000000000", "is_follow": "false", "start_ts": 1662107166232204, "end_ts": 1662107166233214}}, diff --git a/test/analyzer/sql/test_arithmetic_rule.py b/test/analyzer/sql/test_arithmetic_rule.py index 345fd5d1..05ea5f16 100644 --- a/test/analyzer/sql/test_arithmetic_rule.py +++ b/test/analyzer/sql/test_arithmetic_rule.py @@ -16,9 +16,9 @@ @desc: """ import unittest -from handler.analyzer.sql.rules.review.arithmetic import ArithmeticRule +from src.handler.analyzer.sql.rules.review.arithmetic import ArithmeticRule from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level class TestArithmeticRuleWithRealSQL(unittest.TestCase): diff --git a/test/analyzer/sql/test_full_scan_rule.py b/test/analyzer/sql/test_full_scan_rule.py index ef44b4d0..622094a8 100644 --- a/test/analyzer/sql/test_full_scan_rule.py +++ b/test/analyzer/sql/test_full_scan_rule.py @@ -16,9 +16,9 @@ @desc: """ import unittest -from handler.analyzer.sql.rules.review.full_scan import FullScanRule +from src.handler.analyzer.sql.rules.review.full_scan import FullScanRule from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level class TestFullScanRule(unittest.TestCase): diff --git a/test/analyzer/sql/test_is_null_rule.py b/test/analyzer/sql/test_is_null_rule.py index a23627c5..a27587e8 100644 --- a/test/analyzer/sql/test_is_null_rule.py +++ b/test/analyzer/sql/test_is_null_rule.py @@ -16,9 +16,9 @@ @desc: """ import unittest -from handler.analyzer.sql.rules.review.is_null import IsNullRule +from src.handler.analyzer.sql.rules.review.is_null import IsNullRule from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level class TestIsNullRule(unittest.TestCase): diff --git a/test/analyzer/sql/test_large_in_clause_rule.py b/test/analyzer/sql/test_large_in_clause_rule.py index 4eb05923..835c880c 100644 --- a/test/analyzer/sql/test_large_in_clause_rule.py +++ b/test/analyzer/sql/test_large_in_clause_rule.py @@ -17,9 +17,9 @@ """ import unittest -from handler.analyzer.sql.rules.review.large_in_clause import LargeInClauseAdjustedRule +from src.handler.analyzer.sql.rules.review.large_in_clause import LargeInClauseAdjustedRule from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level class TestLargeInClauseAdjustedRule(unittest.TestCase): diff --git a/test/analyzer/sql/test_multi_table_join_rule.py b/test/analyzer/sql/test_multi_table_join_rule.py index d758620e..056dcebb 100644 --- a/test/analyzer/sql/test_multi_table_join_rule.py +++ b/test/analyzer/sql/test_multi_table_join_rule.py @@ -16,9 +16,9 @@ @desc: """ import unittest -from handler.analyzer.sql.rules.review.multi_table_join import MultiTableJoinRule +from src.handler.analyzer.sql.rules.review.multi_table_join import MultiTableJoinRule from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level class TestMultiTableJoinRule(unittest.TestCase): diff --git a/test/analyzer/sql/test_sellect_all_rule.py b/test/analyzer/sql/test_sellect_all_rule.py index 2a3f1468..b26e88d6 100644 --- a/test/analyzer/sql/test_sellect_all_rule.py +++ b/test/analyzer/sql/test_sellect_all_rule.py @@ -17,7 +17,7 @@ """ import unittest from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.review.select_all import SelectAllRule +from src.handler.analyzer.sql.rules.review.select_all import SelectAllRule class TestSelectAllCase(unittest.TestCase): diff --git a/test/analyzer/sql/test_update_delete_multi_table_rule.py b/test/analyzer/sql/test_update_delete_multi_table_rule.py index 1e044492..afd93eea 100644 --- a/test/analyzer/sql/test_update_delete_multi_table_rule.py +++ b/test/analyzer/sql/test_update_delete_multi_table_rule.py @@ -16,9 +16,9 @@ @desc: """ import unittest -from handler.analyzer.sql.rules.review.update_delete_multi_table import UpdateDeleteMultiTableRule +from src.handler.analyzer.sql.rules.review.update_delete_multi_table import UpdateDeleteMultiTableRule from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level class TestUpdateDeleteMultiTableRule(unittest.TestCase): diff --git a/test/analyzer/sql/test_update_delete_without_where_or_true_condition_rule.py b/test/analyzer/sql/test_update_delete_without_where_or_true_condition_rule.py index 97c9c0d2..a1f7826e 100644 --- a/test/analyzer/sql/test_update_delete_without_where_or_true_condition_rule.py +++ b/test/analyzer/sql/test_update_delete_without_where_or_true_condition_rule.py @@ -16,9 +16,9 @@ @desc: """ import unittest -from handler.analyzer.sql.rules.review.update_delete_without_where_or_true_condition import UpdateDeleteWithoutWhereOrTrueConditionRule +from src.handler.analyzer.sql.rules.review.update_delete_without_where_or_true_condition import UpdateDeleteWithoutWhereOrTrueConditionRule from sqlgpt_parser.parser.oceanbase_parser import parser -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level class TestUpdateDeleteWithoutWhereConditionRule(unittest.TestCase): diff --git a/test/analyzer/test_level.py b/test/analyzer/test_level.py index e0c696f9..8aecc406 100644 --- a/test/analyzer/test_level.py +++ b/test/analyzer/test_level.py @@ -16,7 +16,7 @@ @desc: """ import unittest -from handler.analyzer.sql.rules.level import Level +from src.handler.analyzer.sql.rules.level import Level class TestLevelEnum(unittest.TestCase): diff --git a/test/analyzer/test_tree.py b/test/analyzer/test_tree.py index f26520a9..8ae269ff 100644 --- a/test/analyzer/test_tree.py +++ b/test/analyzer/test_tree.py @@ -16,7 +16,7 @@ @desc: """ -from handler.analyzer.log_parser.tree import Tree +from src.handler.analyzer.log_parser.tree import Tree file_datas = [ {'host_ip': '192.168.1.1', 'host_type': 'OBSERVER', 'trace_data': {"trace_id": "1", "name": "open1", "id": "1", "parent_id": "00000000-0000-0000-0000-000000000000", "is_follow": "false", "start_ts": 1662107166232204, "end_ts": 1662107166233214}}, diff --git a/test/common/ssh_client/test_docker_client.py b/test/common/ssh_client/test_docker_client.py index f261f25c..320f2e6e 100644 --- a/test/common/ssh_client/test_docker_client.py +++ b/test/common/ssh_client/test_docker_client.py @@ -17,11 +17,11 @@ """ import unittest -from unittest.mock import patch, MagicMock, call +from unittest.mock import patch, MagicMock from docker import DockerClient as DockerClientSDK -from common.ssh_client.docker_client import DockerClient -from context import HandlerContext -from common.obdiag_exception import OBDIAGShellCmdException +from src.common.ssh_client.docker_client import DockerClient +from src.common.context import HandlerContext +from src.common.obdiag_exception import OBDIAGShellCmdException class TestDockerClient(unittest.TestCase): diff --git a/test/common/ssh_client/test_kubernetes_client.py b/test/common/ssh_client/test_kubernetes_client.py index d6a80168..340a0a45 100644 --- a/test/common/ssh_client/test_kubernetes_client.py +++ b/test/common/ssh_client/test_kubernetes_client.py @@ -18,11 +18,10 @@ import unittest import os -from unittest.mock import MagicMock, mock_open, patch +from unittest.mock import MagicMock, patch from kubernetes import config -from kubernetes.stream import stream -from context import HandlerContext -from common.ssh_client.kubernetes_client import KubernetesClient +from src.common.context import HandlerContext +from src.common.ssh_client.kubernetes_client import KubernetesClient from kubernetes.client.api.core_v1_api import CoreV1Api from tempfile import NamedTemporaryFile from kubernetes.client import ApiClient diff --git a/test/common/ssh_client/test_local_client.py b/test/common/ssh_client/test_local_client.py index b946c50e..066a237b 100644 --- a/test/common/ssh_client/test_local_client.py +++ b/test/common/ssh_client/test_local_client.py @@ -17,10 +17,10 @@ """ import unittest -import subprocess32 as subprocess +import subprocess from unittest.mock import patch, MagicMock -from common.ssh_client.local_client import LocalClient -from context import HandlerContext +from src.common.ssh_client.local_client import LocalClient +from src.common.context import HandlerContext class TestLocalClient(unittest.TestCase): diff --git a/test/common/ssh_client/test_remote_client.py b/test/common/ssh_client/test_remote_client.py index 53cdab24..058f4226 100644 --- a/test/common/ssh_client/test_remote_client.py +++ b/test/common/ssh_client/test_remote_client.py @@ -19,9 +19,9 @@ import unittest from io import StringIO from unittest.mock import patch, MagicMock -from common.ssh_client.remote_client import RemoteClient +from src.common.ssh_client.remote_client import RemoteClient from paramiko.ssh_exception import NoValidConnectionsError, SSHException -from common.obdiag_exception import OBDIAGSSHConnException, OBDIAGShellCmdException +from src.common.obdiag_exception import OBDIAGSSHConnException, OBDIAGShellCmdException class TestRemoteClient(unittest.TestCase): diff --git a/test/common/test_command.py b/test/common/test_command.py index ac78f06e..91d600eb 100644 --- a/test/common/test_command.py +++ b/test/common/test_command.py @@ -18,7 +18,7 @@ import unittest from unittest.mock import Mock, patch import subprocess -from common.command import * +from src.common.command import LocalClient, delete_file_in_folder, rm_rf_file, upload_file, download_file class TestLocalClient(unittest.TestCase): @@ -157,7 +157,7 @@ def test_upload_file_success(self): remote_path = "/remote/path/file.txt" self.ssh_client.get_name.return_value = "test_server" - result = upload_file(self.ssh_client, local_path, remote_path, self.stdio) + upload_file(self.ssh_client, local_path, remote_path, self.stdio) self.ssh_client.upload.assert_called_once_with(remote_path, local_path) self.stdio.verbose.assert_called_once_with("Please wait a moment, upload file to server test_server, local file path /local/path/file.txt, remote file path /remote/path/file.txt") diff --git a/test/common/test_config_helper.py b/test/common/test_config_helper.py index 0137dd73..d5e7a4ff 100644 --- a/test/common/test_config_helper.py +++ b/test/common/test_config_helper.py @@ -17,7 +17,7 @@ """ import unittest from unittest import mock -from common.config_helper import ConfigHelper +from src.common.config_helper import ConfigHelper class TestConfigHelper(unittest.TestCase): diff --git a/test/common/test_config_parse.py b/test/common/test_config_parse.py index 2b47900e..c138e5b9 100644 --- a/test/common/test_config_parse.py +++ b/test/common/test_config_parse.py @@ -17,7 +17,7 @@ """ import unittest -from common.tool import ConfigOptionsParserUtil +from src.common.tool import ConfigOptionsParserUtil class TestConfigParser(unittest.TestCase): diff --git a/test/common/test_scene.py b/test/common/test_scene.py index 21ad57d3..ec8def50 100644 --- a/test/common/test_scene.py +++ b/test/common/test_scene.py @@ -17,7 +17,9 @@ """ import unittest from unittest.mock import MagicMock, patch -from common.scene import * + +from src.common.scene import filter_by_version, get_version_by_type +from src.common.tool import StringUtils class TestFilterByVersion(unittest.TestCase):