Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public String toString() {
public static final String CONST_X_SLS_CURSOR = "x-log-cursor";
public static final String CONST_X_SLS_COUNT = "x-log-count";
public static final String CONST_X_SLS_PROCESS = "x-log-progress";
public static final String CONST_X_SLS_SCANBYTES = "x-log-scanbytes";
public static final String CONST_X_SLS_NEXT_TOKEN = "x-log-nexttoken";
public static final String CONST_X_ACS_SECURITY_TOKEN = "x-acs-security-token";
public static final String CONST_X_LOG_RESOURCEOWNERACCOUNT = "x-log-resourceowneraccount";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,33 @@ public GetHistogramsRequest(String project, String logStore, String topic,
SetAccurate(accurate);
}

/**
* Construct a request
*
* @param project
* sls project
* @param logStore
* the logstore in the project
* @param topic
* the topic of the logstore
* @param query
* user defined query
* @param from
* the begin time
* @param to
* the end time
* @param accurate
* accurate flag
* @param reverse
* reverse flag
*/
public GetHistogramsRequest(String project, String logStore, String topic,
String query, int from, int to, boolean accurate, boolean reverse) {
this(project, logStore, topic, query, from, to);
SetAccurate(accurate);
SetReverse(reverse);
}

/**
* Set log store
*
Expand Down Expand Up @@ -194,4 +221,28 @@ public boolean GetAccurate() {
}
}

/**
* Set request reverse flag
*
* @param reverse
* reverse flag
*/
public void SetReverse(boolean reverse) {
SetParam(Consts.CONST_REVERSE, String.valueOf(reverse));
}

/**
* Get request reverse flag
*
* @return reverse flag
*/
public boolean GetReverse() {
String reverse = GetParam(Consts.CONST_REVERSE);
if (reverse.isEmpty()) {
return false;
} else {
return Boolean.parseBoolean(reverse);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class GetHistogramsResponse extends Response {
private static final long serialVersionUID = 5169979404935069850L;
private boolean mIsCompleted = false;
private long mCount = 0;
private long mScanBytes = 0;
private ArrayList<Histogram> mHistogram = new ArrayList<Histogram>();

/**
Expand All @@ -33,6 +34,9 @@ public class GetHistogramsResponse extends Response {
public GetHistogramsResponse(Map<String, String> headers) {
super(headers);
this.SetProcessStatus(headers.get(Consts.CONST_X_SLS_PROCESS));
if (headers.containsKey(Consts.CONST_X_SLS_SCANBYTES)) {
mScanBytes = Long.parseLong(headers.get(Consts.CONST_X_SLS_SCANBYTES));
}
}

/**
Expand All @@ -44,6 +48,15 @@ public long GetTotalCount() {
return mCount;
}

/**
* Get query scan bytes
*
* @return scan bytes
*/
public long GetScanBytes() {
return mScanBytes;
}

/**
* Set process status to the response
*
Expand Down