Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat: add http interface to get all configs #704

Merged
merged 9 commits into from
Dec 31, 2020

Conversation

levy5307
Copy link
Contributor

@levy5307 levy5307 commented Dec 23, 2020

add a http interface to get all configs

Manual Test

  1. Start onebox
  2. use http://localhost:34601/configs to get all the configs, the result shows:
{"abnormal_write_trace_latency_threshold":"{\"name\":\"abnormal_write_trace_latency_threshold\",\"section\":\"replication\",\"type\":\"4\",\"tags\":\"\",\"description\":\"latency trace will be logged when exceed the write latency threshold\",\"value\":\"1000000000\"}\n","aio_factory_name":"{\"name\":\"aio_factory_name\",\"section\":\"core\",\"type\":\"6\",\"tags\":\"\",\"description\":\"asynchonous file system provider\",\"value\":\"dsn::tools::native_aio_provider\"}\n","capacity_unit_saving_ttl_days":"{\"name\":\"capacity_unit_saving_ttl_days\",\"section\":\"pegasus.collector\",\"type\":\"1\",\"tags\":\"\",\"description\":\"the ttl of the CU data, 0 if no ttl\",\"value\":\"90\"}\n","enable_acl":"{\"name\":\"enable_acl\",\"section\":\"security\",\"type\":\"0\",\"tags\":\"flag_tag::FT_MUTABLE\",\"description\":\"whether enable access controller or not\",\"value\":\"false\"}\n","enable_auth":"{\"name\":\"enable_auth\",\"section\":\"security\",\"type\":\"0\",\"tags\":\"\",\"description\":\"whether open auth or not\",\"value\":\"false\"}\n","enable_detect_hotkey":"{\"name\":\"enable_detect_hotkey\",\"section\":\"pegasus.collector\",\"type\":\"0\",\"tags\":\"\",\"description\":\"auto detect hot key in the hot paritition\",\"value\":\"false\"}\n","enable_http_server":"{\"name\":\"enable_http_server\",\"section\":\"http\",\"type\":\"0\",\"tags\":\"\",\"description\":\"whether to enable the embedded HTTP server\",\"value\":\"true\"}\n","enable_latency_tracer":"{\"name\":\"enable_latency_tracer\",\"section\":\"replication\",\"type\":\"0\",\"tags\":\"\",\"description\":\"whether enable the latency tracer\",\"value\":\"false\"}\n","falcon_host":"{\"name\":\"falcon_host\",\"section\":\"pegasus.server\",\"type\":\"6\",\"tags\":\"\",\"description\":\"falcon agent host\",\"value\":\"127.0.0.1\"}\n","falcon_path":"{\"name\":\"falcon_path\",\"section\":\"pegasus.server\",\"type\":\"6\",\"tags\":\"\",\"description\":\"falcon agent http path\",\"value\":\"/v1/push\"}\n","falcon_port":"{\"name\":\"falcon_port\",\"section\":\"pegasus.server\",\"type\":\"4\",\"tags\":\"\",\"description\":\"falcon agent port\",\"value\":\"1988\"}\n","fast_flush":"{\"name\":\"fast_flush\",\"section\":\"tools.simple_logger\",\"type\":\"0\",\"tags\":\"\",\"description\":\"whether to flush immediately\",\"value\":\"false\"}\n","fds_read_batch_size":"{\"name\":\"fds_read_batch_size\",\"section\":\"replication\",\"type\":\"2\",\"tags\":\"\",\"description\":\"read batch size of fds(MB)\",\"value\":\"100\"}\n","fds_read_limit_rate":"{\"name\":\"fds_read_limit_rate\",\"section\":\"replication\",\"type\":\"2\",\"tags\":\"\",\"description\":\"read rate limit of fds(MB/s)\",\"value\":\"100\"}\n","fds_write_limit_rate":"{\"name\":\"fds_write_limit_rate\",\"section\":\"replication\",\"type\":\"2\",\"tags\":\"\",\"description\":\"write rate limit of fds(MB/s)\",\"value\":\"100\"}\n","file_close_expire_time_ms":"{\"name\":\"file_close_expire_time_ms\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"max idle time for an opening file on nfs server\",\"value\":\"60000\"}\n","file_close_timer_interval_ms_on_server":"{\"name\":\"file_close_timer_interval_ms_on_server\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"time interval for checking whether cached file handles need to be closed\",\"value\":\"30000\"}\n","hdfs_read_batch_size_bytes":"{\"name\":\"hdfs_read_batch_size_bytes\",\"section\":\"replication\",\"type\":\"4\",\"tags\":\"\",\"description\":\"hdfs read batch size, the default value is 64MB\",\"value\":\"67108864\"}\n","hdfs_write_batch_size_bytes":"{\"name\":\"hdfs_write_batch_size_bytes\",\"section\":\"replication\",\"type\":\"4\",\"tags\":\"\",\"description\":\"hdfs write batch size, the default value is 64MB\",\"value\":\"67108864\"}\n","high_priority_speed_rate":"{\"name\":\"high_priority_speed_rate\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"the copy speed rate of high priority comparing with low priority on nfs client\",\"value\":\"2\"}\n","hot_bucket_variance_threshold":"{\"name\":\"hot_bucket_variance_threshold\",\"section\":\"pegasus.server\",\"type\":\"2\",\"tags\":\"\",\"description\":\"the variance threshold to detect hot bucket during coarse analysis of hotkey detection\",\"value\":\"3\"}\n","hot_key_variance_threshold":"{\"name\":\"hot_key_variance_threshold\",\"section\":\"pegasus.server\",\"type\":\"2\",\"tags\":\"\",\"description\":\"the variance threshold to detect hot key during fine analysis of hotkey detection\",\"value\":\"3\"}\n","hot_partition_threshold":"{\"name\":\"hot_partition_threshold\",\"section\":\"pegasus.collector\",\"type\":\"1\",\"tags\":\"\",\"description\":\"threshold of hotspot partition value, if app.stat.hotspots >= FLAGS_hotpartition_threshold, this partition is a hot partition\",\"value\":\"3\"}\n","hotkey_analyse_time_interval_s":"{\"name\":\"hotkey_analyse_time_interval_s\",\"section\":\"pegasus.server\",\"type\":\"1\",\"tags\":\"\",\"description\":\"hotkey analyse interval in seconds\",\"value\":\"10\"}\n","hotkey_buckets_num":"{\"name\":\"hotkey_buckets_num\",\"section\":\"pegasus.server\",\"type\":\"2\",\"tags\":\"\",\"description\":\"the number of data capture hash buckets\",\"value\":\"37\"}\n","krb5_config":"{\"name\":\"krb5_config\",\"section\":\"security\",\"type\":\"6\",\"tags\":\"\",\"description\":\"absolute path of krb5_config file\",\"value\":\"\"}\n","krb5_keytab":"{\"name\":\"krb5_keytab\",\"section\":\"security\",\"type\":\"6\",\"tags\":\"\",\"description\":\"absolute path of keytab file\",\"value\":\"\"}\n","krb5_principal":"{\"name\":\"krb5_principal\",\"section\":\"security\",\"type\":\"6\",\"tags\":\"\",\"description\":\"kerberos principal\",\"value\":\"\"}\n","logging_flush_on_exit":"{\"name\":\"logging_flush_on_exit\",\"section\":\"core\",\"type\":\"0\",\"tags\":\"\",\"description\":\"flush log when exit system\",\"value\":\"true\"}\n","logging_start_level":"{\"name\":\"logging_start_level\",\"section\":\"core\",\"type\":\"6\",\"tags\":\"\",\"description\":\"logs with level below this will not be logged\",\"value\":\"LOG_LEVEL_DEBUG\"}\n","mandatory_auth":"{\"name\":\"mandatory_auth\",\"section\":\"security\",\"type\":\"0\",\"tags\":\"flag_tag::FT_MUTABLE\",\"description\":\"wheter to do authertication mandatorily\",\"value\":\"false\"}\n","max_buffered_local_writes":"{\"name\":\"max_buffered_local_writes\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"max buffered file writes on nfs client\",\"value\":\"500\"}\n","max_concurrent_bulk_load_downloading_count":"{\"name\":\"max_concurrent_bulk_load_downloading_count\",\"section\":\"replication\",\"type\":\"1\",\"tags\":\"\",\"description\":\"concurrent bulk load downloading replica count\",\"value\":\"5\"}\n","max_concurrent_local_writes":"{\"name\":\"max_concurrent_local_writes\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"max local file writes on nfs client\",\"value\":\"50\"}\n","max_concurrent_remote_copy_requests":"{\"name\":\"max_concurrent_remote_copy_requests\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"max concurrent remote copy to the same server on nfs client\",\"value\":\"50\"}\n","max_concurrent_uploading_file_count":"{\"name\":\"max_concurrent_uploading_file_count\",\"section\":\"replication\",\"type\":\"4\",\"tags\":\"\",\"description\":\"concurrent uploading file count to block service\",\"value\":\"10\"}\n","max_copy_rate_megabytes":"{\"name\":\"max_copy_rate_megabytes\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"max rate of copying from remote node(MB/s)\",\"value\":\"500\"}\n","max_file_copy_request_count_per_file":"{\"name\":\"max_file_copy_request_count_per_file\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"maximum concurrent remote copy requests for the same file on nfs clientto limit each file copy speed\",\"value\":\"2\"}\n","max_hotspot_store_size":"{\"name\":\"max_hotspot_store_size\",\"section\":\"pegasus.collector\",\"type\":\"3\",\"tags\":\"\",\"description\":\"the max count of historical data stored in calculator, The FIFO queue design is used to eliminate outdated historical data\",\"value\":\"100\"}\n","max_number_of_log_files_on_disk":"{\"name\":\"max_number_of_log_files_on_disk\",\"section\":\"tools.simple_logger\",\"type\":\"4\",\"tags\":\"\",\"description\":\"max number of log files reserved on disk, older logs are auto deleted\",\"value\":\"20\"}\n","max_retry_count_per_copy_request":"{\"name\":\"max_retry_count_per_copy_request\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"maximum retry count when copy failed\",\"value\":\"2\"}\n","max_seconds_to_detect_hotkey":"{\"name\":\"max_seconds_to_detect_hotkey\",\"section\":\"pegasus.server\",\"type\":\"2\",\"tags\":\"\",\"description\":\"the max time (in seconds) allowed to capture hotkey, will stop if hotkey's not found\",\"value\":\"150\"}\n","meta_acl_rpc_allow_list":"{\"name\":\"meta_acl_rpc_allow_list\",\"section\":\"security\",\"type\":\"6\",\"tags\":\"\",\"description\":\"allowed list of rpc codes for meta_access_controller\",\"value\":\"\"}\n","nfs_copy_block_bytes":"{\"name\":\"nfs_copy_block_bytes\",\"section\":\"nfs\",\"type\":\"2\",\"tags\":\"\",\"description\":\"max block size (bytes) for each network copy\",\"value\":\"4194304\"}\n","occurrence_threshold":"{\"name\":\"occurrence_threshold\",\"section\":\"pegasus.collector\",\"type\":\"1\",\"tags\":\"\",\"description\":\"hot paritiotion occurrence times' threshold to send rpc to detect hotkey\",\"value\":\"100\"}\n","perf_counter_enable_logging":"{\"name\":\"perf_counter_enable_logging\",\"section\":\"pegasus.server\",\"type\":\"0\",\"tags\":\"\",\"description\":\"perf_counter_enable_logging\",\"value\":\"false\"}\n","perf_counter_sink":"{\"name\":\"perf_counter_sink\",\"section\":\"pegasus.server\",\"type\":\"6\",\"tags\":\"\",\"description\":\"perf_counter_sink\",\"value\":\"\"}\n","perf_counter_update_interval_seconds":"{\"name\":\"perf_counter_update_interval_seconds\",\"section\":\"pegasus.server\",\"type\":\"4\",\"tags\":\"\",\"description\":\"perf_counter_update_interval_seconds\",\"value\":\"10\"}\n","prometheus_port":"{\"name\":\"prometheus_port\",\"section\":\"pegasus.server\",\"type\":\"4\",\"tags\":\"\",\"description\":\"prometheus exposer port\",\"value\":\"9095\"}\n","rocksdb_limiter_enable_auto_tune":"{\"name\":\"rocksdb_limiter_enable_auto_tune\",\"section\":\"pegasus.server\",\"type\":\"0\",\"tags\":\"\",\"description\":\"whether to enable write rate auto tune when open rocksdb write limit\",\"value\":\"false\"}\n","rocksdb_limiter_max_write_megabytes_per_sec":"{\"name\":\"rocksdb_limiter_max_write_megabytes_per_sec\",\"section\":\"pegasus.server\",\"type\":\"3\",\"tags\":\"\",\"description\":\"max rate of rocksdb flush and compaction(MB/s), if less than or equal to 0 means close limit\",\"value\":\"500\"}\n","rocksdb_target_file_size_base":"{\"name\":\"rocksdb_target_file_size_base\",\"section\":\"pegasus.server\",\"type\":\"4\",\"tags\":\"\",\"description\":\"rocksdb options.target_file_size_base\",\"value\":\"67108864\"}\n","rocksdb_write_buffer_size":"{\"name\":\"rocksdb_write_buffer_size\",\"section\":\"pegasus.server\",\"type\":\"4\",\"tags\":\"\",\"description\":\"rocksdb options.write_buffer_size\",\"value\":\"67108864\"}\n","rpc_timeout_ms":"{\"name\":\"rpc_timeout_ms\",\"section\":\"nfs\",\"type\":\"1\",\"tags\":\"\",\"description\":\"rpc timeout in milliseconds for nfs copy, 0 means use default timeout of rpc engine\",\"value\":\"10000\"}\n","sasl_plugin_path":"{\"name\":\"sasl_plugin_path\",\"section\":\"security\",\"type\":\"6\",\"tags\":\"\",\"description\":\"path to search sasl plugins\",\"value\":\"/usr/lib/sasl2\"}\n","service_fqdn":"{\"name\":\"service_fqdn\",\"section\":\"security\",\"type\":\"6\",\"tags\":\"\",\"description\":\"the fully qualified domain name of the server\",\"value\":\"\"}\n","service_name":"{\"name\":\"service_name\",\"section\":\"security\",\"type\":\"6\",\"tags\":\"\",\"description\":\"service name\",\"value\":\"\"}\n","short_header":"{\"name\":\"short_header\",\"section\":\"tools.simple_logger\",\"type\":\"0\",\"tags\":\"\",\"description\":\"whether to use short header (excluding file/function etc.)\",\"value\":\"false\"}\n","stderr_start_level":"{\"name\":\"stderr_start_level\",\"section\":\"tools.simple_logger\",\"type\":\"6\",\"tags\":\"\",\"description\":\"copy log messages at or above this level to stderr in addition to logfiles\",\"value\":\"LOG_LEVEL_ERROR\"}\n","super_users":"{\"name\":\"super_users\",\"section\":\"security\",\"type\":\"6\",\"tags\":\"\",\"description\":\"super user for access controller\",\"value\":\"\"}\n"}


void list_all_configs(const http_request &req, http_response &resp)
{
if (req.query_args.size() != 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why check query_args ?

Copy link
Contributor Author

@levy5307 levy5307 Dec 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone may misunderstand the usage of this interface, and maybe he want to add a query arg to get a special config. the check is used for reminding him.

@levy5307 levy5307 closed this Dec 23, 2020
@levy5307 levy5307 reopened this Dec 23, 2020
@zhangyifan27
Copy link
Contributor

It seems that we just got discriptions of flags. Can we get the value of flags through this interface?

acelyc111
acelyc111 previously approved these changes Dec 24, 2020
src/http/builtin_http_calls.cpp Outdated Show resolved Hide resolved
@levy5307 levy5307 marked this pull request as draft December 28, 2020 08:12
@levy5307 levy5307 marked this pull request as ready for review December 28, 2020 08:34
neverchanje
neverchanje previously approved these changes Dec 29, 2020
hycdong
hycdong previously approved these changes Dec 30, 2020
@neverchanje neverchanje merged commit 0ffd3ed into XiaoMi:master Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants