Write upload-pack metrics to sshd log

In order to enable detailed performance and problem analysis add
upload-pack metrics to the sshd log. The log format for upload-pack log
records is now enhanced to:
- timestamp
- session id
- thread name
- user name
- account id
- message
- command wait time
- command execution time
- time negotiating
- time searching for reuse
- time searching for sizes
- time counting
- time compressing
- time writing
- total time in UploadPack
- bitmap index misses (-1 means no bitmap index available)
- total deltas
- total objects
- total bytes transferred
- client agent

If statistics aren't available e.g. since an exception occurred they are
logged as -1.

Change-Id: I4ec08579cedfeb6a30eb41d2e2a110f4f8eee8fa
This commit is contained in:
Matthias Sohn
2020-02-11 16:44:50 +01:00
parent a13052bad8
commit 73b8fd117c
5 changed files with 56 additions and 3 deletions

View File

@@ -53,6 +53,7 @@ class SshLog implements LifecycleListener, GerritConfigListener {
private static final String P_EXEC = "executionTime";
private static final String P_STATUS = "status";
private static final String P_AGENT = "agent";
private static final String P_MESSAGE = "message";
private final Provider<SshSession> session;
private final Provider<Context> context;
@@ -147,6 +148,10 @@ class SshLog implements LifecycleListener, GerritConfigListener {
}
void onExecute(DispatchCommand dcmd, int exitValue, SshSession sshSession) {
onExecute(dcmd, exitValue, sshSession, null);
}
void onExecute(DispatchCommand dcmd, int exitValue, SshSession sshSession, String message) {
final Context ctx = context.get();
ctx.finished = TimeUtil.nowMs();
@@ -180,6 +185,10 @@ class SshLog implements LifecycleListener, GerritConfigListener {
event.setProperty(P_AGENT, peerAgent);
}
if (message != null) {
event.setProperty(P_MESSAGE, message);
}
if (async != null) {
async.append(event);
}