- Building Microservices with Go
- Nic Jackson
- 164字
- 2021-07-15 17:28:13
Standard response headers
All services should return the following headers.
- Date: The date that the request was processed in RFC 3339 format.
- Content-Type: The content type of the response.
- Content-Encoding: gzip or deflate.
- X-Request-ID/X-Correlation-ID: Whilst you may not directly request your clients to implement this header it may be something that you add to requests when you call downstream services. When you are trying to debug a service that is running in production it can be incredibly useful to be able to group all the requests by a single transaction ID. A common practice that we will see when we look at logging and monitoring is to store all logs in a common database such as Elastic Search. By setting the standard way of working when building many connected microservices that they pass the correlation ID with each downstream call you will be able to query your logs in Kibana or another log query tool and group them into a single transaction:
X-Request-ID: f058ebd6-02f7-4d3f-942e-904344e8cde
推薦閱讀
- Learning Single:page Web Application Development
- GeoServer Cookbook
- TensorFlow Lite移動端深度學習
- 趣學Python算法100例
- Python面向?qū)ο缶幊蹋簶?gòu)建游戲和GUI
- Java項目實戰(zhàn)精編
- Haxe Game Development Essentials
- Protocol-Oriented Programming with Swift
- 用戶體驗可視化指南
- C語言程序設(shè)計
- Kivy Cookbook
- 自學Python:編程基礎(chǔ)、科學計算及數(shù)據(jù)分析(第2版)
- Java EE Web應用開發(fā)基礎(chǔ)
- 貫通Tomcat開發(fā)
- Python Deep Learning