Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
36e5dac
[WIP] delegate all tracing calls to `tracing-java`
qinfchen Sep 6, 2018
f321e2c
cleanup
qinfchen Sep 6, 2018
c78a24b
Use published versions of libraries
iamdanfox Sep 6, 2018
edfa0d6
Everything compiles
iamdanfox Sep 6, 2018
6a8471a
Convert#span actually works now
iamdanfox Sep 6, 2018
68d893a
Implement Convert#toRemotingTrace
iamdanfox Sep 6, 2018
420c0e8
All converters propagate nulls
iamdanfox Sep 6, 2018
6ec78ae
Tracer#subscribe returns a remoting span observer
iamdanfox Sep 6, 2018
d4dc7d6
Delete redundant fully-qualified names in TracersTest
iamdanfox Sep 6, 2018
332bbe1
Move longToPaddedHex function out of Tracers
iamdanfox Sep 6, 2018
9e6effd
Delete an asConjure method
iamdanfox Sep 6, 2018
1beda24
@Ignore one TracerTest
iamdanfox Sep 6, 2018
6a02d6f
Thanks checkstyle
iamdanfox Sep 6, 2018
f3724a3
Reduce visibility of Convert class
iamdanfox Sep 6, 2018
9c45298
Fix one Convert method
iamdanfox Sep 6, 2018
13fb17c
Remove mavenLocal()
iamdanfox Sep 6, 2018
0a5b297
Move Utilities to test source set
iamdanfox Sep 6, 2018
8a06a46
Better javadoc and warnings
iamdanfox Sep 6, 2018
bb252e2
Restore CloseableTracerTest
iamdanfox Sep 6, 2018
badb51c
Delete some unused fields and point to their new locations
iamdanfox Sep 6, 2018
b20a71e
rearrange method orders and remove broken javadoc links
qinfchen Sep 6, 2018
1bd0d56
remove Tracers.TRACE_ID_KEY and use java-tracing TRACE_ID_KEY
qinfchen Sep 6, 2018
0ac9f54
thanks checkstyle
qinfchen Sep 6, 2018
e9c0d1e
Revert "remove Tracers.TRACE_ID_KEY and use java-tracing TRACE_ID_KEY"
iamdanfox Sep 7, 2018
adf0f74
Don't make Trace public
iamdanfox Sep 7, 2018
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
Next Next commit
Restore CloseableTracerTest
  • Loading branch information
iamdanfox committed Sep 6, 2018
commit bb252e22decb6e43fe3b6ce5b6200f66595dfe1a
8 changes: 6 additions & 2 deletions tracing/src/main/java/com/palantir/tracing/ExposedTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
public final class ExposedTrace {
private ExposedTrace() {}

/** @deprecated this is purely for migration purposes, do not use this. */
/**
* @deprecated this is purely for migration purposes, do not use this.
*/
@Deprecated
public static boolean isObservable(Trace trace) {
return trace.isObservable();
}

/** @deprecated this is purely for migration purposes, do not use this. */
/**
* @deprecated this is purely for migration purposes, do not use this.
*/
@Deprecated
public static String getTraceId(Trace trace) {
return trace.getTraceId();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* (c) Copyright 2018 Palantir Technologies Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.palantir.remoting3.tracing;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import com.palantir.remoting.api.tracing.Span;
import com.palantir.remoting.api.tracing.SpanObserver;
import com.palantir.remoting.api.tracing.SpanType;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public final class CloseableTracerTest {

@Mock
SpanObserver spanObserver;

@Captor
ArgumentCaptor<Span> captor;

@Before
public void before() {
Tracer.getAndClearTrace();
Tracer.setSampler(AlwaysSampler.INSTANCE);
Tracer.subscribe("foo", spanObserver);
}

@Test
public void startsAndClosesSpan() {
try (CloseableTracer tracer = CloseableTracer.startSpan("foo")) {
// do some work
}

verify(spanObserver, times(1)).consume(captor.capture());
Span span = captor.getValue();
assertThat(span.getOperation()).isEqualTo("foo");
assertThat(span.type()).isEqualTo(SpanType.LOCAL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class TestConvert {
private TestConvert() {}

/** Warning - this is NOT a lossless copy, it loses the stack of OpenSpans in the original trace */
public static Trace toRemotingTraceIncompleteCopy(com.palantir.tracing.Trace newTrace) {
public static Trace toRemotingTraceIncomplete(com.palantir.tracing.Trace newTrace) {
if (newTrace == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void testInitTraceCallsSampler() throws Exception {

@Test
public void testTraceCopyIsIndependent() throws Exception {
Trace trace = ExposedTracer.copyTrace();
Trace trace = ExposedTracer.copyTraceIncomplete();
trace.push(mock(OpenSpan.class));
assertThat(Tracer.completeSpan().isPresent()).isFalse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public void run() {
}

private static List<OpenSpan> getCurrentFullTrace() {
Trace trace = ExposedTracer.copyTrace();
Trace trace = ExposedTracer.copyTraceIncomplete();
List<OpenSpan> spans = Lists.newArrayList();
while (!trace.isEmpty()) {
spans.add(trace.pop().get());
Expand Down
4 changes: 2 additions & 2 deletions tracing/src/test/java/com/palantir/tracing/ExposedTracer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
public final class ExposedTracer {
private ExposedTracer() {}

public static com.palantir.remoting3.tracing.Trace copyTrace() {
return TestConvert.toRemotingTraceIncompleteCopy(Tracer.copyTrace());
public static com.palantir.remoting3.tracing.Trace copyTraceIncomplete() {
return TestConvert.toRemotingTraceIncomplete(Tracer.copyTrace());
}

public static void setTrace(boolean isObservable, String traceId) {
Expand Down