-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add serverStats to BrokerQueryEventListener #14807
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
import java.util.concurrent.TimeUnit; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
import java.util.concurrent.atomic.AtomicReference; | ||
import java.util.stream.Collectors; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.concurrent.ThreadSafe; | ||
import org.apache.pinot.common.datatable.DataTable; | ||
|
@@ -145,6 +146,21 @@ public String getServerStats() { | |
return stringBuilder.toString(); | ||
} | ||
|
||
@Override | ||
public Map<String, Map<String, Integer>> getServerStatsMap() { | ||
return _responseMap.entrySet().stream() | ||
.collect(Collectors.toMap( | ||
entry -> entry.getKey().getShortName(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The key here is the host right? is there a way to make it more explicit? Maybe instead of using Map<String, Map<String, Integer>> we can use Map<String, ServerStatsInfo> something and use POJO to easily extract the metric values. |
||
entry -> Map.of( | ||
"SubmitDelayMs", entry.getValue().getSubmitDelayMs(), | ||
"ResponseDelayMs", entry.getValue().getResponseDelayMs(), | ||
"ResponseSize", entry.getValue().getResponseSize(), | ||
"DeserializationTimeMs", entry.getValue().getDeserializationTimeMs(), | ||
"RequestSentDelayMs", entry.getValue().getRequestSentDelayMs() | ||
) | ||
)); | ||
} | ||
|
||
@Override | ||
public long getServerResponseDelayMs(ServerRoutingInstance serverRoutingInstance) { | ||
return _responseMap.get(serverRoutingInstance).getResponseDelayMs(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,7 @@ public class DefaultRequestContext implements RequestScope { | |
private Map<String, String> _traceInfo = new HashMap<>(); | ||
private List<String> _processingExceptions = new ArrayList<>(); | ||
private Map<String, List<String>> _requestHttpHeaders = new HashMap<>(); | ||
private Map<String, Map<String, Integer>> _serverStatsMap = new HashMap<>(); | ||
|
||
public DefaultRequestContext() { | ||
} | ||
|
@@ -573,6 +574,16 @@ public void setRequestHttpHeaders(Map<String, List<String>> requestHttpHeaders) | |
_requestHttpHeaders.putAll(requestHttpHeaders); | ||
} | ||
|
||
@Override | ||
public Map<String, Map<String, Integer>> getServerStatsMap() { | ||
return _serverStatsMap; | ||
} | ||
|
||
@Override | ||
public void setServerStatsMap(Map<String, Map<String, Integer>> serverStatsMap) { | ||
_serverStatsMap.putAll(serverStatsMap); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is counter-intuitive. Instead of |
||
} | ||
|
||
@Override | ||
public void close() { | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add UTs for this?