in plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInvocationSession.java [625:660]
private void sendSessionCompletionResult() {
try {
if (StringUtils.isEmpty(suggestionsContext.getSessionId()) || suggestionsContext.getDetails() == null
|| suggestionsContext.getDetails().isEmpty()) {
return;
}
if (suggestionDisplaySessionStopWatch.isStarted()) {
suggestionDisplaySessionStopWatch.stop();
}
final ConcurrentHashMap<String, InlineCompletionStates> completionStatesCopy = new ConcurrentHashMap<String, InlineCompletionStates>();
// Explicitly copy the map contents
for (Map.Entry<String, InlineCompletionStates> entry : suggestionCompletionResults.entrySet()) {
completionStatesCopy.put(String.valueOf(entry.getKey()), entry.getValue());
}
var result = new LogInlineCompletionSessionResultsParams(suggestionsContext.getSessionId(),
completionStatesCopy);
if (firstSuggestionDisplayLatency > 0L) {
result.setFirstCompletionDisplayLatency(firstSuggestionDisplayLatency);
}
var sessionTime = suggestionDisplaySessionStopWatch.getTime(TimeUnit.MILLISECONDS);
if (sessionTime > 0L) {
result.setTotalSessionDisplayTime(sessionTime);
}
if (initialTypeaheadLength.isPresent()) {
result.setTypeaheadLength(initialTypeaheadLength.get());
}
sendCompletionSessionResult(result);
} catch (Exception e) {
Activator.getLogger()
.error("Error occurred when sending suggestion completion results to Amazon Q language server", e);
}
}