Review fixes
This commit is contained in:
parent
a59eec223f
commit
8f3568c894
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|||
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
@ -215,7 +214,6 @@ class SpanImpl implements Span {
|
|||
}
|
||||
|
||||
@Override
|
||||
@JsonIgnore
|
||||
public synchronized Map<String, Object> getMeta() {
|
||||
return Collections.unmodifiableMap(meta);
|
||||
}
|
||||
|
|
|
@ -148,6 +148,8 @@ public class Tracer implements Closeable {
|
|||
|
||||
@Override
|
||||
public void close() {
|
||||
// FIXME: Handle the possibility of close being called more than once or not at all.
|
||||
// FIXME: Depends on order of execution between finalize, GC, and the shutdown hook.
|
||||
writer.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,26 @@ class TracerTest extends Specification {
|
|||
0 * _ // don't allow any other interaction
|
||||
}
|
||||
|
||||
def "finalize closes writer"() {
|
||||
setup:
|
||||
def writer = Mock(Writer)
|
||||
def tracer = Tracer.builder().writer(writer).build()
|
||||
|
||||
when:
|
||||
tracer.finalize()
|
||||
|
||||
then: "closed writer"
|
||||
1 * writer.close()
|
||||
0 * _ // don't allow any other interaction
|
||||
|
||||
when:
|
||||
tracer.finalize()
|
||||
|
||||
then: "thrown error swallowed"
|
||||
1 * writer.close() >> { throw new Exception("test error") }
|
||||
0 * _ // don't allow any other interaction
|
||||
}
|
||||
|
||||
def "test create current timestamp"() {
|
||||
setup:
|
||||
def tracer = Tracer.builder().config(config).build()
|
||||
|
|
Loading…
Reference in New Issue