CreateDeliveryTask

Updated at:

Creates a data delivery node that delivers metric data from a specified data source to a destination storage or MSMQ. Supports three delivery types: Prometheus Remote Write, Kafka, and MaxCompute. You can filter metrics by labels to specify the delivery scope and attach custom labels to the delivered metrics.

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

cms:CreateDeliveryTask

create

*DeliveryTask

acs:cms:{#regionId}:{#accountId}:deliverytask/*

None None

Request syntax

POST /delivery-tasks HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

dataSourceId

string

Yes

The ID of the data source, which is the ID of the Prometheus instance.

rw-xxxxxx

externalLabels

object

No

The additional labels attached to all delivered metrics. The key is the label name and the value is the label value.

string

No

The mapping between the external label key and the external label value, such as region → cn-hangzhou.

region: cn-hangzhou

labelFilters

object

No

The metric filtering conditions used in conjunction with labelFiltersType. The key is the metric label name and the value is the match value.

string

No

The mapping between the filter key and the filter value, such as name → up or job → my_job.

__name__: up

labelFiltersType

string

No

The metric filtering mode.

Valid values:

  • Allow
  • Deny

Allow

resourceGroupId

string

No

The ID of the resource group.

rg-ae******ey

sinkList

array<object>

Yes

The list of delivery destinations.

array<object>

Yes

The configuration of the delivery destination.

sinkConfigs

object

No

The detailed configuration of the delivery destination. The meanings of the key and value vary based on the sinkType. For more information, see the following descriptions.

string

No

The configuration items supported by each sinkType. For more information, see the following descriptions.

Url: http://xxxx/api/v1/write

sinkType

string

Yes

The type of the delivery destination.

Valid values:

  • Prometheus
  • AcsMaxCompute
  • AcsKafka

Prometheus

tags

array<object>

No

The resource tags.

object

No

The resource tags.

key

string

No

The key of the resource tag.

_cms_workspace

value

string

No

The value of the resource tag.

test

taskDescription

string

No

The description of the task.

my delivery task

taskName

string

Yes

The name of the task. The name can contain Chinese characters, English letters, underscores (_), and hyphens (-).

my-task

sinkConfigs configuration items

sinkType = Prometheus

KeyRequiredDescriptionExampleValid values
UrlYesThe Remote Write endpoint.http://xxxx/api/v1/write
NetworkNoThe network type.PublicNetwork- PublicNetwork: public network
- PrivateNetwork: private network or VPC

VpcIdNoThe ID of the VPC. Required when Network is set to PrivateNetwork.vpc-xxxxxx
VSwtichIdNoThe ID of the vSwitch.vsw-xxxxxx
SecurityGroupIdNoThe ID of the security group.sg-xxxxxx
HeaderNoThe custom HTTP header. The value must be a map string in JSON format.{"aaa":"bbb","ccc":"ddd"}
AuthTypeNoThe authentication type.BasicAuth- BasicAuth
- None

UsernameNoThe username for Basic Auth. Required when AuthType is set to BasicAuth.admin
PasswordNoThe password for Basic Auth. Required when AuthType is set to BasicAuth.xxxxxx

sinkType = AcsKafka

KeyRequiredDescriptionExample
InstanceIdYesThe ID of the Kafka instance.alikafka_xxxxx
TopicYesThe name of the Kafka topic.my-topic

sinkType = AcsMaxCompute

KeyRequiredDescriptionExample
ServiceNameYesThe name of the MaxCompute service.my-mc-service

Response elements

Element

Type

Description

Example

object

Schema of Response

requestId

string

Id of the request

4CB23A2E-B426-5D4B-9AA2-6C7A508D954B

taskId

string

The ID of the delivery task.

98e367d8fb8cc83b

Examples

Success response

JSON format

{
  "requestId": "4CB23A2E-B426-5D4B-9AA2-6C7A508D954B",
  "taskId": "98e367d8fb8cc83b"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.