Skip to content

Commit 7841ff6

Browse files
gtretteneroGiorgio Trettenero
and
Giorgio Trettenero
authored
Add Null check to second processRequest (#631)
Co-authored-by: Giorgio Trettenero <[email protected]>
1 parent cb03b4a commit 7841ff6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

metacat-main/src/main/java/com/netflix/metacat/main/api/RequestWrapper.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ public <R> R processRequest(
154154
if (requestTags != null) {
155155
tags.putAll(requestTags);
156156
}
157-
158157
tags.put("request", resourceRequestName);
159158
tags.put("scheme", MetacatContextManager.getContext().getScheme());
160159
String clientAppName = MetacatContextManager.getContext().getClientAppName();
@@ -249,7 +248,11 @@ public <R> R processRequest(
249248
final long start = registry.clock().wallTime();
250249
final Map<String, String> tags = Maps.newHashMap();
251250
tags.put("request", resourceRequestName);
252-
tags.put("caller", MetacatContextManager.getContext().getClientAppName());
251+
String clientAppName = MetacatContextManager.getContext().getClientAppName();
252+
if (clientAppName == null) {
253+
clientAppName = "UNKNOWN";
254+
}
255+
tags.put("caller", clientAppName);
253256
registry.counter(requestCounterId.withTags(tags)).increment();
254257
try {
255258
MetacatContextManager.getContext().setRequestName(resourceRequestName);

0 commit comments

Comments
 (0)