Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

server: adjust the result of curl * #9104

Merged
merged 1 commit into from
Jan 17, 2019
Merged

server: adjust the result of curl * #9104

merged 1 commit into from
Jan 17, 2019

Conversation

xiekeyi98
Copy link
Contributor

Now the result of curl will be displayed in oneline.
It is hard to read and hard to grep.
We should better make it pretty.

What problem does this PR solve?

Make http response more readable.

What is changed and how it works?

Change the interface of writeData

Side effects

All functions which use writeData to write Http Response WILL BE AFFECTED!!!!

Before

Keyi Xie [5:23 PM]
xiekeyi@ubuntu:~$ curl http://127.0.0.1:10080/settings
{"host":"0.0.0.0","advertise-address":"","port":4000,"cors":"","store":"mocktikv","path":"/tmp/tidb","socket":"","lease":"45s","run-ddl":true,"split-table":true,"token-limit":1000,"oom-action":"log","mem-quota-query":34359738368,"enable-streaming":false,"txn-local-latches":{"enabled":true,"capacity":2048000},"lower-case-table-names":2,"log":{"level":"info","format":"text","disable-timestamp":false,"file":{"filename":"","log-rotate":true,"max-size":300,"max-days":0,"max-backups":0},"slow-query-file":"","slow-threshold":300,"expensive-threshold":10000,"query-log-max-len":2048},"security":{"skip-grant-table":false,"ssl-ca":"","ssl-cert":"","ssl-key":"","cluster-ssl-ca":"","cluster-ssl-cert":"","cluster-ssl-key":""},"status":{"report-status":true,"status-port":10080,"metrics-addr":"","metrics-interval":15},"performance":{"max-procs":0,"max-memory":0,"tcp-keep-alive":true,"cross-join":true,"stats-lease":"3s","run-auto-analyze":true,"stmt-count-limit":5000,"feedback-probability":0.05,"query-feedback-limit":1024,"pseudo-estimate-ratio":0.8,"force-priority":"NO_PRIORITY"},"prepared-plan-cache":{"enabled":false,"capacity":100,"memory-guard-ratio":0.1},"opentracing":{"enable":false,"sampler":{"type":"const","param":1,"sampling-server-url":"","max-operations":0,"sampling-refresh-interval":0},"reporter":{"queue-size":0,"buffer-flush-interval":0,"log-spans":false,"local-agent-host-port":""},"rpc-metrics":false},"proxy-protocol":{"networks":"","header-timeout":5},"tikv-client":{"grpc-connection-count":16,"grpc-keepalive-time":10,"grpc-keepalive-timeout":3,"commit-timeout":"41s","max-txn-time-use":590,"max-batch-size":128,"overload-threshold":200,"max-batch-wait-time":0,"batch-wait-size":8},"binlog":{"enable":false,"write-timeout":"15s","ignore-error":false,"binlog-socket":""},"compatible-kill-query":false,"plugin":{"dir":"","load":""}}xiekeyi@ubuntu:~$

After

xiekeyi@ubuntu:~$ curl http://127.0.0.1:10080/settings
{
 "host": "0.0.0.0",
 "advertise-address": "",
 "port": 4000,
 "cors": "",
 "store": "mocktikv",
 "path": "/tmp/tidb",
 "socket": "",
 "lease": "45s",
 "run-ddl": true,
 "split-table": true,
 "token-limit": 1000,
 "oom-action": "log",
 "mem-quota-query": 34359738368,
 "enable-streaming": false,
 "txn-local-latches": {
  "enabled": true,
  "capacity": 2048000
 },
 "lower-case-table-names": 2,
 "log": {
  "level": "info",
  "format": "text",
  "disable-timestamp": false,
  "file": {
   "filename": "",
   "log-rotate": true,
   "max-size": 300,
   "max-days": 0,
   "max-backups": 0
  },
  "slow-query-file": "",
  "slow-threshold": 300,
  "expensive-threshold": 10000,
  "query-log-max-len": 2048
 },
 "security": {
  "skip-grant-table": false,
  "ssl-ca": "",
  "ssl-cert": "",
  "ssl-key": "",
  "cluster-ssl-ca": "",
  "cluster-ssl-cert": "",
  "cluster-ssl-key": ""
 },
 "status": {
  "report-status": true,
  "status-port": 10080,
  "metrics-addr": "",
  "metrics-interval": 15
 },
 "performance": {
  "max-procs": 0,
  "max-memory": 0,
  "tcp-keep-alive": true,
  "cross-join": true,
  "stats-lease": "3s",
  "run-auto-analyze": true,
  "stmt-count-limit": 5000,
  "feedback-probability": 0.05,
  "query-feedback-limit": 1024,
  "pseudo-estimate-ratio": 0.8,
  "force-priority": "NO_PRIORITY"
 },
 "prepared-plan-cache": {
  "enabled": false,
  "capacity": 100,
  "memory-guard-ratio": 0.1
 },
 "opentracing": {
  "enable": false,
  "sampler": {
   "type": "const",
   "param": 1,
   "sampling-server-url": "",
   "max-operations": 0,
   "sampling-refresh-interval": 0
  },
  "reporter": {
   "queue-size": 0,
   "buffer-flush-interval": 0,
   "log-spans": false,
   "local-agent-host-port": ""
  },
  "rpc-metrics": false
 },
 "proxy-protocol": {
  "networks": "",
  "header-timeout": 5
 },
 "tikv-client": {
  "grpc-connection-count": 16,
  "grpc-keepalive-time": 10,
  "grpc-keepalive-timeout": 3,
  "commit-timeout": "41s",
  "max-txn-time-use": 590,
  "max-batch-size": 128,
  "overload-threshold": 200,
  "max-batch-wait-time": 0,
  "batch-wait-size": 8
 },
 "binlog": {
  "enable": false,
  "write-timeout": "15s",
  "ignore-error": false,
  "binlog-socket": ""
 },
 "compatible-kill-query": false,
 "plugin": {
  "dir": "",
  "load": ""
 }
}xiekeyi@ubuntu:~$ 

Now the result of curl will be displayed in oneline.
It is hard to read and hard to grep.
We should better make it pretty.
@ngaut
Copy link
Member

ngaut commented Jan 17, 2019

/run-all-tests

@codecov-io
Copy link

Codecov Report

Merging #9104 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9104      +/-   ##
==========================================
+ Coverage   67.14%   67.14%   +<.01%     
==========================================
  Files         372      372              
  Lines       76974    76974              
==========================================
+ Hits        51684    51688       +4     
+ Misses      20660    20656       -4     
  Partials     4630     4630
Impacted Files Coverage Δ
server/http_handler.go 36.94% <100%> (ø) ⬆️
store/tikv/lock_resolver.go 41.7% <0%> (-0.95%) ⬇️
expression/schema.go 94.11% <0%> (-0.85%) ⬇️
executor/distsql.go 73% <0%> (+0.46%) ⬆️
executor/join.go 78.38% <0%> (+0.52%) ⬆️
ddl/delete_range.go 79.36% <0%> (+1.58%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 572ad80...1b75cff. Read the comment docs.

@winkyao
Copy link
Contributor

winkyao commented Jan 17, 2019

/run-unit-test

Copy link

@imtbkcat imtbkcat left a comment

Choose a reason for hiding this comment

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

LGTM

@imtbkcat imtbkcat added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 17, 2019
Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@winkyao winkyao merged commit 5f8265a into pingcap:master Jan 17, 2019
@xiekeyi98 xiekeyi98 deleted the TiDB-2846 branch January 17, 2019 12:14
bb7133 pushed a commit to bb7133/tidb that referenced this pull request Jul 25, 2019
sre-bot pushed a commit that referenced this pull request Jul 25, 2019
All tests passed, auto merged by Bot
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server contribution This PR is from a community contributor. status/LGT1 Indicates that a PR has LGTM 1. type/enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants