Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add better logging options (jaegertracing#5675)
## Which problem is this PR solving? - Part of jaegertracing#5290 - It's difficult to troubleshoot ES queries because logs are always written in JSON format, so the ES req/resp JSON is being escaped. ## Description of the changes - Add `--log-encoding` option to allow changing logs to plain text (console). - Fix logger initialization for ES to reuse the existing logger instead of creating a new one (new one was switching back to JSON) ## How was this change tested? ``` $ SPAN_STORAGE_TYPE=elasticsearch go run -tags=ui ./cmd/all-in-one --es.log-level=debug --log-encoding=console ``` A query is logged like this: ``` 2024-06-22T22:56:34.272-0400 info [email protected]+incompatible/client.go:835 GET /_msearch?rest_total_hits_as_int=true HTTP/1.1 Host: 127.0.0.1:9200 User-Agent: elastic/6.2.37 (darwin-arm64) Content-Length: 310 Accept: application/json Content-Type: application/json Accept-Encoding: gzip {"ignore_unavailable":true,"indices":["jaeger-span-2024-06-23","jaeger-span-2024-06-22","jaeger-span-2024-06-21","jaeger-span-2024-06-20"]} {"query":{"bool":{"must":{"term":{"traceID":"1a2cee16e928c8a2f00d9ae784d8cccc"}}}},"search_after":[1718848594271777],"size":10000,"sort":[{"startTime":{"order":"asc"}}]} ``` ## Checklist - [ ] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [ ] I have signed all commits - [ ] I have added unit tests for the new functionality - [ ] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Yuri Shkuro <[email protected]>
- Loading branch information