Overview

Introduction

The msServiceProfiler module offers Python APIs for profiling inference services.

For details about the functions and usage examples of the inference service profiling APIs, see Data Profiling.

Python API import: from ms_service_profiler import Profiler, Level

APIs

Specific APIs are listed below.

Table 1 Profiling APIs (Python)

API

Description

init

Performs initialization.

__enter__/__exit__

Calls the span_start function automatically when the process enters to log its start time. Calls the span_end function automatically when the process exits to log its end time.

span_start

Records the start node of a process.

span_end

Records the end node of a process.

event

Records an event.

link

Records the association between different resources.

metric

Records the value of a metric class.

metric_inc

Records the increment of a metric class.

metric_scope

Defines the scope of a metric class.

metric_scope_as_req_id

Defines the scope of a metric class as the request ID.

launch

Flushes the request record to the disk.

attr

Adds an attribute and returns the current object. Chain calls are supported.

domain

Defines the domain of the data. Entries in the same domain form a category in the trace data.

res

Assigns a unique resource ID to link the data with its corresponding timeline.

get_msg

Obtains the current record data.