General Description
API Description
The msServiceProfiler module offers Python APIs for profiling inference services.
For details about the functions and usage examples of these APIs, see Data Collection.
Python API import: from ms_service_profiler import Profiler, Level
API List
The specific APIs are as follows:
Table 1 Serving data profiling APIs (Python)
| Interface | Description |
|---|---|
| init | Performs initialization. |
| enter/exit | Upon entry, automatically calls the span_start function to record the start time of a process; upon exit, automatically calls the span_end function to record the end time of a process. |
| span_start | Records the start point of a process. |
| span_end | Records the end point of a process. |
| event | Records an event. |
| link | Records the association between different resources. |
| metric | Records a metric value. |
| metric_inc | Records an incremental metric value. |
| metric_scope | Defines a metric scope. |
| metric_scope_as_req_id | Sets the metric scope to the request level. |
| launch | Flushes the request record to the disk. |
| attr | Adds an attribute and returns the current object. Chain calls are supported. |
| domain | Specifies a domain for the data, where records with the same domain are grouped together in trace data. |
| res | Assigns a resource ID, where data and timeline are associated based on the resource ID. |
| get_msg | Obtains the currently recorded data. |