本文整理了Java中zipkin2.Annotation
类的一些代码示例,展示了Annotation
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation
类的具体详情如下:
包路径:zipkin2.Annotation
类名称:Annotation
[英]Associates an event that explains latency with a timestamp.
Unlike log statements, annotations are often codes: Ex. cache.miss.
[中]将解释延迟的事件与时间戳关联。
与日志语句不同,注释通常是代码:例如cache。未击中
代码示例来源:origin: line/armeria
.filter(a -> a.value().equals("ws"))
.findFirst().get().timestamp();
final long clientWireReceiveTime = clientFooSpan.annotations().stream()
.filter(a -> a.value().equals("wr"))
.findFirst().get().timestamp();
final long clientEndTime = clientStartTime + clientFooSpan.durationAsLong();
.filter(a -> a.value().equals("ws"))
.findFirst().get().timestamp();
final long serverWireReceiveTime = serviceFooSpan.annotations().stream()
.filter(a -> a.value().equals("wr"))
.findFirst().get().timestamp();
final long serverEndTime = serverStartTime + serviceFooSpan.durationAsLong();
代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra
Annotation toAnnotation() {
return Annotation.create(ts, v);
}
}
代码示例来源:origin: apache/cxf
@Override
protected boolean matchesSafely(Annotation item) {
return value.equals(item.value());
}
});
代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra
static long guessTimestamp(Span span) {
assert 0L == span.timestampAsLong() : "method only for when span has no timestamp";
for (Annotation annotation : span.annotations()) {
if (0L < annotation.timestamp()) {
return annotation.timestamp();
}
}
return 0L; // return a timestamp that won't match a query
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
public static Annotation create(long timestamp, String value) {
if (value == null) throw new NullPointerException("value == null");
return new Annotation(timestamp, value);
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra
/**
* Returns a set of annotation getValues and tags joined on equals, delimited by ░
*
* @see QueryRequest#annotationQuery()
*/
static @Nullable String annotationQuery(Span span) {
if (span.annotations().isEmpty() && span.tags().isEmpty()) return null;
char delimiter = '░'; // as very unlikely to be in the query
StringBuilder result = new StringBuilder().append(delimiter);
for (Annotation a : span.annotations()) {
if (a.value().length() > LONGEST_VALUE_TO_INDEX) continue;
result.append(a.value()).append(delimiter);
}
for (Map.Entry<String, String> tag : span.tags().entrySet()) {
if (tag.getValue().length() > LONGEST_VALUE_TO_INDEX) continue;
result.append(tag.getKey()).append(delimiter); // search is possible by key alone
result.append(tag.getKey() + "=" + tag.getValue()).append(delimiter);
}
return result.length() == 1 ? null : result.toString();
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra-v1
private static long guessTimestamp(Span span) {
assert 0L == span.timestampAsLong() : "method only for when span has no timestamp";
for (Annotation annotation : span.annotations()) {
if (0L < annotation.timestamp()) return annotation.timestamp();
}
return 0L; // return a timestamp that won't match a query
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra
AnnotationUDT(Annotation annotation) {
this.ts = annotation.timestamp();
this.v = annotation.value();
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
if ("".equals(annotationQueryRemaining.get(a.value()))) {
annotationQueryRemaining.remove(a.value());
代码示例来源:origin: io.zipkin.zipkin2/zipkin
Object readResolve() throws ObjectStreamException {
try {
return Annotation.create(timestamp, value);
} catch (IllegalArgumentException e) {
throw new StreamCorruptedException(e.getMessage());
}
}
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
/** Compares by {@link #timestamp}, then {@link #value}. */
@Override public int compareTo(Annotation that) {
if (this == that) return 0;
int byTimestamp = timestamp() < that.timestamp() ? -1 : timestamp() == that.timestamp() ? 0 : 1;
if (byTimestamp != 0) return byTimestamp;
return value().compareTo(that.value());
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
/** @see Span#annotations */
public Builder addAnnotation(long timestamp, String value) {
if (annotations == null) annotations = new ArrayList<>(2);
annotations.add(Annotation.create(timestamp, value));
return this;
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
@Override public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof Annotation)) return false;
Annotation that = (Annotation) o;
return timestamp == that.timestamp() && value.equals(that.value());
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
@Override void writeValue(Buffer b, Annotation value) {
TIMESTAMP.write(b, value.timestamp());
VALUE.write(b, value.value());
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
@Override int sizeOfValue(Annotation value) {
return TIMESTAMP.sizeInBytes(value.timestamp()) + VALUE.sizeInBytes(value.value());
}
代码示例来源:origin: netifi-proteus/proteus-java
private zipkin2.proto3.Annotation.Builder mapAnnotation(Annotation annotation) {
return zipkin2.proto3.Annotation.newBuilder()
.setTimestamp(annotation.timestamp())
.setValue(annotation.value());
}
代码示例来源:origin: io.netifi.proteus/proteus-tracing-openzipkin
private zipkin2.proto3.Annotation.Builder mapAnnotation(Annotation annotation) {
return zipkin2.proto3.Annotation.newBuilder()
.setTimestamp(annotation.timestamp())
.setValue(annotation.value());
}
代码示例来源:origin: io.netifi.proteus/tracing-openzipkin
private zipkin2.proto3.Annotation.Builder mapAnnotation(Annotation annotation) {
return zipkin2.proto3.Annotation.newBuilder()
.setTimestamp(annotation.timestamp())
.setValue(annotation.value());
}
代码示例来源:origin: io.zipkin.zipkin2/zipkin
String value = a.value();
if (value.length() != 2) continue;
if (a.timestamp() < startTs) startTs = a.timestamp();
} else if (value.equals("sr")) {
kind = Span.Kind.SERVER;
if (a.timestamp() < startTs) startTs = a.timestamp();
} else if (value.equals("ss")) {
kind = Span.Kind.SERVER;
if (a.timestamp() > endTs) endTs = a.timestamp();
} else if (value.equals("cr")) {
kind = Span.Kind.CLIENT;
if (a.timestamp() > endTs) endTs = a.timestamp();
} else if (value.equals("ms")) {
kind = Span.Kind.PRODUCER;
msTs = a.timestamp();
} else if (value.equals("mr")) {
kind = Span.Kind.CONSUMER;
mrTs = a.timestamp();
} else if (value.equals("ws")) {
wsTs = a.timestamp();
} else if (value.equals("wr")) {
wrTs = a.timestamp();
代码示例来源:origin: Nike-Inc/wingtips
private List<TimestampedAnnotation> toWingtipsAnnotations(List<Annotation> zipkinAnnotations) {
return zipkinAnnotations
.stream()
.map(za -> TimestampedAnnotation.forEpochMicros(za.timestamp(), za.value()))
.collect(Collectors.toList());
}
内容来源于网络,如有侵权,请联系作者删除!