Implementation method for web monitoring SDK (Software Development Kit) of ward bedside machine
By designing a ward bedside web monitoring SDK, using the publish-subscribe design mode and native XHR data reporting method, the location and solving problems of abnormal web application problems in low-version browsers and resource-constrained environments are solved, and the accurate monitoring and reporting of user behavior and abnormal information is achieved, and the efficiency of problem investigation is improved.
Patent Information
- Application Number
- CN202510061579.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-06
AI Technical Summary
The prior art is difficult to quickly locate and solve abnormal problems in web applications in low-version browsers and resource-constrained ward bedside machine environments, and traditional data reporting methods can easily interfere with system performance.
Design a ward bedside machine web monitoring SDK, which can realize accurate monitoring and reporting of abnormal information by initializing the monitoring SDK, event monitoring and hijacking, defining user behavior, error information reporting, error information processing and log collection. The SDK adopts a publish-subscribe design model, combining native XHR data reporting method and browser idle time task processing mechanism to reduce interference to front-end performance.
It realizes accurate collection and reporting of user behavior data and front-end abnormalities in the ward bedside machine environment, improves the efficiency of problem investigation, meets the needs of low-version browsers and resource-constrained environments, and does not interfere with system performance.
Smart Images

Figure CN119945931A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bedside machines in wards, and in particular to a method for implementing a web monitoring SDK for bedside machines in wards. Background Art
[0002] As an important part of the hospital's smart ward system, the bedside machine is widely used in scenarios such as patient services and medical information display. However, since bedside machines usually use low-performance hardware devices, the operating environment is complex, and some devices have low browser versions, it is difficult to quickly locate and solve abnormal problems in Web applications. Therefore, it is particularly necessary to develop a Web monitoring SDK that supports the ward bedside machine environment to collect user behavior data, capture front-end abnormalities, and report them to the server.
[0003] In the prior art, conventional monitoring SDKs do not provide sufficient support for low-version browsers and resource-constrained environments, and cannot fully meet the needs of ward bedside machines. In addition, traditional data reporting methods are prone to interfere with system performance, further reducing monitoring efficiency. Based on the above, this application proposes an implementation method of a ward bedside machine web monitoring SDK. Summary of the invention
[0004] Based on the technical problems existing in the background technology, the present invention proposes a method for implementing a web monitoring SDK for a bedside machine in a ward.
[0005] The present invention proposes a method for implementing a ward bedside machine web monitoring SDK, comprising the following steps:
[0006] S1: Initialize the monitoring SDK: define the interface error status, user behavior and event type, and open the public parameter dsn (reporting address) and apiKey (project identification string) configuration;
[0007] S2: Event monitoring and hijacking: rewrite the global fetch method and XMLHttpRequest, insert data collection logic before and after each network request, monitor the onerror and onunhandledrejection error throwing events of the browser native window, and capture the runtime errors and unhandled Promise exceptions of the error object according to the target object provided by the event;
[0008] S3: Define user behavior: Create a user behavior stack to record user clicks, scrolling, and input operations, and store the behavior in the stack structure. When constructing data reporting parameters, store the behavior stack as an additional field together with the error information to help developers restore the operation steps before the error occurs.
[0009] S4: Error information reporting: According to the actual browser environment, use requestIdleCallback to complete error information data reporting to reduce interference with front-end performance. Old versions and low-performance device browsers directly use native XHR to report information data;
[0010] S5: Error information processing and log collection: Supports custom hook functions, extends error handling logic to process uploaded information data, provides flexible log formatting and filtering mechanisms, and improves troubleshooting efficiency.
[0011] Preferably, in S1, the monitoring SDK adopts a publish-subscribe design pattern, modularly encapsulates various event monitoring and error capture logics, supports Vue and React front-end frameworks, and implements error reporting of Vue projects through Vue.config.errorHandler.
[0012] Preferably, in S2, when rewriting the global fetch method and XMLHttpRequest, the rewriting is performed based on AOP (Aspect Programming).
[0013] Preferably, in S4, when requestIdleCallback is not supported, a microtask (Promise) mechanism is used as an alternative.
[0014] Preferably, in S1, the program code used to define the interface error state and user behavior is as follows:
[0015] Interface error status
[0016]
[0017]
[0018] Preferably, the operating logic program code of S2 is as follows:
[0019]
[0020]
[0021]
[0022] Preferably, the operating logic program code of S3 is as follows:
[0023]
[0024]
[0025] Preferably, the operating logic program code of S4 is as follows:
[0026]
[0027]
[0028]
[0029] Compared with the prior art, the present invention has the following beneficial effects:
[0030] The Web monitoring SDK of the present invention adopts the publish-subscribe design pattern to perform event hijacking and user behavior collection, and combines the native XHR data reporting method and the browser idle time task processing mechanism to achieve accurate monitoring and reporting of abnormal information without interfering with system performance. In addition, it is not restricted by versions and resources, and meets the use requirements of ward bedside machines. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 The present invention is a flowchart of a method for implementing a ward bedside machine web monitoring SDK. DETAILED DESCRIPTION
[0032] The present invention will be further explained below in conjunction with specific embodiments.
[0033] Example
[0034] Reference Figure 1 This embodiment proposes a method for implementing a ward bedside machine web monitoring SDK, including the following steps:
[0035] S1: Initialize the monitoring SDK: define the interface error status, user behavior and event type, and open the public parameter dsn (reporting address) and apiKey (project identification string) configuration;
[0036] The monitoring SDK adopts the publish-subscribe design mode, modularly encapsulates various event monitoring and error capture logic, supports Vue and React front-end frameworks, and implements error reporting of Vue projects through Vue.config.errorHandler;
[0037] In addition, the program code used to define the interface error status and user behavior is as follows:
[0038] Interface error status
[0039]
[0040]
[0041] S2: Event monitoring and hijacking: rewrite the global fetch method and XMLHttpRequest, insert data collection logic before and after each network request, monitor the onerror and onunhandledrejection error throwing events of the browser native window, and capture the runtime errors and unhandled Promise exceptions of the error object according to the target object provided by the event;
[0042] When rewriting the global fetch method and XMLHttpRequest, rewrite based on AOP (aspect programming);
[0043] In addition, its running logic program code is as follows:
[0044]
[0045]
[0046]
[0047] S3: Define user behavior: Create a user behavior stack to record user clicks, scrolling, and input operations, and store the behavior in the stack structure. When constructing data reporting parameters, store the behavior stack as an additional field together with the error information to help developers restore the operation steps before the error occurs.
[0048] In addition, its running logic program code is as follows:
[0049]
[0050]
[0051] S4: Error information reporting: According to the actual browser environment, use requestIdleCallback to complete error information data reporting to reduce interference with front-end performance. Old versions and low-performance device browsers directly use native XHR to report information data. If requestIdleCallback is not supported, use the microtask (Promise) mechanism as an alternative;
[0052] In addition, its running logic program code is as follows:
[0053]
[0054]
[0055]
[0056] S5: Error information processing and log collection: Supports custom hook functions, extends error processing logic to process uploaded information data, provides flexible log formatting and filtering mechanisms, and improves troubleshooting efficiency;
[0057] The Web monitoring SDK of this embodiment adopts the publish-subscribe design pattern to perform event hijacking and user behavior collection, and combines the native XHR data reporting method and the browser idle time task processing mechanism to achieve accurate monitoring and reporting of abnormal information without interfering with system performance. In addition, it is not restricted by versions and resources, and meets the use requirements of bedside machines in wards.
[0058] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for implementing a ward bedside machine web monitoring SDK, characterized in that: The following steps are involved: S1: Initialize the monitoring SDK: define the interface error status, user behavior and event type, and open the public parameters dsn and apiKey configuration; S2: Event monitoring and hijacking: rewrite the global fetch method and XMLHttpRequest, insert data collection logic before and after each network request, monitor the onerror and onunhandledrejection error throwing events of the browser native window, and capture the runtime errors and unhandled Promise exceptions of the error object according to the target object provided by the event; S3: Define user behavior: Create a user behavior stack to record user clicks, scrolling, and input operations, and store the behavior in the stack structure. When building data reporting parameters, store the behavior stack as an additional field together with the error information to help developers restore the operation steps before the error occurs. S4: Error information reporting: According to the actual browser environment, use requestIdleCallback to complete the error information data reporting. Old versions and low-performance device browsers directly use native XHR to report information data; S5: Error information processing and log collection: Supports custom hook functions, extends error handling logic to process uploaded information data, provides flexible log formatting and filtering mechanisms, and improves troubleshooting efficiency.
2. The method for implementing a ward bedside machine web monitoring SDK according to claim 1, characterized in that: In S1, the monitoring SDK adopts the publish-subscribe design pattern, modularly encapsulates various event monitoring and error capture logic, supports Vue and React front-end frameworks, and implements error reporting of Vue projects through Vue.config.errorHandler.
3. The method for implementing a ward bedside machine web monitoring SDK according to claim 1, characterized in that: In S2, when rewriting the global fetch method and XMLHttpRequest, the rewriting is performed based on AOP.
4. The method for implementing a ward bedside machine web monitoring SDK according to claim 1 is characterized in that: In S4, when requestIdleCallback is not supported, a microtask mechanism is used as an alternative.
5. The method for implementing a ward bedside machine web monitoring SDK according to claim 1, characterized in that: In S1, the program code used to define the interface error state and user behavior is as follows: "invalid_argument"; SpanStatus["Unimplemented"]="unimplemented"; SpanStatus["Unavailable"]="unavailable"; SpanStatus["InternalError"]="internal_error"; SpanStatus["UnknownError"]="unknown_error"; SpanStatus["Cancelled"]="cancelled"; SpanStatus["AlreadyExists"]="already_exists"; SpanStatus["FailedPrecondition"]="failed_precondition"; SpanStatus["Aborted"]="aborted"; SpanStatus["OutOfRange"]="out_of_range"; SpanStatus["DataLoss"]="data_loss"; })(SpanStatus||(SpanStatus={})).
6. The method for implementing a ward bedside machine web monitoring SDK according to claim 1, characterized in that: The operation logic program code of S2 is as follows: / / Handle xhr, fetch callbacks handleHttp:function(data,type){ var result=httpTransform(data); / / Add user behavior and remove the interface behavior reported by itself if(!data.url.includes(options.dsn)){ breadcrumb.push({ type:type, 7. The method for implementing a ward bedside machine web monitoring SDK according to claim 1, characterized in that: The operating logic program code of S3 is as follows:
8. The method for implementing a ward bedside machine web monitoring SDK according to claim 1, characterized in that: The operation logic program code of S4 is as follows:
Citation Information
Patent Citations
Method for achieving Script error monitoring and reporting
CN110245050A
SDK module for web front-end error and performance monitoring and calling method thereof
CN112965718A
Web data monitoring method and system, electronic device and storage medium
CN115484245A
Real-time monitoring method and system for front end of Web application
CN116701122A