WO2020186773A1 - 调用请求监控方法、装置、设备及存储介质 - Google Patents

调用请求监控方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2020186773A1
WO2020186773A1 PCT/CN2019/116471 CN2019116471W WO2020186773A1 WO 2020186773 A1 WO2020186773 A1 WO 2020186773A1 CN 2019116471 W CN2019116471 W CN 2019116471W WO 2020186773 A1 WO2020186773 A1 WO 2020186773A1
Authority
WO
WIPO (PCT)
Prior art keywords
request
call request
interface call
class object
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/116471
Other languages
English (en)
French (fr)
Inventor
杜亚明
王礼
宋邦勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2020186773A1 publication Critical patent/WO2020186773A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3428Benchmarking
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4416Network booting; Remote initial program loading [RIPL]

Definitions

  • This application relates to the field of network communication technology, and in particular to a method, device, device, and storage medium for calling request monitoring.
  • Twitter's zipkin currently only for spring
  • the cloud system is well integrated and lacks web service support for springboot and tomcat; the default is to use the hypertext transfer protocol (http) to request information to be reported to zipkin, which costs a lot of energy.
  • http hypertext transfer protocol
  • the main purpose of this application is to provide a method, device, device, and storage medium for call request monitoring, which aims to solve the problem that the prior art cannot simply and effectively implement the monitoring of call requests, which leads to the difficult development of the actual process of request monitoring and high cost of energy consumption.
  • this application provides a call request monitoring method, which includes the following steps:
  • a request identifier corresponding to the interface call request is generated according to a preset identifier generation rule, the interface call request is marked according to the request identifier, and the marked interface call request is forwarded.
  • the step of detecting whether the class object is a preset interception object includes:
  • the set of interception objects contains several interception object identifiers corresponding to objects of the class to be intercepted;
  • the step of performing bytecode enhancement on the class object and intercepting the interface call request through the class object after the bytecode enhancement includes:
  • Method aspect interception is performed on the interface call request according to the class object after bytecode enhancement.
  • the method further includes:
  • the method further includes:
  • the step of generating a request identifier corresponding to the interface call request according to a preset identifier generation rule includes:
  • a character with a preset number of bits is selected from the Internet Protocol address, the character and the media access control address are combined, and the combined result is used as the request identifier corresponding to the interface call request.
  • the step of generating a request identifier corresponding to the interface call request according to a preset identifier generation rule further includes:
  • this application also proposes a request invocation link monitoring device, which includes:
  • the object obtaining module is used to obtain the class object corresponding to the interface call request when the interface call request initiated by the application service is detected;
  • the request interception module is used to detect whether the class object is a preset interception object, and if so, perform bytecode enhancement on the class object, and intercept the interface call request through the bytecode-enhanced class object;
  • the request marking module is configured to generate a request identifier corresponding to the interface call request according to a preset identifier generation rule, mark the interface call request according to the request identifier, and forward the marked interface call request.
  • this application also proposes a call request monitoring device, the device including: a memory, a processor, and computer-readable instructions stored in the memory and running on the processor, so When the computer-readable instructions are executed by the processor, the processor is caused to execute the steps of invoking the request monitoring method as described above.
  • this application also proposes a storage medium that stores computer-readable instructions on the storage medium.
  • the processor executes the The steps of calling the request monitoring method.
  • This application obtains the class object corresponding to the interface call request when the interface call request initiated by the application service is detected; detects whether the class object is a preset interception object, and if so, performs bytecode enhancement on the class object, and passes the word
  • the code-enhanced class object intercepts the interface call request; then generates the request identifier corresponding to the interface call request according to the preset identifier generation rule, then marks the interface call request according to the request identifier, and performs the marked interface call request Forwarding, because it intercepts and detects the class object corresponding to the request, the class object is enhanced when it needs to be intercepted, and then the request is intercepted through the enhanced class object and the corresponding request identifier is marked, so that the call can be realized
  • the comprehensive monitoring of requests reduces the development difficulty and cost of energy consumption during the realization of request monitoring.
  • FIG. 1 is a schematic structural diagram of a call request monitoring device of a hardware operating environment involved in a solution of an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for monitoring a call request of this application
  • FIG. 3 is a schematic flowchart of a second embodiment of a method for monitoring a call request of this application
  • FIG. 4 is a schematic flowchart of a third embodiment of a method for monitoring a call request of this application.
  • Fig. 5 is a structural block diagram of the first embodiment of the calling request monitoring device of this application.
  • FIG. 1 is a schematic structural diagram of a call request monitoring device of a hardware operating environment involved in a solution of an embodiment of the application.
  • the call request monitoring device may include: a processor 1001, such as a central processing unit (Central Processing Unit). Unit, CPU), communication bus 1002, user interface 1003, network interface 1004, memory 1005.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface).
  • WIreless-FIdelity WI-FI
  • the memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, can also be a stable non-volatile memory (Non-Volatile Memory, NVM), such as disk storage.
  • RAM Random Access Memory
  • NVM Non-Volatile Memory
  • the memory 1005 may also be a storage device independent of the foregoing processor 1001.
  • FIG. 1 does not constitute a limitation on the call request monitoring device, and may include more or fewer components than shown in the figure, or a combination of certain components, or different component arrangements.
  • the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module, and computer readable instructions.
  • the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with users; this application calls the processor 1001 in the request monitoring device 1005 may be set in a call request monitoring device that calls computer-readable instructions stored in the memory 1005 through the processor 1001 and executes the call request monitoring method provided in the embodiment of the present application.
  • the embodiment of the present application provides a method for monitoring a call request.
  • FIG. 2 is a schematic flowchart of a first embodiment of the method for monitoring a call request of this application.
  • the call request monitoring method includes the following steps:
  • Step S10 when an interface call request initiated by an application service is detected, obtain a class object corresponding to the interface call request;
  • the class object may be a method of a class.
  • Class is an object-oriented programming (OOP, Object-Oriented) Programming) The basis for information encapsulation.
  • OOP object-oriented programming
  • Each class contains data description and a set of functions (or methods) for operating data or transferring messages.
  • the instances of the class are called objects.
  • the application service can be either the recipient of the call request or the initiator of the call request.
  • application service a needs to call the interface of application service b, and application service b is making a call request to application service a.
  • the application service c needs to be called, and then the application service b is both the receiver and the initiator of the call request.
  • the application service needs to be connected to the APM platform in advance.
  • the application service may be a client or a server, and its category may be determined according to specific application scenarios.
  • the APM platform when the APM platform detects that an accessed application service initiates an interface call request to another application service, it can first parse the interface call request, and then obtain the class object corresponding to the request according to the analysis result.
  • Step S20 Detect whether the class object is a preset interception object, and if so, perform bytecode enhancement on the class object, and intercept the interface call request through the bytecode-enhanced class object;
  • Java probes can achieve specific code capture, function (or method) execution time-consuming range capture, function ( Or method) call monitoring and other operations.
  • the preset interception object may be preset methods of various types that need to be intercepted by executing method aspects.
  • the R&D personnel can extract in advance the object identifier corresponding to the interception object that needs to be intercepted by the method aspect and store it in a specific interception object set, so that the APM platform can detect whether the class object needs to be intercepted.
  • intercepting perform rapid detection based on the intercepted object set.
  • the APM platform may obtain the target object identifier corresponding to the class object; then read the pre-configured interception object set, and the interception object set contains several interception object identifiers corresponding to the class objects to be intercepted; And it is detected whether the target object identifier belongs to the interception object identifier.
  • the APM platform in this embodiment can call the pre-configured bytecode enhancement plug-in "byte-buddy" Binary modification is performed on the class object, and then interceptors are added to the modified class object and method aspects are defined to obtain the enhanced class object.
  • the APM platform can call the preset bytecode enhancement plug-in Binary modification is performed on the Java class in the class object, and an interceptor is added to the modified class object to obtain the bytecode-enhanced class object. Then, the method aspect interception is performed on the interface call request according to the class object after the bytecode enhancement.
  • Step S30 Generate a request identifier corresponding to the interface call request according to a preset identifier generation rule, mark the interface call request according to the request identifier, and forward the marked interface call request.
  • the request identifier may be an identification code or identification character that can distinguish different call requests.
  • the preset generation rule is a pre-defined request identifier generation strategy, for example, it may be based on the Internet Protocol address (IP address) carried in the request or the media access control address (MAC address) corresponding to the hardware device where the request initiator is located.
  • IP address Internet Protocol address
  • MAC address media access control address
  • the request identifier is generated, which is not limited in this embodiment.
  • the APM platform in this embodiment can obtain the media access control address corresponding to the application service and the Internet protocol address corresponding to the interface call request; from the Internet Protocol address A character with a preset number of digits is selected, the character and the media access control address are combined, and the combined result is used as the request identifier corresponding to the interface call request.
  • the selection of characters with a preset number of digits from the Internet Protocol address may be the selection of the last four characters in the IP address.
  • APM first extracts the MAC address The number "444553540000” in and the last four digits "2140" in the IP address, and then combine the two to obtain the combined request identifier "4445535400002140".
  • the method for generating the request identifier can also be that the APM platform obtains the media access control address corresponding to the application service and the request initiation time corresponding to the interface invocation request; Time format conversion to obtain the corresponding timestamp; combine the media access control address and the timestamp to obtain a combined character, input the combined character into a preset hash function, and output the result of the obtained function As the request identifier corresponding to the interface call request.
  • the application service usually adopts a 24-hour system or a 12-hour system.
  • the APM platform in this embodiment will convert the time format of the obtained request initiation time and convert it to the corresponding
  • the timestamp in this embodiment is preferably a unix timestamp.
  • the request was initiated time 2018-09-19 15:33:19, converted to Unix timestamp is 1537342399.
  • the hash function is a Hash function, which can transform an input of any length into a fixed-length output through a hash algorithm, and the output is a hash value.
  • the Hash algorithm is applied to the generation of the request identifier to ensure the uniqueness of the generated request identifier.
  • APM generates a unique request identifier for the interface call request according to the preset identifier generation rule, then marks the interface call request according to the request identifier, and then sends the interface call request according to the access address carried in the request To the next hop application service.
  • This embodiment obtains the class object corresponding to the interface call request when the interface call request initiated by the application service is detected; detects whether the class object is a preset interception object, and if so, performs bytecode enhancement on the class object, and passes The class object after bytecode enhancement intercepts the interface call request; then generates the request identifier corresponding to the interface call request according to the preset identifier generation rule, and then marks the interface call request according to the request identifier, and the marked interface call request For forwarding, because it intercepts and detects the class object corresponding to the request, the class object is enhanced when it needs to be intercepted, and then the request is intercepted through the enhanced class object and the corresponding request identifier is marked, so that the The comprehensive monitoring of call requests reduces the development difficulty and cost of energy consumption in the process of request monitoring realization.
  • FIG. 3 is a schematic flowchart of a second embodiment of a call request monitoring method according to this application.
  • the method further includes:
  • Step S40 Search the log file corresponding to the interface call request in the storage space of the application service, and mark the log file according to the request identifier;
  • the APM platform in order to facilitate the subsequent APM platform to view the request link of each call request, when the APM platform intercepts the call request, it will be on the application service side that initiated the call request and the application responding to the call request.
  • the server side generates a monitoring log (that is, the log file), and the monitoring log carries the request identifier corresponding to the call request; of course, the APM platform detects that the application server side responding to the call request is performing the request
  • an additional monitoring log about database access will be generated in the application service.
  • the request identifier corresponding to the interface call request is generated by the APM product platform, the log file of the application service that originally initiated the interface call request does not carry the request identifier. Therefore, the APM platform in this embodiment is detecting When the response to the interface call request is completed, the log file corresponding to the interface call request is searched in the storage space of the application service that initiated the interface call request, and the log file is marked according to the request identifier.
  • Step S50 Call the preset log collection component to collect all log files carrying the request identifier in real time, and upload the collected log files to the distributed message system for storage.
  • the preset log collection component may be a pre-configured component for collecting request log files.
  • the preset log collection component is preferably a Flume component
  • Flume is a Cloudera (one An open source platform) provides a highly available, highly reliable, distributed system for massive log collection, aggregation, and transmission. Flume supports customizing various data senders in the log system to collect data; at the same time, Flume provides The ability to simply process data and write to various data recipients (customizable).
  • the distributed message system may be a log analysis platform or system.
  • the ELK platform (ELK, Elasticsearch Logstash Kibana), Elasticsearch is an open source distributed search engine that provides three functions of collecting, analyzing, and storing data; Logstash is mainly a tool for collecting, analyzing, and filtering logs, supporting a large number of data acquisition methods; Kibana Can be Logstash
  • the log analysis and friendly web interface provided by ElasticSearch can help summarize, analyze and search important data logs.
  • the APM platform can call the Flume component to search for the corresponding log file in the application services involved in the entire request life cycle of the interface call request based on the request identifier, and upload the found log file to The Kafka platform is then sent by the Kafka platform to the distributed message system for storage.
  • the Kafka platform is a distributed streaming media platform, which is mostly used to build reliable pipelines for transmitting real-time data between systems or applications, and to build real-time streaming data processing programs to transform or process data streams.
  • the Kafka platform After the Kafka platform receives the log files, it first generates corresponding message queues based on these log files, and then Logstash in the ELK platform consumes the message queues, and then consumes them through the Filter plug-in The latter data is redefined by the time object, and then a request invocation link corresponding to the interface invocation request is generated according to the redefined data, and the request invocation link is saved.
  • the log file corresponding to the interface call request is found in the storage space of the application service, and the log file is marked according to the request identifier; the preset log collection component is called to collect all log files carrying the request identifier in real time, and collect
  • the received log files are uploaded to the distributed message system for storage, which has more efficient storage and faster retrieval methods than traditional database storage methods.
  • FIG. 4 is a schematic flowchart of a third embodiment of a call request monitoring method according to this application.
  • the method further includes:
  • Step S60 when receiving the call link check instruction, extract the target request identifier contained in the call link check instruction;
  • the R&D personnel when they need to view the entire call link of a call request, they can send the call link view instruction to the APM platform, and when the APM platform receives In this instruction, the instruction is first parsed, and then the request identifier corresponding to the call request that needs to be viewed carried in the instruction, that is, the target request identifier, is extracted.
  • Step S70 Read the corresponding request log file from the distributed messaging system according to the target request identifier, and read the time and date parameters contained in the log file;
  • the request log corresponding to each call request in this embodiment is stored in the distributed messaging system, when the APM platform needs to view the request log, the APM platform can use the target request identifier from the Read the corresponding request log file in the distributed message system.
  • time and date parameter may be the generation time of the request log file carried in the request log file, which may be used to represent the approximate time for the application service to respond to the received request.
  • the APM platform can read the corresponding request log file from the distributed messaging system according to the target request identifier, and read the time and date contained in the log file parameter.
  • Step S80 Sort the request log files according to the time and date parameters, and display the sorted request log files.
  • APM will sort all the request log files obtained according to the time and date parameters in the request log file, and then display the request log files in chronological order for viewing.
  • This embodiment extracts the target request identifier contained in the call link view instruction when the call link view instruction is received; reads the corresponding request log file from the distributed messaging system according to the target request identifier, and reads the log file The time and date parameters included in the file; sort the request log files according to the time and date parameters, and display the sorted request log files, which can visually display the request log files for subsequent troubleshooting.
  • the embodiment of the present application also proposes a storage medium, and the storage medium may be a non-volatile readable storage medium.
  • the storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of calling the request monitoring method as described above are realized.
  • the method implemented when the computer-readable instruction is executed can refer to the various embodiments of the calling request monitoring method of this application, which will not be repeated here.
  • FIG. 5 is a structural block diagram of a first embodiment of a calling request monitoring device according to this application.
  • the call request monitoring device proposed in the embodiment of the present application includes:
  • the object obtaining module 501 is configured to obtain the class object corresponding to the interface call request when the interface call request initiated by the application service is detected;
  • the request interception module 502 is used to detect whether the class object is a preset interception object, and if so, perform bytecode enhancement on the class object, and intercept the interface call request through the bytecode-enhanced class object ;
  • the request marking module 503 is configured to generate a request identifier corresponding to the interface call request according to a preset identifier generation rule, mark the interface call request according to the request identifier, and forward the marked interface call request.
  • This embodiment obtains the class object corresponding to the interface call request when the interface call request initiated by the application service is detected; detects whether the class object is a preset interception object, and if so, performs bytecode enhancement on the class object, and passes The class object after bytecode enhancement intercepts the interface call request; then generates the request identifier corresponding to the interface call request according to the preset identifier generation rule, and then marks the interface call request according to the request identifier, and the marked interface call request For forwarding, because it intercepts and detects the class object corresponding to the request, the class object is enhanced when it needs to be intercepted, and then the request is intercepted through the enhanced class object and the corresponding request identifier is marked, so that the The comprehensive monitoring of call requests reduces the development difficulty and cost of energy consumption in the process of request monitoring realization.
  • the request interception module 502 is also used to obtain the target object identifier corresponding to the class object; read a pre-configured set of interception objects, and the set of interception objects contains several objects corresponding to the class to be intercepted. Interception object identification; detecting whether the target object identification belongs to the interception object identification.
  • the request interception module 502 is also used to call a preset bytecode enhancement plug-in to binary-modify the Java class in the class object, and add an interceptor to the modified class object to obtain bytes Code-enhanced class object; according to the bytecode-enhanced class object, method aspect interception is performed on the interface call request.
  • the call request monitoring device in this embodiment further includes a log collection module configured to search for the log file corresponding to the interface call request in the storage space of the application service, and according to all The request identifier marks the log file; the preset log collection component is called to collect all log files carrying the request identifier in real time, and the collected log files are uploaded to the distributed message system for storage.
  • a log collection module configured to search for the log file corresponding to the interface call request in the storage space of the application service, and according to all The request identifier marks the log file; the preset log collection component is called to collect all log files carrying the request identifier in real time, and the collected log files are uploaded to the distributed message system for storage.
  • the log collection module is further configured to extract the target request identifier contained in the call link view instruction when the call link view instruction is received; according to the target request identifier, from the distributed message system
  • the corresponding request log file is read in the log file, and the time and date parameters contained in the log file are read; the request log files are sorted according to the time and date parameters, and the sorted request log files are displayed.
  • the request marking module 503 is also used to obtain the media access control address corresponding to the application service and the internet protocol address corresponding to the interface call request; select a preset number of characters from the internet protocol address To combine the characters and the media access control address, and use the combined result as the request identifier corresponding to the interface call request.
  • the request marking module 503 is also used to obtain the media access control address corresponding to the application service and the request initiation time corresponding to the interface call request; convert the time format of the request initiation time to obtain the corresponding Timestamp; combine the media access control address and the timestamp to obtain a combined character, input the combined character into a preset hash function, and use the obtained function output result as the interface call request correspondence The request ID.
  • the method of the embodiment can be implemented by means of software plus a necessary general hardware platform, of course, it can also be implemented by hardware, but the former is a better implementation in many cases.
  • the application s The essence of the technical solution or the part that contributes to the existing technology can be embodied in the form of a software product.
  • the computer software product is stored in a storage medium (such as read-only memory/random access memory, magnetic disk, optical disk).
  • the disk includes several instructions to enable a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the method described in each embodiment of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Mathematical Physics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Debugging And Monitoring (AREA)
  • Telephonic Communication Services (AREA)

