diff --git a/metacat-common/src/main/java/com/netflix/metacat/common/MetacatRequestContext.java b/metacat-common/src/main/java/com/netflix/metacat/common/MetacatRequestContext.java index 7f28875d..1efb31d0 100644 --- a/metacat-common/src/main/java/com/netflix/metacat/common/MetacatRequestContext.java +++ b/metacat-common/src/main/java/com/netflix/metacat/common/MetacatRequestContext.java @@ -92,7 +92,7 @@ public class MetacatRequestContext implements Serializable { */ public MetacatRequestContext() { this.userName = null; - this.clientAppName = null; + this.clientAppName = UNKNOWN; this.clientId = null; this.jobId = null; this.dataTypeContext = null; @@ -198,6 +198,7 @@ public static class MetacatRequestContextBuilder { MetacatRequestContextBuilder() { this.bApiUri = UNKNOWN; this.bScheme = UNKNOWN; + this.bClientAppName = UNKNOWN; } /** diff --git a/metacat-main/src/main/java/com/netflix/metacat/main/api/RequestWrapper.java b/metacat-main/src/main/java/com/netflix/metacat/main/api/RequestWrapper.java index 23240b85..64f28c00 100644 --- a/metacat-main/src/main/java/com/netflix/metacat/main/api/RequestWrapper.java +++ b/metacat-main/src/main/java/com/netflix/metacat/main/api/RequestWrapper.java @@ -154,8 +154,14 @@ public R processRequest( if (requestTags != null) { tags.putAll(requestTags); } + tags.put("request", resourceRequestName); tags.put("scheme", MetacatContextManager.getContext().getScheme()); + String clientAppName = MetacatContextManager.getContext().getClientAppName(); + if (clientAppName == null) { + clientAppName = "UNKNOWN"; + } + tags.put("caller", clientAppName); registry.counter(requestCounterId.withTags(tags)).increment(); try { @@ -243,6 +249,7 @@ public R processRequest( final long start = registry.clock().wallTime(); final Map tags = Maps.newHashMap(); tags.put("request", resourceRequestName); + tags.put("caller", MetacatContextManager.getContext().getClientAppName()); registry.counter(requestCounterId.withTags(tags)).increment(); try { MetacatContextManager.getContext().setRequestName(resourceRequestName);