本文整理了Java中io.opencensus.trace.Status.isOk()
方法的一些代码示例,展示了Status.isOk()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.isOk()
方法的具体详情如下:
包路径:io.opencensus.trace.Status
类名称:Status
方法名:isOk
[英]Returns true if this Status is OK, i.e., not an error.
[中]如果此状态正常,即不是错误,则返回true。
代码示例来源:origin: census-instrumentation/opencensus-java
sb.append("\"name\":\"").append(toSpanName(span)).append("\",");
sb.append("\"type\":\"").append(toSpanType(span)).append('"');
if (!status.isOk()) {
sb.append(",\"error\":").append("true");
代码示例来源:origin: census-instrumentation/opencensus-java
@Test
public void status_Ok() {
assertThat(Status.OK.getCanonicalCode()).isEqualTo(Status.CanonicalCode.OK);
assertThat(Status.OK.getDescription()).isNull();
assertThat(Status.OK.isOk()).isTrue();
}
代码示例来源:origin: census-instrumentation/opencensus-java
private void considerForSampling(RecordEventsSpanImpl span) {
Status status = span.getStatus();
// Null status means running Span, this should not happen in production, but the library
// should not crash because of this.
if (status != null) {
Bucket bucket =
status.isOk()
? getLatencyBucket(span.getLatencyNs())
: getErrorBucket(status.getCanonicalCode());
// If unable to find the bucket, ignore this Span.
if (bucket != null) {
bucket.considerForSampling(span);
}
}
}
代码示例来源:origin: io.opencensus/opencensus-impl-core
private void considerForSampling(RecordEventsSpanImpl span) {
Status status = span.getStatus();
// Null status means running Span, this should not happen in production, but the library
// should not crash because of this.
if (status != null) {
Bucket bucket =
status.isOk()
? getLatencyBucket(span.getLatencyNs())
: getErrorBucket(status.getCanonicalCode());
// If unable to find the bucket, ignore this Span.
if (bucket != null) {
bucket.considerForSampling(span);
}
}
}
代码示例来源:origin: census-instrumentation/opencensus-java
@Test
public void createStatus_WithDescription() {
Status status = Status.UNKNOWN.withDescription("This is an error.");
assertThat(status.getCanonicalCode()).isEqualTo(Status.CanonicalCode.UNKNOWN);
assertThat(status.getDescription()).isEqualTo("This is an error.");
assertThat(status.isOk()).isFalse();
}
内容来源于网络,如有侵权,请联系作者删除!