zipkin2.Span.durationAsLong()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(203)

本文整理了Java中zipkin2.Span.durationAsLong()方法的一些代码示例,展示了Span.durationAsLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Span.durationAsLong()方法的具体详情如下:
包路径:zipkin2.Span
类名称:Span
方法名:durationAsLong

Span.durationAsLong介绍

[英]Like #duration() except returns a primitive where zero implies absent.

Using this method will avoid allocation, so is encouraged when copying data.
[中]

代码示例

代码示例来源:origin: line/armeria

.filter(a -> a.value().equals("wr"))
                        .findFirst().get().timestamp();
final long clientEndTime = clientStartTime + clientFooSpan.durationAsLong();
                         .filter(a -> a.value().equals("wr"))
                         .findFirst().get().timestamp();
final long serverEndTime = serverStartTime + serviceFooSpan.durationAsLong();

代码示例来源:origin: io.smartup.zipkin/zipkin-datadog-reporter-core

@JsonGetter("duration")
public long getDurationNano() {
  long duration = TimeUnit.MICROSECONDS.toNanos(delegateSpan.durationAsLong());
  return duration == 0 ? 1 : duration;
}

代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra

long duration = s.durationAsLong() / 1000L;
traceByServiceSpans.add(
 insertTraceByServiceSpan.newInput(service, span, bucket, ts_uuid, s.traceId(), duration));

代码示例来源:origin: io.zipkin.zipkin2/zipkin

testedDuration = span.durationAsLong() >= minDuration() && span.durationAsLong() <= maxDuration();
} else if (minDuration() != null) {
 testedDuration = span.durationAsLong() >= minDuration();

代码示例来源:origin: io.zipkin.zipkin2/zipkin

endTs = startTs != 0L && in.durationAsLong() != 0L ? startTs + in.durationAsLong() : 0L;

代码示例来源:origin: io.zipkin.zipkin2/zipkin-storage-cassandra

Input newInput(zipkin2.Span span, UUID ts_uuid) {
 boolean traceIdHigh = !strictTraceId && span.traceId().length() == 32;
 List<AnnotationUDT> annotations;
 if (!span.annotations().isEmpty()) {
  annotations =
    span.annotations().stream().map(AnnotationUDT::new).collect(Collectors.toList());
 } else {
  annotations = Collections.emptyList();
 }
 String annotation_query = searchEnabled ? CassandraUtil.annotationQuery(span) : null;
 return new AutoValue_InsertSpan_Input(
   ts_uuid,
   traceIdHigh ? span.traceId().substring(0, 16) : null,
   traceIdHigh ? span.traceId().substring(16) : span.traceId(),
   span.parentId(),
   span.id(),
   span.kind() != null ? span.kind().name() : null,
   span.name(),
   span.timestampAsLong(),
   span.durationAsLong(),
   span.localEndpoint() != null ? new EndpointUDT(span.localEndpoint()) : null,
   span.remoteEndpoint() != null ? new EndpointUDT(span.remoteEndpoint()) : null,
   annotations,
   span.tags(),
   annotation_query,
   Boolean.TRUE.equals(span.debug()),
   Boolean.TRUE.equals(span.shared()));
}

代码示例来源:origin: io.zipkin.zipkin2/zipkin

sizeInBytes += asciiSizeInBytes(value.timestampAsLong());
if (value.durationAsLong() != 0L) {
 sizeInBytes += 12; // ,"duration":
 sizeInBytes += asciiSizeInBytes(value.durationAsLong());

代码示例来源:origin: com.wavefront/proxy

setTraceId(traceId).
setStartMillis(zipkinSpan.timestampAsLong() / 1000).
setDuration(zipkinSpan.durationAsLong() / 1000).
setAnnotations(annotations).
build();
 spanName, applicationName,
 serviceName, cluster, shard, sourceName, isError,
 zipkinSpan.durationAsLong()), true);

代码示例来源:origin: io.zipkin.zipkin2/zipkin