Abstract

一种调用请求监控方法、装置、设备及存储介质,该方法包括:在检测到应用服务发起的接口调用请求时,获取接口调用请求对应的类对象(S10);检测类对象是否为预设拦截对象,若是则对类对象进行字节码增强,并通过字节码增强后的类对象对接口调用请求进行拦截(S20);然后按预设标识生成规则生成接口调用请求对应的请求标识,根据请求标识对接口调用请求进行标记,并对标记后的接口调用请求进行转发(S30),由于是对请求对应的类对象进行拦截检测,在需要对其拦截时对类对象进行类增强,然后通过增强后的类对象对请求进行拦截并标记相应的请求标识,从而能够实现对调用请求的全面监控,降低了请求监控实现过程中的开发难度和性能耗费。

Description

调用请求监控方法、装置、设备及存储介质
本申请要求于2019年3月16日提交中国专利局、申请号为201910206045.7、发明名称为“调用请求监控方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及网络通信技术领域,尤其涉及一种调用请求监控方法、装置、设备及存储介质。
背景技术
目前,市面上有很多针对分布式服务请求调用链路进行监控的系统,如大众点评cat、pinpoint、推特(twitter)的zipkin等,而这些系统主要存在以下不足:
1.大众点评cat:环境搭建繁杂,很多配置写死,不灵活;集成方案是通过代码埋点的方式来实现监控,对代码的侵入性大,集成成本较高,风险较大;
2.韩国开源的pinpoint:不支持查询单个调用链,对外表现的是整个应用的调用生态,二次开发难度较高;
3 .twitter的zipkin:目前只对spring cloud体系结合良好,缺乏对springboot和tomcat的web服务支持;默认使用的是超文本传输协议(http)请求向zipkin上报信息,性能耗费较大。
因此,如何简单有效的实现对调用请求进行监控,降低请求监控实现过程中的开发难度和性能耗费,就成为一个亟待解决的问题。
发明内容
本申请的主要目的在于提供了一种调用请求监控方法、装置、设备及存储介质,旨在解决现有技术无法简单有效的实现对调用请求进行监控,导致请求监控现实过程开发难度大和性能耗费高的技术问题。
为实现上述目的,本申请提供了一种调用请求监控方法,所述方法包括以下步骤:
在检测到应用服务发起的接口调用请求时,获取所述接口调用请求对应的类对象;
检测所述类对象是否为预设拦截对象,若是则对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截;
按预设标识生成规则生成所述接口调用请求对应的请求标识,根据所述请求标识对所述接口调用请求进行标记,并对标记后的接口调用请求进行转发。
优选地,所述检测所述类对象是否为预设拦截对象的步骤,包括:
获取所述类对象对应的目标对象标识;
读取预先配置的拦截对象集,所述拦截对象集中包含若干个待拦截类对象对应的拦截对象标识;
检测所述目标对象标识是否属于所述拦截对象标识。
优选地,所述对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截的步骤,包括:
调用预置字节码增强插件对所述类对象中的Java类进行二进制修改,并对修改后的类对象进行拦截器添加,以获取字节码增强后的类对象;
根据字节码增强后的类对象对所述接口调用请求进行方法切面拦截。
优选地,所述对标记后的接口调用请求进行转发的步骤之后,所述方法还包括:
在所述应用服务的存储空间中查找所述接口调用请求对应的日志文件,并根据所述请求标识对所述日志文件进行标记;
调用预设日志采集组件实时采集携带有所述请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存。
优选地,所述调用预设日志采集组件实时采集携带有所述请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存的步骤之后,所述方法还包括:
在接收到调用链路查看指令时,提取所述调用链路查看指令中包含的目标请求标识;
根据所述目标请求标识从所述分布式消息系统中读取对应的请求日志文件,并读取所述日志文件中包含的时间日期参数;
根据所述时间日期参数对所述请求日志文件进行排序,并对排序后的请求日志文件进行展示。
优选地,所述按预设标识生成规则生成所述接口调用请求对应的请求标识的步骤,包括:
获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的互联网协议地址;
从所述互联网协议地址中选取预设位数的字符,对所述字符和所述媒体访问控制地址进行组合,并将组合结果作为所述接口调用请求对应的请求标识。
优选地,所述按预设标识生成规则生成所述接口调用请求对应的请求标识的步骤,还包括:
获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的请求发起时间;
对所述请求发起时间进行时间格式转换,获取对应的时间戳;
对所述媒体访问控制地址和所述时间戳进行组合以获取组合字符,将所述组合字符输入至预设散列函数,并将获取到的函数输出结果作为所述接口调用请求对应的请求标识。
此外,为实现上述目的,本申请还提出一种请求调用链路监控装置,所述装置包括:
对象获取模块,用于在检测到应用服务发起的接口调用请求时,获取所述接口调用请求对应的类对象;
请求拦截模块,用于检测所述类对象是否为预设拦截对象,若是则对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截;
请求标记模块,用于按预设标识生成规则生成所述接口调用请求对应的请求标识,根据所述请求标识对所述接口调用请求进行标记,并对标记后的接口调用请求进行转发。
此外,为实现上述目的,本申请还提出一种调用请求监控设备,所述设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如上文所述的调用请求监控方法的步骤。
此外,为实现上述目的,本申请还提出一种存储介质,所述存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时,使得所述处理器执行如上文所述的调用请求监控方法的步骤。
本申请通过在检测到应用服务发起的接口调用请求时,获取接口调用请求对应的类对象;检测所述类对象是否为预设拦截对象,若是则对类对象进行字节码增强,并通过字节码增强后的类对象对接口调用请求进行拦截;然后按预设标识生成规则生成接口调用请求对应的请求标识,再根据请求标识对接口调用请求进行标记,并对标记后的接口调用请求进行转发,由于是对请求对应的类对象进行拦截检测,在需要对其拦截时对类对象进行类增强,然后通过增强后的类对象对请求进行拦截并标记相应的请求标识,从而能够实现对调用请求的全面监控,降低了请求监控实现过程中的开发难度和性能耗费。
附图说明
图1是本申请实施例方案涉及的硬件运行环境的调用请求监控设备的结构示意图;
图2为本申请调用请求监控方法第一实施例的流程示意图;
图3为本申请调用请求监控方法第二实施例的流程示意图;
图4为本申请调用请求监控方法第三实施例的流程示意图;
图5为本申请调用请求监控装置第一实施例的结构框图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
参照图1,图1为本申请实施例方案涉及的硬件运行环境的调用请求监控设备结构示意图。
如图1所示,该调用请求监控设备可以包括:处理器1001,例如中央处理器(Central Processing Unit,CPU),通信总线1002、用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如无线保真(WIreless-FIdelity,WI-FI)接口)。存储器1005可以是高速的随机存取存储器(Random Access Memory,RAM)存储器,也可以是稳定的非易失性存储器(Non-Volatile Memory,NVM),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
本领域技术人员可以理解,图1中示出的结构并不构成对调用请求监控设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,作为一种存储介质的存储器1005中可以包括操作系统、数据存储模块、网络通信模块、用户接口模块以及计算机可读指令。
在图1所示的调用请求监控设备中,网络接口1004主要用于与网络服务器进行数据通信;用户接口1003主要用于与用户进行数据交互;本申请调用请求监控设备中的处理器1001、存储器1005可以设置在调用请求监控设备中,所述调用请求监控设备通过处理器1001调用存储器1005中存储的计算机可读指令,并执行本申请实施例提供的调用请求监控方法。
本申请实施例提供了一种调用请求监控方法,参照图2,图2为本申请调用请求监控方法第一实施例的流程示意图。
本实施例中,所述调用请求监控方法包括以下步骤:
步骤S10:在检测到应用服务发起的接口调用请求时,获取所述接口调用请求对应的类对象;
需要说明的是,本申请方法的执行主体可以是应用性能管理(Application Performance Management & Monitoring,APM)平台,该平台主要对企业系统即时监控以实现对应用程序性能管理和故障管理的系统化提供一种解决方案。所述类对象可以是类的方法,所谓类(Class)是面向对象程序设计(OOP,Object-Oriented Programming)实现信息封装的基础,每个类包含数据说明和一组操作数据或传递消息的函数(或方法),类的实例称为对象,本实施例及下述各实施例中所述类对象即所述接口调用请求需要调用的函数(方法)。
应理解的是,所述应用服务既可以是调用请求的接收方也可以是调用请求的发起方,例如应用服务a需要调用应用服务b的接口,而应用服务b在对应用服务a的调用请求进行响应时又需要调用应用服务c,那么应用服务b则既是调用请求的接收方也是调用请求的发起方。本实施例中所述应用服务需要预先接入所述APM平台,所述应用服务可以是客户端也可以是服务端,其类别可根据具体应用场景确定。
在具体实现中,APM平台在检测到已接入的某一应用服务向另一应用服务发起接口调用请求时可先对该接口调用请求进行解析,然后根据解析结果获取该请求对应的类对象。
步骤S20:检测所述类对象是否为预设拦截对象,若是则对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截;
需要说明的是,本步骤中对请求进行拦截是基于JavaAgent机制的Java探针原理,通常情况下Java探针能够实现特定代码的抓取、函数(或方法)执行耗时范围抓取、函数(或方法)调用监控等操作。
应理解的是,所述预设拦截对象可以是预先设定的需要对其执行方法切面拦截的各种类的方法。为了实现对所述类对象的快速检测,研发人员可预先将需要进行方法切面拦截的拦截对象对应的对象标识提取出来存放至一个特定的拦截对象集中,以便于APM平台在检测类对象是否需要被拦截时,依据该拦截对象集进行快速检测。具体的,本实施例中APM平台可通过获取所述类对象对应的目标对象标识;然后读取预先配置的拦截对象集,所述拦截对象集中包含若干个待拦截类对象对应的拦截对象标识;并检测所述目标对象标识是否属于所述拦截对象标识。
进一步地,考虑到请求拦截过程中涉及到的代码程序较多,为了减少冗余代码、提高APM的拦截性能,本实施例中APM平台可调用预先配置的字节码增强插件“byte-buddy”对所述类对象进行二进制修改,然后给修改后的类对象进行拦截器添加并定义方法切面,以获得增强后的类对象,具体的,APM平台可调用预置字节码增强插件对所述类对象中的Java类进行二进制修改,并对修改后的类对象进行拦截器添加,以获取字节码增强后的类对象。然后根据字节码增强后的类对象对所述接口调用请求进行方法切面拦截。
步骤S30:按预设标识生成规则生成所述接口调用请求对应的请求标识,根据所述请求标识对所述接口调用请求进行标记,并对标记后的接口调用请求进行转发。
应理解的是,所述请求标识可以是能够将不同调用请求进行区分的标识码或标识字符。所述预设生成规则为预先定义的请求标识的生成策略,例如可以是根据请求中携带的互联网协议地址(IP地址)又或是请求发起端所在硬件设备对应的媒体访问控制地址(MAC地址)生成请求标识,本实施例对此不作限制。
进一步地,为了保证生产的请求标识的唯一性,本实施例中APM平台可获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的互联网协议地址;从所述互联网协议地址中选取预设位数的字符,对所述字符和所述媒体访问控制地址进行组合,并将组合结果作为所述接口调用请求对应的请求标识。其中,所述从互联网协议地址中选取预设位数的字符,可以是选取IP地址中的后四位字符。例如,APM平台获取到发起接口调用请求的应用服务的MAC地址为“44-45-53-54-00-00”,获取到对应的IP地址为“58.19.21.40”,则APM先提取MAC地址中的数字“444553540000”以及IP地址中的后四位数字“2140”,然后将二者进行组合,获得组合后的请求标识“4445535400002140”。
当然,本实施例中,所述请求标识的生成方式还可以是由APM平台获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的请求发起时间;对所述请求发起时间进行时间格式转换,获取对应的时间戳;对所述媒体访问控制地址和所述时间戳进行组合以获取组合字符,将所述组合字符输入至预设散列函数,并将获取到的函数输出结果作为所述接口调用请求对应的请求标识。
应理解的是,应用服务通常会采用24小时制或12小时制,为了对时间日期对象进行统一,本实施例中APM平台将对获取到的请求发起时间进行时间格式转换,将其转换为对应的时间戳,本实施例中所述时间戳优选为unix时间戳。例如请求发起时间2018-09-19 15:33:19,转换为Unix时间戳则为1537342399。
可理解的是,所述散列函数即Hash函数,其可将任意长度的输入通过散列算法变换成固定长度的输出,该输出为散列值。本实施例将Hash算法应用到请求标识的生成中,保证了生成的请求标识的唯一性。
在具体实现中,APM根据预设标识生成规则为所述接口调用请求生成唯一的请求标识,然后根据该请求标识对接口调用请求进行标记,再根据请求中携带的访问地址将该接口调用请求发送至下一跳应用服务。
本实施例通过在检测到应用服务发起的接口调用请求时,获取接口调用请求对应的类对象;检测所述类对象是否为预设拦截对象,若是则对类对象进行字节码增强,并通过字节码增强后的类对象对接口调用请求进行拦截;然后按预设标识生成规则生成接口调用请求对应的请求标识,再根据请求标识对接口调用请求进行标记,并对标记后的接口调用请求进行转发,由于是对请求对应的类对象进行拦截检测,在需要对其拦截时对类对象进行类增强,然后通过增强后的类对象对请求进行拦截并标记相应的请求标识,从而能够实现对调用请求的全面监控,降低了请求监控实现过程中的开发难度和性能耗费。
参考图3,图3为本申请调用请求监控方法第二实施例的流程示意图。
基于上述第一实施例,在本实施例中,所述步骤S30之后,所述方法还包括:
步骤S40:在所述应用服务的存储空间中查找所述接口调用请求对应的日志文件,并根据所述请求标识对所述日志文件进行标记;
需要说明的是,为了便于后续APM平台对每一条调用请求的请求链路进行查看,APM平台在对调用请求进行方法切面的拦截时,将在发起调用请求的应用服务侧和响应调用请求的应用服务侧均产生一条监控日志(即所述日志文件),且该监控日志中都携带有该调用请求对应的请求标识;当然,APM平台在检测到响应调用请求的应用服务端侧在对请求进行响应的过程中还访问了数据库时,还将在该应用服务中额外产生一条关于数据库访问的监控日志。
应理解的是,由于接口调用请求对应的请求标识是由APM品台生成,因而最初发起接口调用请求的应用服务的日志文件中并不携带所述请求标识,因此,本实施例APM平台在检测到接口调用请求响应完毕时,将在发起接口调用请求的应用服务的存储空间中查找所述接口调用请求对应的日志文件,并根据所述请求标识对所述日志文件进行标记。
步骤S50:调用预设日志采集组件实时采集携带有所述请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存。
需要说明的是,所述预设日志采集组件,可以是预先配置的用于对请求日志文件进行采集的组件,本实施例中所述预设日志采集组件优选为Flume组件,Flume是Cloudera(一种开源平台)提供的一个高可用的,高可靠的,分布式的海量日志采集、聚合和传输的系统,Flume支持在日志系统中定制各类数据发送方,用于收集数据;同时,Flume提供对数据进行简单处理,并写到各种数据接受方(可定制)的能力。
此外,所述分布式消息系统可以是一种日志分析平台或系统,本实施例中为ELK平台(ELK,Elasticsearch Logstash Kibana),其中,Elasticsearch是一个开源分布式搜索引擎,提供搜集、分析、存储数据三大功能;Logstash则主要是用于日志的搜集、分析、过滤日志的工具,支持大量的数据获取方式;Kibana可以为Logstash 和ElasticSearch 提供的日志分析友好的Web界面,可以帮助汇总、分析和搜索重要数据日志。
在具体实现中,APM平台可调用Flume组件以所述请求标识为搜索依据,在接口调用请求整个请求生命周期所涉及的应用服务中搜索对应的日志文件,并将查找到的日志文件先上传至Kafka平台,再由Kafka平台发送至分布式消息系统进行保存。其中,所述Kafka平台是一种分布式流媒体平台,多用于在系统或应用程序之间构建可靠的用于传输实时数据的管道,以及构建实时的流数据处理程序来变换或处理数据流。
进一步地,所述Kafka平台在接收到所述日志文件后,先根据这些日志文件生成对应的消息队列,然后由所述ELK平台中的Logstash对所述消息队列进行消费,再通过Filter插件对消费后的数据进行时间对象重定义,然后根据重定义后的数据生成接口调用请求对应的请求调用链路,并对所述请求调用链路进行保存。
本实施例通过在应用服务的存储空间中查找接口调用请求对应的日志文件,并根据请求标识对日志文件进行标记;调用预设日志采集组件实时采集携带有请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存,较传统的数据库存储方式具备更高效的存储、更快捷的检索方式。
参考图4,图4为本申请调用请求监控方法第三实施例的流程示意图。
基于上述各实施例,在本实施例中,所述步骤S50之后,所述方法还包括:
步骤S60:在接收到调用链路查看指令时,提取所述调用链路查看指令中包含的目标请求标识;
应理解的是,现如今的互联网服务通常都是基于大规模的分布式集群来实现,用户的一次请求通常由多个系统协同完成处理,而且这些处理是发生在不同机器甚至是不同集群上的,当请求处理发生异常时,需要快速理解系统行为,发现问题,通常是通过请求对应的日志文件进行问题排查。
基于上述各实施例,本实施例中,当研发人员需要对某一条调用请求的整个调用链路进行查看时,即可通过向APM平台发送所述调用链路查看指令,当APM平台在接收到该指令时,先对指令进行解析,然后提取指令中携带的需要查看的调用请求对应的请求标识,即所述目标请求标识。
步骤S70:根据所述目标请求标识从所述分布式消息系统中读取对应的请求日志文件,并读取所述日志文件中包含的时间日期参数;
应理解的是,由于本实施例中每一条调用请求对应的请求日志都存放在所述分布式消息系统中,APM平台在研发人员需要查看请求日志时,可通过所述目标请求标识从所述分布式消息系统中读取对应的请求日志文件。
可理解的是,所述时间日期参数可以是所述请求日志文件中携带的该请求日志文件的产生时间,其可以用来表征应用服务对接收到请求进行响应的大致时间。
在具体实现中,APM平台在提取到所述目标请求标识后,即可根据该目标请求标识从分布式消息系统中读取对应的请求日志文件,并读取所述日志文件中包含的时间日期参数。
步骤S80:根据所述时间日期参数对所述请求日志文件进行排序,并对排序后的请求日志文件进行展示。
可理解的是,日志文件中包含的时间日期参数大致能反映调用请求的调用顺序,因此本实施例中为了能够使研发人员较为直观的了解到接口调用请求整个请求生命周期中的调用链路情况,APM将根据请求日志文件中的时间日期参数对获取到的所有请求日志文件进行排序,然后按照时间的先后顺序对请求日志文件进行展示,以便查看。
本实施例通过在接收到调用链路查看指令时,提取调用链路查看指令中包含的目标请求标识;根据目标请求标识从分布式消息系统中读取对应的请求日志文件,并读取日志文件中包含的时间日期参数;根据时间日期参数对请求日志文件进行排序,并对排序后的请求日志文件进行展示,能够直观的对请求日志文件进行展示,便于后续问题排查。
此外,本申请实施例还提出一种存储介质,所述存储介质可以为非易失性可读存储介质。
所述存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如上文所述的调用请求监控方法的步骤。
其中,该计算机可读指令被执行时所实现的方法可参照本申请调用请求监控方法的各个实施例,此处不再赘述。
参照图5,图5为本申请调用请求监控装置第一实施例的结构框图。
如图5所示,本申请实施例提出的调用请求监控装置包括:
对象获取模块501,用于在检测到应用服务发起的接口调用请求时,获取所述接口调用请求对应的类对象;
请求拦截模块502,用于检测所述类对象是否为预设拦截对象,若是则对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截;
请求标记模块503,用于按预设标识生成规则生成所述接口调用请求对应的请求标识,根据所述请求标识对所述接口调用请求进行标记,并对标记后的接口调用请求进行转发。
本实施例通过在检测到应用服务发起的接口调用请求时,获取接口调用请求对应的类对象;检测所述类对象是否为预设拦截对象,若是则对类对象进行字节码增强,并通过字节码增强后的类对象对接口调用请求进行拦截;然后按预设标识生成规则生成接口调用请求对应的请求标识,再根据请求标识对接口调用请求进行标记,并对标记后的接口调用请求进行转发,由于是对请求对应的类对象进行拦截检测,在需要对其拦截时对类对象进行类增强,然后通过增强后的类对象对请求进行拦截并标记相应的请求标识,从而能够实现对调用请求的全面监控,降低了请求监控实现过程中的开发难度和性能耗费。
基于本申请上述调用请求监控装置第一实施例,提出本申请调用请求监控装置的第二实施例。
在本实施例中,所述请求拦截模块502,还用于获取所述类对象对应的目标对象标识;读取预先配置的拦截对象集,所述拦截对象集中包含若干个待拦截类对象对应的拦截对象标识;检测所述目标对象标识是否属于所述拦截对象标识。
进一步地,所述请求拦截模块502,还用于调用预置字节码增强插件对所述类对象中的Java类进行二进制修改,并对修改后的类对象进行拦截器添加,以获取字节码增强后的类对象;根据字节码增强后的类对象对所述接口调用请求进行方法切面拦截。
进一步地,本实施例中所述调用请求监控装置还包括日志采集模块,所述日志采集模块,用于在所述应用服务的存储空间中查找所述接口调用请求对应的日志文件,并根据所述请求标识对所述日志文件进行标记;调用预设日志采集组件实时采集携带有所述请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存。
进一步地,所述日志采集模块,还用于在接收到调用链路查看指令时,提取所述调用链路查看指令中包含的目标请求标识;根据所述目标请求标识从所述分布式消息系统中读取对应的请求日志文件,并读取所述日志文件中包含的时间日期参数;根据所述时间日期参数对所述请求日志文件进行排序,并对排序后的请求日志文件进行展示。
进一步地,所述请求标记模块503,还用于获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的互联网协议地址;从所述互联网协议地址中选取预设位数的字符,对所述字符和所述媒体访问控制地址进行组合,并将组合结果作为所述接口调用请求对应的请求标识。
进一步地,所述请求标记模块503,还用于获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的请求发起时间;对所述请求发起时间进行时间格式转换,获取对应的时间戳;对所述媒体访问控制地址和所述时间戳进行组合以获取组合字符,将所述组合字符输入至预设散列函数,并将获取到的函数输出结果作为所述接口调用请求对应的请求标识。
本申请调用请求监控装置的其他实施例或具体实现方式可参照上述各方法实施例,此处不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述 实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通 过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的 技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体 现出来,该计算机软件产品存储在一个存储介质(如只读存储器/随机存取存储器、磁碟、光 盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种调用请求监控方法,其特征在于,所述方法包括:
    在检测到应用服务发起的接口调用请求时,获取所述接口调用请求对应的类对象;
    检测所述类对象是否为预设拦截对象,若是则对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截;
    按预设标识生成规则生成所述接口调用请求对应的请求标识,根据所述请求标识对所述接口调用请求进行标记,并对标记后的接口调用请求进行转发。
  2. 如权利要求1所述的方法,其特征在于,所述检测所述类对象是否为预设拦截对象的步骤,包括:
    获取所述类对象对应的目标对象标识;
    读取预先配置的拦截对象集,所述拦截对象集中包含若干个待拦截类对象对应的拦截对象标识;
    检测所述目标对象标识是否属于所述拦截对象标识。
  3. 如权利要求1所述的方法,其特征在于,所述对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截的步骤,包括:
    调用预置字节码增强插件对所述类对象中的Java类进行二进制修改,并对修改后的类对象进行拦截器添加,以获取字节码增强后的类对象;
    根据字节码增强后的类对象对所述接口调用请求进行方法切面拦截。
  4. 如权利要求1所述的方法,其特征在于,所述对标记后的接口调用请求进行转发的步骤之后,所述方法还包括:
    在所述应用服务的存储空间中查找所述接口调用请求对应的日志文件,并根据所述请求标识对所述日志文件进行标记;
    调用预设日志采集组件实时采集携带有所述请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存。
  5. 如权利要求4所述的方法,其特征在于,所述调用预设日志采集组件实时采集携带有所述请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存的步骤之后,所述方法还包括:
    在接收到调用链路查看指令时,提取所述调用链路查看指令中包含的目标请求标识;
    根据所述目标请求标识从所述分布式消息系统中读取对应的请求日志文件,并读取所述日志文件中包含的时间日期参数;
    根据所述时间日期参数对所述请求日志文件进行排序,并对排序后的请求日志文件进行展示。
  6. 如权利要求5所述的方法,其特征在于,所述按预设标识生成规则生成所述接口调用请求对应的请求标识的步骤,包括:
    获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的互联网协议地址;
    从所述互联网协议地址中选取预设位数的字符,对所述字符和所述媒体访问控制地址进行组合,并将组合结果作为所述接口调用请求对应的请求标识。
  7. 如权利要求5所述的方法,其特征在于,所述按预设标识生成规则生成所述接口调用请求对应的请求标识的步骤,还包括:
    获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的请求发起时间;
    对所述请求发起时间进行时间格式转换,获取对应的时间戳;
    对所述媒体访问控制地址和所述时间戳进行组合以获取组合字符,将所述组合字符输入至预设散列函数,并将获取到的函数输出结果作为所述接口调用请求对应的请求标识。
  8. 一种请求调用链路监控装置,其特征在于,所述装置包括:
    对象获取模块,用于在检测到应用服务发起的接口调用请求时,获取所述接口调用请求对应的类对象;
    请求拦截模块,用于检测所述类对象是否为预设拦截对象,若是则对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截;
    请求标记模块,用于按预设标识生成规则生成所述接口调用请求对应的请求标识,根据所述请求标识对所述接口调用请求进行标记,并对标记后的接口调用请求进行转发。
  9. 如权利要求8所述的装置,其特征在于,所述请求拦截模块,还用于获取所述类对象对应的目标对象标识;读取预先配置的拦截对象集,所述拦截对象集中包含若干个待拦截类对象对应的拦截对象标识;检测所述目标对象标识是否属于所述拦截对象标识。
  10. 如权利要求8所述的装置,其特征在于,所述请求拦截模块,还用于调用预置字节码增强插件对所述类对象中的Java类进行二进制修改,并对修改后的类对象进行拦截器添加,以获取字节码增强后的类对象;根据字节码增强后的类对象对所述接口调用请求进行方法切面拦截。
  11. 如权利要求8所述的装置,其特征在于,所述装置还包括日志采集模块;
    所述日志采集模块,用于在所述应用服务的存储空间中查找所述接口调用请求对应的日志文件,并根据所述请求标识对所述日志文件进行标记;调用预设日志采集组件实时采集携带有所述请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存。
  12. 如权利要求11所述的装置,其特征在于,所述日志采集模块,还用于在接收到调用链路查看指令时,提取所述调用链路查看指令中包含的目标请求标识;根据所述目标请求标识从所述分布式消息系统中读取对应的请求日志文件,并读取所述日志文件中包含的时间日期参数;根据所述时间日期参数对所述请求日志文件进行排序,并对排序后的请求日志文件进行展示。
  13. 如权利要求12所述的装置,其特征在于,所述日志采集模块,还用于获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的互联网协议地址;从所述互联网协议地址中选取预设位数的字符,对所述字符和所述媒体访问控制地址进行组合,并将组合结果作为所述接口调用请求对应的请求标识。
  14. 如权利要求12所述的装置,其特征在于,所述请求标记模块,还用于获取所述应用服务对应的媒体访问控制地址以及所述接口调用请求对应的请求发起时间;对所述请求发起时间进行时间格式转换,获取对应的时间戳;对所述媒体访问控制地址和所述时间戳进行组合以获取组合字符,将所述组合字符输入至预设散列函数,并将获取到的函数输出结果作为所述接口调用请求对应的请求标识。
  15. 一种调用请求监控设备,其特征在于,所述设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行以下步骤:
    在检测到应用服务发起的接口调用请求时,获取所述接口调用请求对应的类对象;
    检测所述类对象是否为预设拦截对象,若是则对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截;
    按预设标识生成规则生成所述接口调用请求对应的请求标识,根据所述请求标识对所述接口调用请求进行标记,并对标记后的接口调用请求进行转发。
  16. 如权利要求15所述的调用请求监控设备,其特征在于,所述检测所述类对象是否为预设拦截对象的步骤,包括:
    获取所述类对象对应的目标对象标识;
    读取预先配置的拦截对象集,所述拦截对象集中包含若干个待拦截类对象对应的拦截对象标识;
    检测所述目标对象标识是否属于所述拦截对象标识。
  17. 如权利要求15所述的调用请求监控设备,其特征在于,所述对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截的步骤,包括:
    调用预置字节码增强插件对所述类对象中的Java类进行二进制修改,并对修改后的类对象进行拦截器添加,以获取字节码增强后的类对象;
    根据字节码增强后的类对象对所述接口调用请求进行方法切面拦截。
  18. 如权利要求15所述的调用请求监控设备,其特征在于,所述对标记后的接口调用请求进行转发的步骤之后,所述处理器还用于执行以下步骤:
    在所述应用服务的存储空间中查找所述接口调用请求对应的日志文件,并根据所述请求标识对所述日志文件进行标记;
    调用预设日志采集组件实时采集携带有所述请求标识的所有日志文件,并将采集到的日志文件上传至分布式消息系统进行保存。
  19. 一种存储介质,其特征在于,所述存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时,使得所述处理器执行以下步骤:
    在检测到应用服务发起的接口调用请求时,获取所述接口调用请求对应的类对象;
    检测所述类对象是否为预设拦截对象,若是则对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截;
    按预设标识生成规则生成所述接口调用请求对应的请求标识,根据所述请求标识对所述接口调用请求进行标记,并对标记后的接口调用请求进行转发。
  20. 如权利要求19所述的存储介质,其特征在于,所述对所述类对象进行字节码增强,并通过字节码增强后的类对象对所述接口调用请求进行拦截的步骤,包括:
    调用预置字节码增强插件对所述类对象中的Java类进行二进制修改,并对修改后的类对象进行拦截器添加,以获取字节码增强后的类对象;
    根据字节码增强后的类对象对所述接口调用请求进行方法切面拦截。
PCT/CN2019/116471 2019-03-16 2019-11-08 调用请求监控方法、装置、设备及存储介质 Ceased WO2020186773A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910206045.7A CN110083391A (zh) 2019-03-16 2019-03-16 调用请求监控方法、装置、设备及存储介质
CN201910206045.7 2019-03-16

Publications (1)

Publication Number Publication Date
WO2020186773A1 true WO2020186773A1 (zh) 2020-09-24

Family

ID=67413274

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/116471 Ceased WO2020186773A1 (zh) 2019-03-16 2019-11-08 调用请求监控方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN110083391A (zh)
WO (1) WO2020186773A1 (zh)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083391A (zh) * 2019-03-16 2019-08-02 平安科技(深圳)有限公司 调用请求监控方法、装置、设备及存储介质
CN112261072B (zh) * 2019-10-10 2024-04-09 北京京东尚科信息技术有限公司 一种服务调用方法、装置、设备和存储介质
CN110865927B (zh) * 2019-11-20 2021-08-31 腾讯科技(深圳)有限公司 区块链调用链路异常检测方法、装置和计算机设备
CN111488257A (zh) * 2020-04-14 2020-08-04 杭州云创共享网络科技有限公司 一种云服务链路跟踪监控方法、装置、设备及存储介质
CN114428704B (zh) * 2020-10-29 2025-10-28 顺丰科技有限公司 全链路分布式监控的方法、装置、计算机设备和存储介质
CN112839096B (zh) * 2021-01-14 2022-07-22 深圳赛安特技术服务有限公司 监控函数执行时长的方法、装置、计算机设备及存储介质
CN113032221A (zh) * 2021-03-30 2021-06-25 深圳红途创程科技有限公司 数据采集和传输方法、装置、计算机设备及存储介质
CN113079048A (zh) * 2021-03-30 2021-07-06 深圳红途创程科技有限公司 数据采集方法、装置、计算机设备及存储介质
CN113051272A (zh) * 2021-03-30 2021-06-29 深圳红途创程科技有限公司 数据库表结构构建方法、装置、计算机设备及存储介质
CN113918770B (zh) * 2021-12-16 2022-03-25 上海冰鉴信息科技有限公司 字符串与时间字段的转换方法及装置
CN114253630B (zh) * 2021-12-23 2023-07-25 上海新炬网络信息技术股份有限公司 基于Java切面修改Form表单变化信息实现日志保存的方法
CN114285669B (zh) * 2021-12-31 2024-08-27 深圳昂楷科技有限公司 一种内嵌应用系统插件的水印嵌入方法
CN114706707A (zh) * 2022-04-18 2022-07-05 成都星云智联科技有限公司 一种日志级别动态修改方法、装置、设备及存储介质
CN120429039A (zh) * 2024-02-04 2025-08-05 杭州阿里云飞天信息技术有限公司 标记信息处理方法、电子设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101276271A (zh) * 2007-03-29 2008-10-01 北京邮电大学 一种面向切面编程的拦截器系统及方法
US20150378756A1 (en) * 2014-06-25 2015-12-31 SmartBear Software, Inc. Systems and methods for mobile application tracing instrumentation
CN107133171A (zh) * 2017-05-02 2017-09-05 山东浪潮通软信息科技有限公司 一种基于组件式的轻量aop框架及其使用方法
CN107291567A (zh) * 2017-06-20 2017-10-24 山东浪潮通软信息科技有限公司 一种数据调用方法、装置以及系统
CN110083391A (zh) * 2019-03-16 2019-08-02 平安科技(深圳)有限公司 调用请求监控方法、装置、设备及存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763054B (zh) * 2018-04-17 2021-03-23 平安科技(深圳)有限公司 测试案例的测试效果展示方法、电子装置及存储介质
CN109474698A (zh) * 2018-12-14 2019-03-15 平安城市建设科技(深圳)有限公司 访问请求标记方法、装置、设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101276271A (zh) * 2007-03-29 2008-10-01 北京邮电大学 一种面向切面编程的拦截器系统及方法
US20150378756A1 (en) * 2014-06-25 2015-12-31 SmartBear Software, Inc. Systems and methods for mobile application tracing instrumentation
CN107133171A (zh) * 2017-05-02 2017-09-05 山东浪潮通软信息科技有限公司 一种基于组件式的轻量aop框架及其使用方法
CN107291567A (zh) * 2017-06-20 2017-10-24 山东浪潮通软信息科技有限公司 一种数据调用方法、装置以及系统
CN110083391A (zh) * 2019-03-16 2019-08-02 平安科技(深圳)有限公司 调用请求监控方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN110083391A (zh) 2019-08-02

Similar Documents

Publication Publication Date Title
WO2020186773A1 (zh) 调用请求监控方法、装置、设备及存储介质
CN112738791B (zh) 基于5g核心网的用户信息关联回填方法、装置、设备和介质
WO2020233077A1 (zh) 系统服务的监控方法、装置、设备及存储介质
WO2020015067A1 (zh) 数据采集方法、装置、设备及存储介质
WO2021012489A1 (zh) 电话平台日志查询方法、终端设备、存储介质及装置
WO2020224246A1 (zh) 基于区块链的数据管理方法、装置、设备和存储介质
WO2021169268A1 (zh) 数据处理方法、装置、设备和存储介质
WO2021003923A1 (zh) FreeSWITCH监控方法、设备、存储介质及装置
CN104838620B (zh) 电信网中的事件管理的设备和方法
WO2021072881A1 (zh) 基于对象存储的请求处理方法、装置、设备及存储介质
WO2020253034A1 (zh) 客户端埋点测试方法、装置、设备及存储介质
WO2020253135A1 (zh) 自动化分析方法、用户设备、存储介质及装置
WO2018014580A1 (zh) 数据接口测试方法、装置、服务器和存储介质
WO2014183454A1 (en) Method, terminal and computer storage medium for group sending message in instant communication
WO2013117104A1 (zh) Bt离线数据下载系统及方法、计算机存储介质
WO2018107811A1 (zh) 网络安全联合防御方法、装置、服务器和存储介质
WO2020077832A1 (zh) 云桌面的访问方法、装置、设备及存储介质
WO2013174172A1 (zh) 一种文件信息预览方法及系统
WO2018036168A1 (zh) 数据处理任务执行方法、装置、执行服务器和存储介质
WO2020062658A1 (zh) 合同生成方法、装置、设备及存储介质
WO2014112754A1 (ko) 웹 서비스 푸시 방법 및 이를 수행하는 웹 서비스 푸시 서버 및 웹 서비스 제공 서버
WO2020186791A1 (zh) 数据传输方法、装置、设备及存储介质
CN106650493A (zh) 一种行为数据的获取方法和装置
WO2017173838A1 (zh) 基于验证的消息显示方法及通信终端
WO2015199271A1 (en) Method and system for sharing files over p2p

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19919765

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19919765

Country of ref document: EP

Kind code of ref document: A1