- 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
推薦閱讀
- OpenDaylight Cookbook
- CMDB分步構建指南
- Python程序設計案例教程
- PhoneGap Mobile Application Development Cookbook
- 數據結構案例教程(C/C++版)
- R語言與網絡輿情處理
- Unity 2D Game Development Cookbook
- C++寶典
- MINECRAFT編程:使用Python語言玩轉我的世界
- The Statistics and Calculus with Python Workshop
- PHP項目開發全程實錄(第4版)
- Java從入門到精通(視頻實戰版)
- Mastering Machine Learning with R
- JavaScript Unit Testing
- 基于JavaScript的WebGIS開發