@Override int sizeOfValue(Span span) {
 int sizeOfSpan = TRACE_ID.sizeInBytes(span.traceId());
 sizeOfSpan += PARENT_ID.sizeInBytes(span.parentId());
 sizeOfSpan += ID.sizeInBytes(span.id());
 sizeOfSpan += KIND.sizeInBytes(span.kind() != null ? 1 : 0);
 sizeOfSpan += NAME.sizeInBytes(span.name());
 sizeOfSpan += TIMESTAMP.sizeInBytes(span.timestampAsLong());
 sizeOfSpan += DURATION.sizeInBytes(span.durationAsLong());
 sizeOfSpan += LOCAL_ENDPOINT.sizeInBytes(span.localEndpoint());
 sizeOfSpan += REMOTE_ENDPOINT.sizeInBytes(span.remoteEndpoint());
 List<Annotation> annotations = span.annotations();
 int annotationCount = annotations.size();
 for (int i = 0; i < annotationCount; i++) {
  sizeOfSpan += ANNOTATION.sizeInBytes(annotations.get(i));
 }
 Map<String, String> tags = span.tags();
 int tagCount = tags.size();
 if (tagCount > 0) { // avoid allocating an iterator when empty
  for (Map.Entry<String, String> entry : tags.entrySet()) {
   sizeOfSpan += TAG.sizeInBytes(entry);
  }
 }
 sizeOfSpan += DEBUG.sizeInBytes(Boolean.TRUE.equals(span.debug()));
 sizeOfSpan += SHARED.sizeInBytes(Boolean.TRUE.equals(span.shared()));
 return sizeOfSpan;
}

代码示例来源:origin: io.zipkin.zipkin2/zipkin

@Override void writeValue(Buffer b, Span value) {
 TRACE_ID.write(b, value.traceId());
 PARENT_ID.write(b, value.parentId());
 ID.write(b, value.id());
 KIND.write(b, toByte(value.kind()));
 NAME.write(b, value.name());
 TIMESTAMP.write(b, value.timestampAsLong());
 DURATION.write(b, value.durationAsLong());
 LOCAL_ENDPOINT.write(b, value.localEndpoint());
 REMOTE_ENDPOINT.write(b, value.remoteEndpoint());
 List<Annotation> annotations = value.annotations();
 int annotationLength = annotations.size();
 for (int i = 0; i < annotationLength; i++) {
  ANNOTATION.write(b, annotations.get(i));
 }
 Map<String, String> tags = value.tags();
 if (!tags.isEmpty()) { // avoid allocating an iterator when empty
  for (Map.Entry<String, String> entry : tags.entrySet()) {
   TAG.write(b, entry);
  }
 }
 SpanField.DEBUG.write(b, Boolean.TRUE.equals(value.debug()));
 SpanField.SHARED.write(b, Boolean.TRUE.equals(value.shared()));
}

代码示例来源:origin: wavefrontHQ/java

setTraceId(traceId).
setStartMillis(zipkinSpan.timestampAsLong() / 1000).
setDuration(zipkinSpan.durationAsLong() / 1000).
setAnnotations(annotations).
build();
 spanName, applicationName,
 serviceName, cluster, shard, sourceName, isError,
 zipkinSpan.durationAsLong()), true);

代码示例来源:origin: io.zipkin.zipkin2/zipkin

result.duration(value.durationAsLong());

代码示例来源:origin: io.zipkin.zipkin2/zipkin

b.writeAscii(",\"timestamp\":").writeAscii(value.timestampAsLong());
if (value.durationAsLong() != 0L) {
 b.writeAscii(",\"duration\":").writeAscii(value.durationAsLong());

代码示例来源:origin: openzipkin/zipkin-gcp

if (zipkinSpan.durationAsLong() != 0L) {
 Timestamp endTime =
   createTimestamp(zipkinSpan.timestampAsLong() + zipkinSpan.durationAsLong());
 spanBuilder.setEndTime(endTime);

代码示例来源:origin: io.github.scouter-project/zipkin-storage-scouter-udp

pack.elapsed = (int) (span.durationAsLong() / 1000);

代码示例来源:origin: io.netifi.proteus/proteus-tracing-openzipkin

private zipkin2.proto3.Span mapSpan(Span span) {
 zipkin2.proto3.Span.Builder builder =
   zipkin2.proto3.Span.newBuilder().setName(span.name()).setTraceId(span.traceId());
 if (span.parentId() != null) {
  builder.setParentId(span.parentId());
 }
 builder.setId(span.id());
 if (span.kind() != null) {
  builder.setKind(zipkin2.proto3.Span.Kind.valueOf(span.kind().name()));
 }
 builder.setTimestamp(span.timestampAsLong()).setDuration(span.durationAsLong());
 if (span.localEndpoint() != null) {
  builder.setLocalEndpoint(mapEndpoint(span.localEndpoint()));
 }
 if (span.remoteEndpoint() != null) {
  builder.setRemoteEndpoint(mapEndpoint(span.remoteEndpoint()));
 }
 for (Annotation annotation : span.annotations()) {
  builder.addAnnotations(mapAnnotation(annotation));
 }
 builder
   .putAllTags(span.tags())
   .setDebug(span.debug() == null ? false : span.debug())
   .setShared(span.shared() == null ? false : span.shared())
   .putTags("group", group)
   .putTags("destination", destination);
 return builder.build();
}

代码示例来源:origin: io.netifi.proteus/tracing-openzipkin

private zipkin2.proto3.Span mapSpan(Span span) {
 zipkin2.proto3.Span.Builder builder =
   zipkin2.proto3.Span.newBuilder().setName(span.name()).setTraceId(span.traceId());
 if (span.parentId() != null) {
  builder.setParentId(span.parentId());
 }
 builder.setId(span.id());
 if (span.kind() != null) {
  builder.setKind(zipkin2.proto3.Span.Kind.valueOf(span.kind().name()));
 }
 builder.setTimestamp(span.timestampAsLong()).setDuration(span.durationAsLong());
 if (span.localEndpoint() != null) {
  builder.setLocalEndpoint(mapEndpoint(span.localEndpoint()));
 }
 if (span.remoteEndpoint() != null) {
  builder.setRemoteEndpoint(mapEndpoint(span.remoteEndpoint()));
 }
 for (Annotation annotation : span.annotations()) {
  builder.addAnnotations(mapAnnotation(annotation));
 }
 builder
   .putAllTags(span.tags())
   .setDebug(span.debug() == null ? false : span.debug())
   .setShared(span.shared() == null ? false : span.shared())
   .putTags("group", group)
   .putTags("destination", destination);
 return builder.build();
}

代码示例来源:origin: netifi-proteus/proteus-java

private zipkin2.proto3.Span mapSpan(Span span) {
 zipkin2.proto3.Span.Builder builder =
   zipkin2.proto3.Span.newBuilder().setName(span.name()).setTraceId(span.traceId());
 if (span.parentId() != null) {
  builder.setParentId(span.parentId());
 }
 builder.setId(span.id());
 if (span.kind() != null) {
  builder.setKind(zipkin2.proto3.Span.Kind.valueOf(span.kind().name()));
 }
 builder.setTimestamp(span.timestampAsLong()).setDuration(span.durationAsLong());
 if (span.localEndpoint() != null) {
  builder.setLocalEndpoint(mapEndpoint(span.localEndpoint()));
 }
 if (span.remoteEndpoint() != null) {
  builder.setRemoteEndpoint(mapEndpoint(span.remoteEndpoint()));
 }
 for (Annotation annotation : span.annotations()) {
  builder.addAnnotations(mapAnnotation(annotation));
 }
 builder
   .putAllTags(span.tags())
   .setDebug(span.debug() == null ? false : span.debug())
   .setShared(span.shared() == null ? false : span.shared())
   .putTags("group", group)
   .putTags("destination", destination);
 return builder.build();
}

相关文章