From 9670762a82a3c63bdfe6cd4feb86025ad640a56e Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Wed, 27 May 2015 18:04:40 +0900 Subject: [PATCH] HADOOP-11242. Record the time of calling in tracing span of IPC server. Contributed by Mastake Iwasaki. (cherry picked from commit bb1816328a36ec3f8c6bd9fdb950d9a4ec8388c8) --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/ipc/Server.java | 1 + .../test/java/org/apache/hadoop/tracing/TestTracing.java | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 0091f565786..b6c845957f7 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -146,6 +146,9 @@ Release 2.8.0 - UNRELEASED HADOOP-11772. RPC Invoker relies on static ClientCache which has synchronized(this) blocks. (wheat9) + HADOOP-11242. Record the time of calling in tracing span of + IPC server. (Masatake Iwasaki via aajisaka) + BUG FIXES HADOOP-11802: DomainSocketWatcher thread terminates sometimes after there is an I/O error during requestShortCircuitShm (cmccabe) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java index fa25cac81fe..72703343f4a 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java @@ -2067,6 +2067,7 @@ public abstract class Server { CurCall.set(call); if (call.traceSpan != null) { traceScope = Trace.continueSpan(call.traceSpan); + traceScope.getSpan().addTimelineAnnotation("called"); } try { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java index 59d12386d63..7fb8ac5cbaa 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java @@ -120,6 +120,13 @@ public class TestTracing { Assert.assertEquals(ts.getSpan().getTraceId(), span.getTraceId()); } } + + // test for timeline annotation added by HADOOP-11242 + Assert.assertEquals("called", + map.get("org.apache.hadoop.hdfs.protocol.ClientProtocol.create") + .get(0).getTimelineAnnotations() + .get(0).getMessage()); + SetSpanReceiver.SetHolder.spans.clear(); }