Skip to content

Commit ffa9b99

Browse files
ajfabbriGitHub Enterprise
authored andcommitted
Merge pull request cloudera#4 from weichiu/hac-271
Hac 271
2 parents 752fa24 + 99baf29 commit ffa9b99

File tree

31 files changed

+271
-229
lines changed

31 files changed

+271
-229
lines changed

hadoop-common-project/hadoop-common/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@
274274
<groupId>com.squareup.okhttp3</groupId>
275275
<artifactId>okhttp</artifactId>
276276
</exclusion>
277-
278277
</exclusions>
279278
</dependency>
280279

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSOutputSummer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ protected DataChecksum getDataChecksum() {
199199
return sum;
200200
}
201201

202-
protected TraceScope createWriteTraceScope() {
202+
protected io.opentracing.Scope createWriteTraceScope() {
203203
return null;
204204
}
205205

@@ -209,7 +209,7 @@ protected TraceScope createWriteTraceScope() {
209209
private void writeChecksumChunks(byte b[], int off, int len)
210210
throws IOException {
211211
sum.calculateChunkedSums(b, off, len, checksum, 0);
212-
TraceScope scope = createWriteTraceScope();
212+
io.opentracing.Scope scope = createWriteTraceScope();
213213
try {
214214
for (int i = 0; i < len; i += sum.getBytesPerChecksum()) {
215215
int chunkLen = Math.min(sum.getBytesPerChecksum(), len - i);
@@ -219,7 +219,7 @@ private void writeChecksumChunks(byte b[], int off, int len)
219219
}
220220
} finally {
221221
if (scope != null) {
222-
scope.close();
222+
//scope.close();
223223
}
224224
}
225225
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public boolean accept(final Path file) {
223223
private final Configuration conf;
224224
private final UserGroupInformation ugi;
225225
final boolean resolveSymlinks;
226-
private final Tracer tracer;
226+
private final io.opentracing.Tracer tracer;
227227

228228
private FileContext(final AbstractFileSystem defFs,
229229
final Configuration aConf) {
@@ -2780,7 +2780,7 @@ public Collection<? extends BlockStoragePolicySpi> getAllStoragePolicies()
27802780
return defaultFS.getAllStoragePolicies();
27812781
}
27822782

2783-
Tracer getTracer() {
2783+
io.opentracing.Tracer getTracer() {
27842784
return tracer;
27852785
}
27862786
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3280,9 +3280,11 @@ public static Class<? extends FileSystem> getFileSystemClass(String scheme,
32803280
*/
32813281
private static FileSystem createFileSystem(URI uri, Configuration conf)
32823282
throws IOException {
3283-
Tracer tracer = FsTracer.get(conf);
3284-
try(TraceScope scope = tracer.newScope("FileSystem#createFileSystem")) {
3285-
scope.addKVAnnotation("scheme", uri.getScheme());
3283+
io.opentracing.Tracer tracer = FsTracer.get(conf);
3284+
// try(TraceScope scope = tracer.newScope("FileSystem#createFileSystem")) {
3285+
try(io.opentracing.Scope scope =
3286+
tracer.buildSpan("FileSystem#createFileSystem").startActive(true)) {
3287+
// scope.addKVAnnotation("scheme", uri.getScheme());
32863288
Class<?> clazz = getFileSystemClass(uri.getScheme(), conf);
32873289
FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
32883290
fs.initialize(uri, conf);

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShell.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,17 @@ public int run(String argv[]) throws Exception {
307307
conf(TraceUtils.wrapHadoopConf(SHELL_HTRACE_PREFIX, getConf())).
308308
build();*/
309309

310-
io.opentracing.Tracer tracer =
310+
/*io.opentracing.Tracer tracer =
311311
new com.uber.jaeger.Configuration(
312312
"FsShell",
313313
new com.uber.jaeger.Configuration.SamplerConfiguration("const", 1),
314314
new com.uber.jaeger.Configuration.ReporterConfiguration(
315315
false, "va1022.halxg.cloudera.com", 6831, 1000, 10000)
316316
).getTracer();
317-
GlobalTracer.register(tracer);
317+
if (!GlobalTracer.isRegistered()) {
318+
GlobalTracer.register(tracer);
319+
}*/
320+
io.opentracing.Tracer tracer = FsTracer.get(getConf());
318321

319322
int exitCode = -1;
320323
if (argv.length < 1) {

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsTracer.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,24 @@
3535
@InterfaceAudience.Private
3636
@InterfaceStability.Unstable
3737
public final class FsTracer {
38-
private static Tracer instance;
38+
private static io.opentracing.Tracer instance;
3939

40-
public static synchronized Tracer get(Configuration conf) {
40+
public static synchronized io.opentracing.Tracer get(Configuration conf) {
4141
if (instance == null) {
42-
instance = new Tracer.Builder("FSClient").
43-
conf(TraceUtils.wrapHadoopConf(CommonConfigurationKeys.
44-
FS_CLIENT_HTRACE_PREFIX, conf)).
45-
build();
42+
// instance = new Tracer.Builder("FSClient").
43+
// conf(TraceUtils.wrapHadoopConf(CommonConfigurationKeys.
44+
// FS_CLIENT_HTRACE_PREFIX, conf)).
45+
// build();
46+
47+
io.opentracing.Tracer tempInstance =
48+
new com.uber.jaeger.Configuration(
49+
"FSClient",
50+
new com.uber.jaeger.Configuration.SamplerConfiguration("const", 1),
51+
new com.uber.jaeger.Configuration.ReporterConfiguration(
52+
false, "va1022.halxg.cloudera.com", 6831, 1000, 10000)
53+
).getTracer();
54+
instance = tempInstance;
55+
return instance;
4656
}
4757
return instance;
4858
}
@@ -53,7 +63,7 @@ public static synchronized void clear() {
5363
return;
5464
}
5565
try {
56-
instance.close();
66+
// instance.close();
5767
} finally {
5868
instance = null;
5969
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Globber {
4141
private final FileContext fc;
4242
private final Path pathPattern;
4343
private final PathFilter filter;
44-
private final Tracer tracer;
44+
private final io.opentracing.Tracer tracer;
4545

4646
public Globber(FileSystem fs, Path pathPattern, PathFilter filter) {
4747
this.fs = fs;
@@ -143,12 +143,13 @@ private String authorityFromPath(Path path) throws IOException {
143143
}
144144

145145
public FileStatus[] glob() throws IOException {
146-
TraceScope scope = tracer.newScope("Globber#glob");
147-
scope.addKVAnnotation("pattern", pathPattern.toUri().getPath());
148-
try {
146+
// TraceScope scope = tracer.newScope("Globber#glob");
147+
// scope.addKVAnnotation("pattern", pathPattern.toUri().getPath());
148+
try (io.opentracing.Scope scope =
149+
tracer.buildSpan("Globber#glob").startActive(true)){
149150
return doGlob();
150151
} finally {
151-
scope.close();
152+
// scope.close();
152153
}
153154
}
154155

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -778,9 +778,11 @@ private synchronized void setupIOstreams(
778778
if (LOG.isDebugEnabled()) {
779779
LOG.debug("Connecting to "+server);
780780
}
781-
Span span = Tracer.getCurrentSpan();
781+
//Span span = Tracer.getCurrentSpan();
782+
io.opentracing.Span span = io.opentracing.util.GlobalTracer.get().activeSpan();
782783
if (span != null) {
783-
span.addTimelineAnnotation("IPC client connecting to " + server);
784+
//span.addTimelineAnnotation("IPC client connecting to " + server);
785+
span.log("IPC client connecting to " + server);
784786
}
785787
short numRetries = 0;
786788
Random rand = null;
@@ -843,9 +845,11 @@ public AuthMethod run()
843845
// update last activity time
844846
touch();
845847

846-
span = Tracer.getCurrentSpan();
848+
//span = Tracer.getCurrentSpan();
849+
span = io.opentracing.util.GlobalTracer.get().activeSpan();
847850
if (span != null) {
848-
span.addTimelineAnnotation("IPC client connected to " + server);
851+
//span.addTimelineAnnotation("IPC client connected to " + server);
852+
span.log("IPC client connected to " + server);
849853
}
850854

851855
// start the receiver thread after the socket connection has been set

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.Set;
3434
import java.util.concurrent.atomic.AtomicInteger;
3535

36+
import io.opentracing.Tracer;
3637
import org.junit.After;
3738
import org.junit.Before;
3839
import org.junit.Test;

0 commit comments

Comments
 (0)