Product | technology drops



Recently, Didi opened source Rdebug, a utility tool for back-end research and development, debugging and testing, on GitHub. Its full name is Real Debugger, and its Chinese name is True · Debugger. Use real online traffic for offline replay testing to improve r&d efficiency and ensure code quality, thereby reducing accidents. Let’s learn more about it.

▍ background

With the popularization and application of microservice architecture, a complex single service is usually divided into several small and beautiful microservices. While enjoying the convenience brought by micro-service, we should also accept the problems brought by micro-service transformation: the number of services to be maintained increases and the number of RPC calls between services increases.

As a result, the maintenance cost of offline environment increases greatly. Secondly, there are many departments involved in offline environment, and maintaining a long-term stable offline environment is also a challenge. With the rapid development of business and continuous iteration of requirements, handwritten single test costs are particularly high due to complex business logic and complex service invocation requiring mock multiple downstream services. Manual construction of data, and not fully true. All the above problems seriously affect the efficiency of RD research and development, and increase the hidden danger of online accidents.



RD is in urgent need of a solution that can be quickly developed, debugs, and tested using real data only by deploying the code locally without setting up downstream dependencies. Rdebug implements the preceding solution based on traffic recording and playback.

objective

Improve r&d efficiency, reduce testing cost, shorten product r&d cycle, ensure code quality and reduce online accidents.

use

panorama



New RESEARCH and development experience

  • Just deploy the module code without setting up downstream services;

  • Local playback in macOS, development, debugging, testing without logging in to the remote server;

  • Traffic recording supports common protocols such as FastCGI, HTTP, Redis, Thrift, and MySQL.

  • Fast playback speed, single playback second level.


Record path redirection

To facilitate RD development and testing locally, Rdebug supports path redirection.

When the online deployment path is inconsistent with the local code path, and a large number of hard-coded online paths exist in the code, the code does not need to be intrudingly modified, but only simple configuration is required to implement path redirection.

The code can be stored in any path and played back.

Time migration

When traffic is played back, the time is automatically offset to the time when traffic is recorded.

When you get the time in code, you get the time after the recording point. Therefore, there is no need to worry when the business interface is time sensitive.

File the Mock

Traffic playback supports file mocks. You can quickly implement file mocks by specifying the file path and the content of the Mock.

Combined with the recording and reporting function, the configuration can be reported and read online, and the configuration can be “reproduced” offline by using Mock files.

▍ Elastic search

Multi-dimensional search is supported for traffic stored in Elastic, such as URIs, input and output keywords, and downstream calls.

Playback support specified files, but also support the above search playback, better use experience.

▍ Xdebug debugging

The most efficient feature is Xdebug linkage, where you can debug with online traffic by setting breakpoints on your code. In this way, can be used to study the code, troubleshoot problems, view the downstream interface response format and data, is a development and debugging tool.



Rich report

Playback report, summary of online and offline input, output, result comparison, clear at a glance.



The downstream call report lists all downstream calls, including protocols, request content, matching responses, and acquaintance. Different background colors are used to mark exactly matching traffic, calls with noise, missing calls, new calls, and so on.



Combined with Xdebug to generate coverage reports, you can clearly see which code is being executed, which code is not being executed, and the coverage of the interface.





For installation, usage, and FREQUENTLY asked questions, see the following links:

GitHub:github.com/didi/rdebug

Wiki:github.com/didi/rdebug…

Documentation:github.com/didi/rdebug…

Welcome to the “Rdebug User Exchange Group”

Please reply “Rdebug” in the background of Didi Technical official account to join

END







Scan code to pay attention to the “Didi Technology” public account, to get more of the latest hottest technology dry goods! Customized gifts are available from time to time!