Updated on 2022-02-22 GMT+08:00

Querying a Tracker

Function

This API is used to query tracker details, including the name of trackers, name of OBS buckets for storing traces, and file name prefix of the traces files stored in OBS buckets.

URI

GET /v3/{project_id}/trackers

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Identifies a project. For details, see section "Obtaining the Account ID and Project ID" in Cloud Trace Service API Reference.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

tracker_name

No

String

Indicates the tracker name. If this parameter is not specified, all trackers of a tenant will be queried.

tracker_type

No

String

Indicates the tracker type. The value can be system (indicating a management tracker), or data (indicating a data tracker).

Enumeration values:

  • system

  • data

Request Parameters

None

Response Parameters

If a status code 200is returned, see the parameters in the following tables.

Table 3 Response body parameters

Parameter

Type

Description

trackers

Array of TrackerResponseBody objects

Indicates a list of tracker information.

Table 4 TrackerResponseBody

Parameter

Type

Description

id

String

Uniquely identifies a tracker.

create_time

Long

Indicates the timestamp when the tracker was created.

kms_id

String

Identifies a key used for trace file encryption. The key ID is obtained from Key Management Service (KMS). This parameter is mandatory when tracker_type is set to system and is_support_trace_files_encryption is set to true.

is_support_validate

Boolean

Indicates whether to enable the trace file verification. This function is supported only when the value of tracker_type is system.

lts

Lts object

Indicates detail about trace analysis.

tracker_type

String

Indicates the tracker type. The value can be system (indicating a management tracker), or data (indicating a data tracker).

Enumeration values:

  • system

  • data

domain_id

String

Identifies an account. For details, see section "Obtaining the Account ID and Project ID" in Cloud Trace Service API Reference.

project_id

String

Identifies a project.

tracker_name

String

Indicates the tracker name. The value is system.

status

String

Indicates the status of a tracker. The value can be enabled, disabled, or error. If the value is error, the detail field is required for specifying the source of the error.

Enumeration values:

  • enabled

  • disabled

detail

String

This parameter is returned only when the tracker status is error. It indicates the cause of the abnormal status, and its value can be bucketPolicyError, noBucket, or arrears.

is_support_trace_files_encryption

Boolean

Indicates whether trace files are encrypted during transfer to an OBS bucket. This parameter must be used together with kms_id. This function is supported only when the value of tracker_type is system.

obs_info

ObsInfo object

Indicates the Information about the bucket to which traces are transferred.

data_bucket

DataBucketQuery object

Indicates the Information about the bucket tracked by a data tracker. This parameter is valid only when tracker_type is set to data.

Table 5 Lts

Parameter

Type

Description

is_lts_enabled

Boolean

Indicates whether traces are synchronized to LTS for trace search and analysis.

log_group_name

String

Indicates the name of the log group that CTS creates in LTS.

log_topic_name

String

Indicates the name of the log stream that CTS creates in LTS.

Table 6 ObsInfo

Parameter

Type

Description

bucket_name

String

Indicate the name of an OBS bucket. The value contains 3 to 63 characters and must start with a digit or lowercase letter. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.

file_prefix_name

String

Indicates a file name prefix to mark trace files that need to be stored in an OBS bucket. The value contains 0 to 64 characters. Only uppercase and lowercase letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

is_obs_created

Boolean

Indicates whether the OBS bucket is automatically created by the tracker.

is_authorized_bucket

Boolean

Indicates whether CTS has been granted permissions to perform operations on the OBS bucket.

bucket_lifecycle

Long

Indicates the duration that traces are stored in the OBS bucket. This parameter is valid only when tracker_type is set to data.

Table 7 DataBucketQuery

Parameter

Type

Description

data_bucket_name

String

Indicate the name of an OBS bucket. The value contains 3 to 63 characters and must start with a digit or lowercase letter. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.

search_enabled

Boolean

Indicates whether the logs of the tracked bucket can be searched.

data_event

Array of strings

Indicates the operations to track.

Enumeration values:

  • WRITE

  • READ

If a status code 400is returned, see the parameters in the following tables.

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Indicates an error code, in the format of CTS.XXX.

error_msg

String

Indicates the error description.

Request Examples

GET https://{endpoint}/v3/{project_id}/trackers?tracker_name=system

Response Examples

Status code: 200

The request is successful.

{
  "trackers" : [ {
    "is_support_trace_files_encryption" : true,
    "create_time" : 1589886034121,
    "streamId" : "4a1ef2b6-d79a-4dc6-90f0-48151cd5491b",
    "kms_id" : "7dbbb3fa-93e4-4528-bc7b-9beb794b0229",
    "groupId" : "26fa12ac-75f7-42ed-8118-ab9f2263042f",
    "is_support_validate" : false,
    "obs_info" : {
      "is_obs_created" : false,
      "bucket_name" : "",
      "is_authorized_bucket" : false,
      "file_prefix_name" : "",
      "bucket_lifecycle" : 0
    },
    "lts" : {
      "log_group_name" : "CTS",
      "is_lts_enabled" : true,
      "log_topic_name" : "system-trace"
    },
    "tracker_type" : "system",
    "domain_id" : "2306579dc99f4c8690b14b68e734fcd9",
    "project_id" : "24edf66e79d04187acb99a463e610764",
    "tracker_name" : "system",
    "id" : "ebf8d1c3-762b-4ce3-b316-6b1aa32f8be3",
    "status" : "enabled"
  }, {
    "domain_id" : "2306579dc99f4c8690b14b68e734fcd9",
    "is_support_trace_files_encryption" : false,
    "obs_info" : {
      "is_obs_created" : false,
      "bucket_name" : "",
      "is_authorized_bucket" : false,
      "file_prefix_name" : "",
      "bucket_lifecycle" : 0
    },
    "create_time" : 1589276171198,
    "project_id" : "24edf66e79d04187acb99a463e610764",
    "data_bucket" : {
      "data_event" : [ "READ", "WRITE" ],
      "search_enabled" : false,
      "data_bucket_name" : "cstest0423"
    },
    "tracker_name" : "sdsa",
    "is_support_validate" : false,
    "lts" : {
      "log_group_name" : "CTS",
      "is_lts_enabled" : false,
      "log_topic_name" : "sdsa"
    },
    "id" : "c9a3961d-3aa0-4e60-8e63-dd4ce7f1a88a",
    "status" : "enabled",
    "tracker_type" : "data"
  } ]
}

Status Codes

Status Code

Description

200

The request is successful.

400

The server failed to process the request.

401

The request is rejected due to authentication failure.

403

The server understood the request but refused to authorize it.

500

The server has received the request but encountered an internal error.

503

The requested service is unavailable. The client should not repeat the request without modifications.

Error Codes

See Error Codes.