Skip to content
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

Include information on whether a query is using SSQE or MSQE in QueryLogger #14938

Merged
merged 3 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -120,17 +120,19 @@ public static class QueryLogParams {
private final RequestContext _requestContext;
private final String _table;
private final BrokerResponse _response;
private boolean _isMultiStageQueryEngine;
yashmayya marked this conversation as resolved.
Show resolved Hide resolved
@Nullable
private final RequesterIdentity _identity;
@Nullable
private final ServerStats _serverStats;

public QueryLogParams(RequestContext requestContext, String table, BrokerResponse response,
@Nullable RequesterIdentity identity, @Nullable ServerStats serverStats) {
boolean isMultiStageQueryEngine, @Nullable RequesterIdentity identity, @Nullable ServerStats serverStats) {
_requestContext = requestContext;
// NOTE: Passing table name separately because table name within request context is always raw table name.
_table = table;
_response = response;
_isMultiStageQueryEngine = isMultiStageQueryEngine;
_identity = identity;
_serverStats = serverStats;
}
Expand Down Expand Up @@ -255,6 +257,12 @@ void doFormat(StringBuilder builder, QueryLogger logger, QueryLogParams params)
builder.append(CommonConstants.UNKNOWN);
}
}
},
IS_MULTI_STAGE_QUERY_ENGINE("isMultiStageQueryEngine") {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could call this queryEngine with possible options being singleStage / multiStage so that it is open to future extensions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that idea

@Override
void doFormat(StringBuilder builder, QueryLogger logger, QueryLogParams params) {
builder.append(params._isMultiStageQueryEngine);
}
};

public final String _entryName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,8 @@ protected BrokerResponse handleRequest(long requestId, String query, SqlNodeAndO

// Log query and stats
_queryLogger.log(
new QueryLogger.QueryLogParams(requestContext, tableName, brokerResponse, requesterIdentity, serverStats));
new QueryLogger.QueryLogParams(requestContext, tableName, brokerResponse, false, requesterIdentity,
serverStats));

return brokerResponse;
} finally {
Expand Down Expand Up @@ -908,7 +909,7 @@ private BrokerResponseNative getEmptyBrokerOnlyResponse(PinotQuery pinotQuery, R
ParserUtils.fillEmptyResponseSchema(brokerResponse, _tableCache, schema, database, query);
brokerResponse.setTimeUsedMs(System.currentTimeMillis() - requestContext.getRequestArrivalTimeMillis());
_queryLogger.log(
new QueryLogger.QueryLogParams(requestContext, tableName, brokerResponse, requesterIdentity, null));
new QueryLogger.QueryLogParams(requestContext, tableName, brokerResponse, false, requesterIdentity, null));
return brokerResponse;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ protected BrokerResponse handleRequest(long requestId, String query, SqlNodeAndO

// Log query and stats
_queryLogger.log(
new QueryLogger.QueryLogParams(requestContext, tableNames.toString(), brokerResponse, requesterIdentity,
null));
new QueryLogger.QueryLogParams(requestContext, tableNames.toString(), brokerResponse, true,
requesterIdentity, null));

return brokerResponse;
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void shouldFormatLogLineProperly() {
+ "offlineThreadCpuTimeNs(total/thread/sysActivity/resSer):45/14/15/16,"
+ "realtimeThreadCpuTimeNs(total/thread/sysActivity/resSer):54/17/18/19,"
+ "clientIp=ip,"
+ "isMultiStageQueryEngine=false,"
+ "query=SELECT * FROM foo");
//@formatter:on
}
Expand Down Expand Up @@ -281,6 +282,6 @@ public String getClientIp() {
ServerStats serverStats = new ServerStats();
serverStats.setServerStats("serverStats");

return new QueryLogger.QueryLogParams(requestContext, "table", response, identity, serverStats);
return new QueryLogger.QueryLogParams(requestContext, "table", response, false, identity, serverStats);
}
}
Loading