Help Center> > Developer Guide > Java >CTS Java SDK Demo

CTS Java SDK Demo


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

Creating a Tracker

You can create a tracker using OpenStack4j based on the following code. Currently, only one tracker system can be created.

public void CreateTracker() { 
Tracker create = osclient.cloudTraceV1().trackers().create(bucket_name,FilePrefixName); 

Deleting a Tracker

You can delete a tracker using OpenStack4j based on the following code:

public void DeleteTraker() {
ActionResponse delete = osclient.cloudTraceV1().trackers().delete(tracker_name);
List<Tracker> trackers = osclient.cloudTraceV1().trackers().list();
Assert.assertTrue(trackers.size() == 0);

Updating a Tracker

You can update a tracker using OpenStack4j based on the following code. The information that can be updated includes the bucket name, folder name, status, and the tracker name. The tracker name is optional and can be only system.

public void UpdateTraker() { 
TrackerUpdate update = TrackerUpdate.builder().trackerName(tracker_name) 
Tracker updated = osclient.cloudTraceV1().trackers().update(update); 

Querying a Tracker

You can query a tracker using OpenStack4j based on the following code by specifying tracker_name:

public void GetTraker() {
Tracker get = osclient.cloudTraceV1().trackers().get(tracker_name);


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 OpenStack4j based on the following code. You can filter out required traces by specifying multiple parameters.

	List<Trace>list=osclient.cloudTraceV2().traces().list("system", options);
		List<Trace>list2=osclient.cloudTraceV2().traces().list("system", options);