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

Fix static config inspection #496

Merged
merged 1 commit into from Oct 23, 2018
Merged

Fix static config inspection #496

merged 1 commit into from Oct 23, 2018

Conversation

ChuntaoLu
Copy link
Contributor

@ChuntaoLu ChuntaoLu commented Oct 22, 2018

This PR fixes the config inspection logging field.

Previously upon starting the server, the logging field errors:

{"level":"info","ts":1540234473.504451,"msg":"Started ExampleGateway","zone":"unknown","env":"production","hostname":"skiptomylu","service":"example-gateway","pid":86696,"realHTTPAddr":"10.32.102.222:60030","realTChannelAddr":"10.32.102.222:60031","configError":"json: unsupported type: map[interface {}]interface {}"}

Now:

{"level":"info","ts":1540235432.748769,"msg":"Started ExampleGateway","zone":"unknown","env":"production","hostname":"skiptomylu","service":"example-gateway","pid":93769,"realHTTPAddr":"10.32.102.222:61658","realTChannelAddr":"10.32.102.222:61659","config":{"clients.bar.defaultHeaders":{"X-Client-ID":"bar"},"clients.bar.ip":"127.0.0.1","clients.bar.port":4001,"clients.bar.timeout":10000,"clients.baz.ip":"127.0.0.1","clients.baz.port":4002,"clients.baz.serviceName":"Qux","clients.baz.timeout":10000,"clients.baz.timeoutPerAttempt":2000,"clients.contacts.ip":"127.0.0.1","clients.contacts.port":4000,"clients.contacts.timeout":10000,"clients.corge.serviceName":"Corge","clients.corge.timeout":10000,"clients.corge.timeoutPerAttempt":2000,"clients.google-now.ip":"127.0.0.1","clients.google-now.port":14120,"clients.google-now.timeout":10000,"clients.googleNowTChannel.connectionType":"p2p","clients.googleNowTChannel.hostList":["127.0.0.1:4002"],"clients.googleNowTChannel.timeout":10000,"clients.multi.ip":"127.0.0.1","clients.multi.port":4003,"clients.multi.timeout":10000,"datacenter":"unknown","env":"production","envVarsToTagInRootScope":[],"http.port":0,"jaeger.disabled":false,"jaeger.reporter.flush.milliseconds":10000,"jaeger.reporter.hostport":"localhost:6831","jaeger.sampler.param":0.001,"jaeger.sampler.type":"remote","logger.fileName":"/tmp/example-gateway.log","logger.output":"disk","metrics.flushInterval":1000,"metrics.m3.hostPort":"127.0.0.1:9052","metrics.m3.maxPacketSizeBytes":1440,"metrics.m3.maxQueueSize":10000,"metrics.runtime.collectInterval":1000,"metrics.runtime.enableCPUMetrics":true,"metrics.runtime.enableGCMetrics":true,"metrics.runtime.enableMemMetrics":true,"metrics.serviceName":"example-gateway","metrics.type":"m3","service.env.config":{},"serviceName":"example-gateway","shutdown.pollInterval":10,"sidecarRouter.default.http.calleeHeader":"RPC-Service","sidecarRouter.default.http.callerHeader":"RPC-Caller","sidecarRouter.default.http.ip":"127.0.0.1","sidecarRouter.default.http.port":4999,"sidecarRouter.default.tchannel.ip":"127.0.0.1","sidecarRouter.default.tchannel.port":5000,"subLoggerLevel.http":"info","subLoggerLevel.jaeger":"info","subLoggerLevel.tchannel":"info","tchannel.port":0,"tchannel.processName":"example-gateway","tchannel.serviceName":"example-gateway","useDatacenter":false}}

@ChuntaoLu ChuntaoLu requested review from l-w-2017 and jacobgreenleaf and removed request for l-w-2017 October 22, 2018 19:16
@ChuntaoLu
Copy link
Contributor Author

hmm, travis is having issues atm https://www.traviscistatus.com/

err := yaml.Unmarshal(bytes, &object)
if err != nil {
panic(err)
}
return object
return stringizeMapKey(object).(map[string]interface{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this type assertion fail if you take the []interface{} case in stringizeMapKey? Since it passes tests, does that make the []interface{} case dead code if doesn't occur?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

object is declared of type map[interface{}]interface{}, so the conversion should not fail. The []interface{} case is for when the value is a slice of maps where the keys are also interface{} and need to be stringized.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 67.952% when pulling 8b2b748 on lu.fix into 303236d on master.

err := yaml.Unmarshal(bytes, &object)
if err != nil {
panic(err)
}
return object
return stringizeMapKey(object).(map[string]interface{})
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: stringizeMapKey ---> stringifyMapKey

@ChuntaoLu ChuntaoLu merged commit a5a6e9e into master Oct 23, 2018
@ChuntaoLu ChuntaoLu deleted the lu.fix branch October 23, 2018 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants