Practical Background
As the microservices architecture has gradually become popular, accurately locating the complete lifecycle of a request in complex and large-scale systems has increasingly become one of the biggest pain points faced by R&D personnel. Taking the self - test process in R&D as an example, developers usually hope that after initiating an HTTP/RPC test request, they can obtain the context information of the entire test request in a simple way. This usually includes relevant upstream and downstream links, the method stacks of internal requests in each service, and data such as logs printed on the link. The demand for integrated monitoring of indicators - links - logs is urgent.
Tencent Cloud Application Performance Management (APM), as a full - link monitoring platform that itself includes indicators - links, has been integrated with Tencent Cloud Log Service (CLS), realizing integrated monitoring of indicators - links - logs. When viewing link details, associated information can be viewed correspondingly, completing the troubleshooting process from links to logs. Prerequisites
Make sure that the application has been connected to Application Performance Monitoring (APM), and refer to the CLS Getting Started Guide to report business logs to Tencent Cloud Log Service (CLS). Note:
To ensure the reliability of your log data and use the log service more efficiently, it is recommended that you use the CLS - optimized API/Agent to upload structured logs.
Submit via API/SDK. For details, see the contents section in Uploading Logs. Operation Steps
Step 1: Output the TraceID To the Log
To achieve correlation query between link and log, you need to output the TraceID to the log. For applications accessing APM in the following two ways, the TraceID can be automatically injected into the log without modifying the code:
For applications accessing APM in other ways, please refer to the corresponding access documentation, obtain the TraceID in the code, and output the TraceID in the business log.
Step 2: Configure the Association Between the APM Application and the CLS Topic
Step 3: Query the Business Logs Corresponding To the Link
2. Select the corresponding business system, specify the query conditions, query the link invocation, and click TraceID to enter the Trace details page.
3. On the CLS logs tab, you can query the business logs corresponding to the link.