Skip to content

Commit

Permalink
Merge pull request #718 from gunlee01/feature/xlog-filter
Browse files Browse the repository at this point in the history
[client] xlog filter - support sync & async condition.
  • Loading branch information
gunlee01 authored Jul 18, 2020
2 parents 7ad2c1d + 85c7c59 commit 3b63aa3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scouter.client/src/scouter/client/xlog/XLogFilterStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class XLogFilterStatus {
public boolean onlySql;
public boolean onlyApicall;
public boolean onlyError;
public boolean onlySync;
public boolean onlyAsync;
public String profileSizeText = "";
public String profileBytesText = "";

Expand All @@ -47,6 +49,8 @@ public int hashCode() {
filter_hash ^= HashUtil.hash(onlyError ? "onlyError" : "");
filter_hash ^= HashUtil.hash(onlySql ? "onlySql" : "");
filter_hash ^= HashUtil.hash(onlyApicall ? "onlyApicall" : "");
filter_hash ^= HashUtil.hash(onlySync ? "onlySync" : "");
filter_hash ^= HashUtil.hash(onlyAsync ? "onlyAsync" : "");
filter_hash ^= HashUtil.hash(profileSizeText);
filter_hash ^= HashUtil.hash(profileBytesText);
return filter_hash;
Expand All @@ -73,6 +77,8 @@ public XLogFilterStatus clone() {
status.onlySql = onlySql;
status.onlyApicall = onlyApicall;
status.onlyError = onlyError;
status.onlySync = onlySync;
status.onlyAsync = onlyAsync;
return status;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class XLogFilterDialog extends Dialog {
Text serviceTxt, ipTxt, startHmsFromTxt, startHmsToTxt, resTimeFromTxt, resTimeToTxt, userAgentTxt, loginText, descText;
Text hasDumpYn, text1Text, text2Text, text3Text, text4Text, text5Text, profileSizeText, profileByteText;
Button onlySqlBtn, onlyApiBtn, onlyErrorBtn;
Button onlySyncBtn, onlyAsyncBtn;
Button clearBtn, applyBtn;

XLogViewCommon view;
Expand Down Expand Up @@ -386,6 +387,28 @@ public void widgetSelected(SelectionEvent e) {
compareHash();
}
});

onlySyncBtn = new Button(checkGroup, SWT.CHECK);
onlySyncBtn.setText("Sync");
onlySyncBtn.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
onlySyncBtn.setSelection(status.onlySync);
onlySyncBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
newStatus.onlySync = onlySyncBtn.getSelection();
compareHash();
}
});

onlyAsyncBtn = new Button(checkGroup, SWT.CHECK);
onlyAsyncBtn.setText("Async");
onlyAsyncBtn.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
onlyAsyncBtn.setSelection(status.onlyAsync);
onlyAsyncBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
newStatus.onlyAsync = onlyAsyncBtn.getSelection();
compareHash();
}
});

Composite btnComp = new Composite(container, SWT.NONE);
btnComp.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false));
Expand Down Expand Up @@ -417,6 +440,8 @@ public void widgetSelected(SelectionEvent e) {
onlySqlBtn.setSelection(false);
onlyApiBtn.setSelection(false);
onlyErrorBtn.setSelection(false);
onlySyncBtn.setSelection(false);
onlyAsyncBtn.setSelection(false);
profileSizeText.setText("");
profileByteText.setText("");
newStatus = new XLogFilterStatus();
Expand Down
16 changes: 16 additions & 0 deletions scouter.client/src/scouter/client/xlog/views/XLogViewPainter.java
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ && isUserAgentFilterOk(d)
&& isErrorFilterOk(d.p)
&& isApicallFilterOk(d.p)
&& isSqlFilterOk(d.p)
&& isSyncOk(d.p)
&& isAsyncOk(d.p)
&& isProfileSizeFilterOk(d.p)
&& isProfileByteFilterOk(d.p)
;
Expand Down Expand Up @@ -866,6 +868,20 @@ public boolean isSqlFilterOk(XLogPack p) {
}
return true;
}

public boolean isSyncOk(XLogPack p) {
if (filterStatus.onlySync) {
return p.xType != 2 && p.xType != 3 && p.xType != 4;
}
return true;
}

public boolean isAsyncOk(XLogPack p) {
if (filterStatus.onlyAsync) {
return p.xType == 2 || p.xType == 3 || p.xType == 4;
}
return true;
}

public boolean isApicallFilterOk(XLogPack p) {
if (filterStatus.onlyApicall) {
Expand Down

0 comments on commit 3b63aa3

Please sign in to comment.