• CLI

sdk
  1. Help Center
  2. CLI
  3. Developer Guide
  4. SDK
  5. Python
  6. CTS Python SDK Demo

CTS Python SDK Demo

Tracker

A tracker will be created after CTS is enabled. All traces recorded by CTS are associated with the tracker.

Creating a Tracker

You can use the Python OpenStack SDK to create a tracker on the cloud platform.

You can create a tracker using the Python OpenStack SDK based on the following code by specifying required parameters, such as the bucket name, folder name, and status:

tracker=conn.cts.create_tracker(bucket_name="obs-ting",file_prefix_name='SDKunittest');

Deleting a Tracker

You can delete a tracker using the Python OpenStack SDK based on the following code:

conn.cts.delete_tracker(tracker='system', ignore_missing=True);

Updating a Tracker

You can update a tracker using the Python OpenStack SDK based on the following code. The information that can be updated includes the bucket name, folder name, and status.

tracker=conn.cts.update_tracker(tracker='system',bucket_name="obs--bce0",file_prefix_name='SDKunittest' );

Querying a Tracker

You can query a tracker using the Python OpenStack SDK based on the following code by specifying the tracker name:

tracker=conn.cts.get_tracker(name='system');

Trace

This interface is used to query records of operations on resources during the last seven days.

Querying the Trace List

You can query a trace list using the Python OpenStack SDK based on the following code. You can filter out required traces by specifying multiple parameters.

list=conn.cts.traces(tracker='system',service_type='CTS',limit='5');