Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix some method references
  • Loading branch information
iamdanfox committed Aug 23, 2019
commit 4d0e96a0ec7ea644a313c0cd29f52705193107c4
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@ buildscript {
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.11.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.11.2'
classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.7"

// just until baseline upgrades
classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.24.2'
}
}

apply plugin: 'com.palantir.git-version'
apply plugin: 'com.palantir.baseline'
apply plugin: 'com.palantir.consistent-versions'

repositories {
jcenter()
maven { url "http://palantir.bintray.com/releases" }
}

allprojects {
version gitVersion()
group 'com.palantir.tracing'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void testIsSerializable() throws IOException, ClassNotFoundException {
try (ObjectInputStream objectInputStream = new ObjectInputStream(bais)) {
DeferredTracer deserialized = (DeferredTracer) objectInputStream.readObject();

String trace = deserialized.withTrace(() -> Tracer.getTraceId());
String trace = deserialized.withTrace(Tracer::getTraceId);
assertThat(trace).isEqualTo("defaultTraceId");
}
}
Expand Down
16 changes: 4 additions & 12 deletions tracing/src/test/java/com/palantir/tracing/TracersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ public void testWrapRunnable_startsNewSpan() throws Exception {
public void testWrapCallableWithNewTrace_traceStateInsideCallableIsIsolated() throws Exception {
String traceIdBeforeConstruction = Tracer.getTraceId();

Callable<String> wrappedCallable = Tracers.wrapWithNewTrace(() -> {
return Tracer.getTraceId();
});
Callable<String> wrappedCallable = Tracers.wrapWithNewTrace(Tracer::getTraceId);

String traceIdFirstCall = wrappedCallable.call();
String traceIdSecondCall = wrappedCallable.call();
Expand All @@ -282,9 +280,7 @@ public void testWrapCallableWithNewTrace_traceStateInsideCallableIsIsolated() th

@Test
public void testWrapCallableWithNewTrace_traceStateInsideCallableHasSpan() throws Exception {
Callable<List<OpenSpan>> wrappedCallable = Tracers.wrapWithNewTrace(() -> {
return getCurrentTrace();
});
Callable<List<OpenSpan>> wrappedCallable = Tracers.wrapWithNewTrace(TracersTest::getCurrentTrace);

List<OpenSpan> spans = wrappedCallable.call();

Expand All @@ -298,9 +294,7 @@ public void testWrapCallableWithNewTrace_traceStateInsideCallableHasSpan() throw

@Test
public void testWrapCallableWithNewTrace_traceStateInsideCallableHasGivenSpan() throws Exception {
Callable<List<OpenSpan>> wrappedCallable = Tracers.wrapWithNewTrace("operation", () -> {
return getCurrentTrace();
});
Callable<List<OpenSpan>> wrappedCallable = Tracers.wrapWithNewTrace("operation", TracersTest::getCurrentTrace);

List<OpenSpan> spans = wrappedCallable.call();

Expand Down Expand Up @@ -335,9 +329,7 @@ public void testWrapCallableWithNewTrace_traceStateRestoredToCleared() throws Ex

@Test
public void testWrapCallableWithNewTrace_canSpecifyObservability() throws Exception {
Callable<Boolean> rawCallable = () -> {
return Tracer.copyTrace().get().isObservable();
};
Callable<Boolean> rawCallable = () -> Tracer.copyTrace().get().isObservable();

Callable<Boolean> sampledCallable = Tracers.wrapWithNewTrace("someTraceId", Observability.SAMPLE, rawCallable);
Callable<Boolean> unSampledCallable = Tracers.wrapWithNewTrace("someTraceId", Observability.DO_NOT_SAMPLE,
Expand Down