Skip to content

Commit e7b4d27

Browse files
author
nsahai8
committed
improvising
1 parent e2e0199 commit e7b4d27

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

core/src/main/java/com/expedia/www/haystack/client/Tracer.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
import java.util.*;
4242

4343
public class Tracer implements io.opentracing.Tracer {
44+
45+
private final static IdGenerator DEFAULT_ID_GENERATOR = new LongIdGenerator();
46+
private final static Boolean DEFAULT_DUAL_SPAN_MODE = false;
47+
4448
private final Dispatcher dispatcher;
4549
private final IdGenerator idGenerator;
4650
protected final Clock clock;
@@ -66,12 +70,12 @@ public class Tracer implements io.opentracing.Tracer {
6670
private final Counter extractFailureCounter;
6771

6872
public Tracer(String serviceName, ScopeManager scopeManager, Clock clock,
69-
IdGenerator idGenerator, Dispatcher dispatcher, PropagationRegistry registry, Metrics metrics) {
70-
this(serviceName, scopeManager, clock, idGenerator, dispatcher, registry, metrics, false);
73+
Dispatcher dispatcher, PropagationRegistry registry, Metrics metrics) {
74+
this(serviceName, scopeManager, clock, dispatcher, registry, metrics, DEFAULT_DUAL_SPAN_MODE, DEFAULT_ID_GENERATOR);
7175
}
7276
public Tracer(String serviceName, ScopeManager scopeManager, Clock clock,
73-
IdGenerator idGenerator, Dispatcher dispatcher, PropagationRegistry registry,
74-
Metrics metrics, boolean dualSpanMode) {
77+
Dispatcher dispatcher, PropagationRegistry registry,
78+
Metrics metrics, boolean dualSpanMode, IdGenerator idGenerator) {
7579
this.serviceName = serviceName;
7680
this.scopeManager = scopeManager;
7781
this.clock = clock;
@@ -438,8 +442,8 @@ public Builder withDualSpanMode() {
438442
}
439443

440444
public Tracer build() {
441-
idGenerator = idGenerator == null ? new LongIdGenerator() : idGenerator;
442-
return new Tracer(serviceName, scopeManager, clock, idGenerator, dispatcher, registry, metrics, dualSpanMode);
445+
idGenerator = idGenerator == null ? DEFAULT_ID_GENERATOR : idGenerator;
446+
return new Tracer(serviceName, scopeManager, clock, dispatcher, registry, metrics, dualSpanMode, idGenerator);
443447
}
444448
}
445449
}

core/src/main/java/com/expedia/www/haystack/client/idgenerators/IdGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Expedia, Inc.
2+
* Copyright 2019 Expedia, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/src/main/java/com/expedia/www/haystack/client/idgenerators/LongIdGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Expedia, Inc.
2+
* Copyright 2019 Expedia, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/src/main/java/com/expedia/www/haystack/client/idgenerators/RandomUUIDGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Expedia, Inc.
2+
* Copyright 2019 Expedia, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/src/main/java/com/expedia/www/haystack/client/idgenerators/TimeBasedUUIDGenerator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 Expedia, Inc.
2+
* Copyright 2019 Expedia, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,11 +19,13 @@
1919

2020
import com.fasterxml.uuid.Generators;
2121

22+
import java.util.UUID;
23+
2224

2325
public class TimeBasedUUIDGenerator implements IdGenerator {
2426

2527
@Override
26-
public Object generate() {
28+
public UUID generate() {
2729
return Generators.timeBasedGenerator().generate();
2830
}
2931
}

0 commit comments

Comments
 (0)