Expose isSampled on TraceContext; fixes gh-1799
This commit is contained in:
@@ -45,4 +45,9 @@ public interface TraceContext {
|
||||
*/
|
||||
String spanId();
|
||||
|
||||
/**
|
||||
* @return {@code true} when sampled
|
||||
*/
|
||||
boolean isSampled();
|
||||
|
||||
}
|
||||
|
||||
@@ -41,4 +41,9 @@ class NoOpTraceContext implements TraceContext {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSampled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ class BraveTraceContext implements TraceContext {
|
||||
return this.traceContext.spanIdString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSampled() {
|
||||
return this.traceContext.sampled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.traceContext != null ? this.traceContext.toString() : "null";
|
||||
|
||||
@@ -99,6 +99,11 @@ class OtelTraceContext implements TraceContext {
|
||||
return this.delegate.getSpanIdAsHexString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSampled() {
|
||||
return this.delegate.isSampled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.delegate != null ? this.delegate.toString() : "null";
|
||||
|
||||
Reference in New Issue
Block a user