GetMLServiceResults

Updated at:

Provides intelligent analysis capabilities for basic data such as logs, metrics, and traces on the Simple Log Service platform. Users can invoke relevant models to directly obtain analysis results. The supported scenarios include named entity recognition (NER) for log data, outlier detection for time series data, and root cause analysis of spans for high-latency trace data.

Operation description

The endpoint for this API operation can only be China (Shanghai) or Singapore. The following basic permissions are required:

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "log:Get*"
            ],
            "Resource": [
                "acs:log:*:*:mlservice/sls_builtin_*"
            ],
            "Effect": "Allow"
        }
    ]
}

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

log:GetMLServiceResults

list

*All Resource

*

None None

Request syntax

POST /ml/service/{serviceName}/analysis HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

serviceName

string

No

The service name.

Valid values:

  • sls_builtin_service_trace_rca :

    The service name for high-latency trace analysis.

  • sls_builtin_service_log_struct :

    The service name for LogNER.

  • sls_builtin_service_metric_anomaly :

    The service name for single-dimensional time series outlier detection.

sls_builtin_service_log_struct

Request parameters

Parameter

Type

Required

Description

Example

allowBuiltin

boolean

No

Specifies whether the request is allowed to use system built-in services. Valid values:

  • true: The request is allowed to use system built-in services.

  • false: The request is not allowed to use system built-in services.

Valid values:

  • true :

    The request is allowed to use system built-in services.

  • false :

    The request is not allowed to use system built-in services.

true

version

string

No

The version number of the algorithm. Different versions correspond to different algorithms.

v1

body MLServiceAnalysisParam

No

The request struct.

Valid values:

  • others :

    The description varies based on the serviceName.

The request parameters vary based on the scenario. Details are as follows:

Log content named entity recognition (sls_builtin_service_log_struct)

Parameters related to body.parameter

{
  "is_struct": "true",
  "use_gpu": "true/false",
  "max_fields": "1"
}
  • If is_struct is set to true, it indicates that the log format is JSON. Currently, only true is supported.

  • use_gpu specifies whether to use GPU resources.

  • max_fields specifies the maximum number of fields to be analyzed when the log format is JSON. By default, only one field is analyzed.

Parameters related to body.input

[
  {
    "{column_name}": "{column_value}"
  }
]

The input content is a JSON array, where:

  • column_name indicates the name of a field in the JSON log.

  • column_value indicates the value of a field in the JSON log.

Time series outlier detection (sls_builtin_service_metric_anomaly)

Parameters related to body.parameter

{
  "isOrdered": "true/false",
  "keys": "[]",
  "timeColumnName": "",
  "analysisColumnNames": "[]",
  "interval": "-1"
}
  • isOrdered specifies whether the input data is ordered. If the input sequence is sorted in ascending order by time, set it to true. Otherwise, set it to false.

  • interval specifies the interval of the time series in seconds. For example, if the sequence has one data point per minute, set it to 60. If the interval is uncertain, set it to -1.

  • timeColumnName specifies the name of the time dimension in the input sequence.

  • analysisColumnNames specifies the names of the numerical feature dimensions to be analyzed in the input sequence. The names are represented by an array, and the array must be serialized into a string.

  • keys specifies the names of all columns in the input data. The names are represented by an array, and the array must be serialized into a string.

Parameters related to body.input

[
  {
    "{column_name}": "{column_value}"
  }
]

The input content is an array, where:

  • column_name indicates the name of a field in the sequence.

  • column_value indicates the value of a field in the sequence. When {column_name} is equal to {timeColumnName}, the corresponding value represents the time, which is expressed as a UNIX timestamp in seconds.

High-latency trace data detection (sls_builtin_service_trace_rca)

Parameters related to body.parameter

{
  "project": "",
  "logstore": "",
  "endpoint": "",
  "role_arn": ""
}
  • project specifies the name of the Simple Log Service project where the trace data to be analyzed is stored.

  • logstore specifies the name of the Simple Log Service Logstore where the trace data to be analyzed is stored.

  • endpoint specifies the endpoint of the region where the project resides. You must use a public endpoint. Internal endpoints are not accessible.

  • role_arn specifies the ARN of the role that is authorized to access the resource. You must use the ARN of ETLRole or AuditRole.

Parameters related to body.input

[
  {
    "service": "",
    "name": "",
    "from_ts_sec": "",
    "to_ts_sec": "",
    "slo_ts_micro": "",
    "batch_id": "",
    "trace_ids": "[]"
  }
]

The input content is an array, and the length of the array must be 1. The parameters are described as follows:

  • service specifies the service name of the trace ID or the batch of trace IDs to be diagnosed. You can obtain this value from the Logstore.

  • name specifies the name of the trace ID or the batch of trace IDs to be diagnosed. You can obtain this value from the Logstore.

  • from_ts_sec specifies the start UNIX timestamp of the time range to be analyzed, in seconds.

  • to_ts_sec specifies the end UNIX timestamp of the time range to be analyzed, in seconds.

  • batch_id specifies the name of the current batch of trace IDs to be analyzed.

  • trace_ids specifies the list of trace IDs corresponding to the current request. Serialize the list into a string using JSON.

Response elements

Element

Type

Description

Example

object

The response struct.

Valid values:

  • 无 :

    None.

data

array<object>

The returned data.

object

The dataset struct.

string

The returned result.

{'marker': ''}

status

object

The status of the task.

Valid values:

  • 无 :

    None.

string

The default value is empty, which indicates that tasks in all statuses are returned. Supported statuses include success, fail, and running.

Valid values:

  • 无 :

    None.

200

The response parameters vary based on the scenario. Details are as follows:

Log content named entity recognition (sls_builtin_service_log_struct)

Content related to data

[
  {
    "{column_name}": "{column_value}"
  }
]

Each JSON object in the output corresponds to an input JSON log, where:

  • column_name indicates the name of an analyzed field in the JSON log. A maximum of max_fields fields are analyzed.

  • column_value indicates the value of an analyzed field in the JSON log. The NER results in the field value are wrapped in the <ml_ner_${ner_type}></ml_ner_${ner_type}> tags, where ${ner_type} is the specific NER type.

Time series outlier detection (sls_builtin_service_metric_anomaly)

Content related to data

[
  {
    "start": "",
    "end": "",
    "label": ""
  }
]
  • start indicates the start time of the detected anomaly interval.

  • end indicates the end time of the detected anomaly interval.

  • label indicates the anomaly type of the detected interval. Valid values:
    • SPIKE_UP_TYPE

    • SPIKE_DOWN_TYPE

    • TREND_UP_TYPE

    • TREND_DOWN_TYPE

    • MEANSHIFT_UPWARD_TYPE

    • MEANSHIFT_DOWNWARD_TYPE

High-latency trace data detection (sls_builtin_service_trace_rca)

Content related to data

[
  {
    "traceID": "",
    "service": "",
    "name": "",
    "rootCauses": "[{}]"
  }
]
  • traceID indicates the trace ID to be detected.

  • service indicates the service name of the root node of the current trace.

  • name indicates the name of the root node of the current trace.

  • rootCauses indicates the list of spans that cause high latency in the current high-latency trace request. The list is represented by a serialized string. The deserialized structure of this field is as follows:

[
  {
    "spanID": "",
    "service": "",
    "name": "",
    "host": "xxxx",
    "predicateDuration": 10
  }
]

Examples

Success response

JSON format

{
  "data": [
    {
      "key": "{'marker': ''}"
    }
  ],
  "status": {
    "key": "200"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.