Move SpanData to main API and add Resource. (#138)

This commit is contained in:
Bogdan Drutu 2019-04-18 12:21:04 -07:00 committed by GitHub
parent 6443bc96cf
commit 93f43fb940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 10 deletions

View File

@ -23,7 +23,6 @@ import javax.annotation.Nullable;
import openconsensus.context.NoopScope; import openconsensus.context.NoopScope;
import openconsensus.context.Scope; import openconsensus.context.Scope;
import openconsensus.internal.Utils; import openconsensus.internal.Utils;
import openconsensus.trace.data.SpanData;
import openconsensus.trace.propagation.BinaryFormat; import openconsensus.trace.propagation.BinaryFormat;
import openconsensus.trace.propagation.TextFormat; import openconsensus.trace.propagation.TextFormat;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package openconsensus.trace.data; package openconsensus.trace;
import com.google.auto.value.AutoValue; import com.google.auto.value.AutoValue;
import java.util.ArrayList; import java.util.ArrayList;
@ -26,14 +26,8 @@ import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
import openconsensus.common.Timestamp; import openconsensus.common.Timestamp;
import openconsensus.internal.Utils; import openconsensus.internal.Utils;
import openconsensus.trace.AttributeValue; import openconsensus.resource.Resource;
import openconsensus.trace.Event;
import openconsensus.trace.Link;
import openconsensus.trace.Span;
import openconsensus.trace.Span.Kind; import openconsensus.trace.Span.Kind;
import openconsensus.trace.SpanContext;
import openconsensus.trace.SpanId;
import openconsensus.trace.Status;
/** /**
* Immutable representation of all data collected by the {@link Span} class. * Immutable representation of all data collected by the {@link Span} class.
@ -65,6 +59,7 @@ public abstract class SpanData {
public static SpanData create( public static SpanData create(
SpanContext context, SpanContext context,
@Nullable SpanId parentSpanId, @Nullable SpanId parentSpanId,
Resource resource,
String name, String name,
Kind kind, Kind kind,
Timestamp startTimestamp, Timestamp startTimestamp,
@ -77,6 +72,7 @@ public abstract class SpanData {
return new AutoValue_SpanData( return new AutoValue_SpanData(
context, context,
parentSpanId, parentSpanId,
resource,
name, name,
kind, kind,
startTimestamp, startTimestamp,
@ -106,6 +102,14 @@ public abstract class SpanData {
@Nullable @Nullable
public abstract SpanId getParentSpanId(); public abstract SpanId getParentSpanId();
/**
* Returns the resource of this {@code Span}.
*
* @return the resource of this {@code Span}.
* @since 0.1.0
*/
public abstract Resource getResource();
/** /**
* Returns the name of this {@code Span}. * Returns the name of this {@code Span}.
* *

View File

@ -20,7 +20,6 @@ import com.google.errorprone.annotations.MustBeClosed;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import openconsensus.context.Scope; import openconsensus.context.Scope;
import openconsensus.trace.data.SpanData;
import openconsensus.trace.propagation.BinaryFormat; import openconsensus.trace.propagation.BinaryFormat;
import openconsensus.trace.propagation.TextFormat; import openconsensus.trace.propagation.TextFormat;