zipkin.Annotation.create()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(95)

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

Annotation.create介绍

暂无

代码示例

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

synchronized MutableSpan addAnnotation(Time timestamp, String value) {
 if (annotations.isEmpty()) {
  span.timestamp(timestamp.inMicroseconds());
 }
 if (!isComplete &&
   (value.equals(CLIENT_RECV) ||
    value.equals(SERVER_SEND) ||
    value.equals(TimeoutFilter.TimeoutAnnotation()))) {
  if (!annotations.isEmpty()) {
   span.duration(timestamp.inMicroseconds() - annotations.get(0).timestamp);
  }
  isComplete = true;
 }
 annotations.add(Annotation.create(timestamp.inMicroseconds(), value, endpoint));
 return this;
}

代码示例来源:origin: Nike-Inc/wingtips

protected zipkin.Span.Builder createNewZipkinSpanBuilderWithSpanPurposeAnnotations(
  Span wingtipsSpan, long startEpochMicros, long durationMicros, Endpoint zipkinEndpoint, String localComponentNamespace
) {
  zipkin.Span.Builder zsb = zipkin.Span.builder();
  switch(wingtipsSpan.getSpanPurpose()) {
    case SERVER:
      zsb.addAnnotation(Annotation.create(startEpochMicros, Constants.SERVER_RECV, zipkinEndpoint))
        .addAnnotation(Annotation.create(startEpochMicros + durationMicros, Constants.SERVER_SEND, zipkinEndpoint));
      break;
    case CLIENT:
      zsb.addAnnotation(Annotation.create(startEpochMicros, Constants.CLIENT_SEND, zipkinEndpoint))
        .addAnnotation(Annotation.create(startEpochMicros + durationMicros, Constants.CLIENT_RECV, zipkinEndpoint));
      break;
    case LOCAL_ONLY:
    case UNKNOWN:       // intentional fall-through: local and unknown span purpose are treated the same way
      zsb.addBinaryAnnotation(BinaryAnnotation.create(Constants.LOCAL_COMPONENT, localComponentNamespace, zipkinEndpoint));
      break;
    default:
      logger.warn("Unhandled SpanPurpose type: " + wingtipsSpan.getSpanPurpose().name());
  }
  return zsb;
}

代码示例来源:origin: Nike-Inc/wingtips

protected void addAllAnnotationsToBuilder(
  zipkin.Span.Builder builder,
  List<TimestampedAnnotation> wingtipsAnnotations,
  Endpoint zipkinEndpoint
) {
  for (TimestampedAnnotation wingtipsAnnotation : wingtipsAnnotations) {
    builder.addAnnotation(
      Annotation.create(
        wingtipsAnnotation.getTimestampEpochMicros(),
        wingtipsAnnotation.getValue(),
        zipkinEndpoint
      )
    );
  }
}

代码示例来源:origin: com.nike.wingtips/wingtips-zipkin

protected zipkin.Span.Builder createNewZipkinSpanBuilderWithSpanPurposeAnnotations(
  Span wingtipsSpan, long startEpochMicros, long durationMicros, Endpoint zipkinEndpoint, String localComponentNamespace
) {
  zipkin.Span.Builder zsb = zipkin.Span.builder();
  switch(wingtipsSpan.getSpanPurpose()) {
    case SERVER:
      zsb.addAnnotation(Annotation.create(startEpochMicros, Constants.SERVER_RECV, zipkinEndpoint))
        .addAnnotation(Annotation.create(startEpochMicros + durationMicros, Constants.SERVER_SEND, zipkinEndpoint));
      break;
    case CLIENT:
      zsb.addAnnotation(Annotation.create(startEpochMicros, Constants.CLIENT_SEND, zipkinEndpoint))
        .addAnnotation(Annotation.create(startEpochMicros + durationMicros, Constants.CLIENT_RECV, zipkinEndpoint));
      break;
    case LOCAL_ONLY:
    case UNKNOWN:       // intentional fall-through: local and unknown span purpose are treated the same way
      zsb.addBinaryAnnotation(BinaryAnnotation.create(Constants.LOCAL_COMPONENT, localComponentNamespace, zipkinEndpoint));
      break;
    default:
      logger.warn("Unhandled SpanPurpose type: " + wingtipsSpan.getSpanPurpose().name());
  }
  return zsb;
}

代码示例来源:origin: com.nike.wingtips/wingtips-zipkin

protected void addAllAnnotationsToBuilder(
  zipkin.Span.Builder builder,
  List<TimestampedAnnotation> wingtipsAnnotations,
  Endpoint zipkinEndpoint
) {
  for (TimestampedAnnotation wingtipsAnnotation : wingtipsAnnotations) {
    builder.addAnnotation(
      Annotation.create(
        wingtipsAnnotation.getTimestampEpochMicros(),
        wingtipsAnnotation.getValue(),
        zipkinEndpoint
      )
    );
  }
}

代码示例来源:origin: io.zipkin.brave/brave-core

Annotation a = Annotation.create(input.timestamp(), input.value(), local);
if (a.value.length() == 2) {
 if (a.value.equals("cs")) {
 case CLIENT:
  remoteEndpointType = "sa";
  if (startTs != 0L) cs = Annotation.create(startTs, "cs", local);
  if (endTs != 0L) cr = Annotation.create(endTs, "cr", local);
  break;
 case SERVER:
  remoteEndpointType = "ca";
  if (startTs != 0L) sr = Annotation.create(startTs, "sr", local);
  if (endTs != 0L) ss = Annotation.create(endTs, "ss", local);
  break;
 case PRODUCER:
  remoteEndpointType = "ma";
  if (startTs != 0L) ms = Annotation.create(startTs, "ms", local);
  if (endTs != 0L) ws = Annotation.create(endTs, "ws", local);
  break;
 case CONSUMER:
  remoteEndpointType = "ma";
  if (startTs != 0L && endTs != 0L) {
   wr = Annotation.create(startTs, "wr", local);
   mr = Annotation.create(endTs, "mr", local);
  } else if (startTs != 0L) {
   mr = Annotation.create(startTs, "mr", local);

代码示例来源:origin: Nike-Inc/wingtips

Annotation.create(startTimeEpochMicros, Constants.SERVER_RECV, zipkinEndpoint)
);
assertThat(zipkinSpan.annotations).contains(
  Annotation.create(startTimeEpochMicros + durationMicros, Constants.SERVER_SEND, zipkinEndpoint)
);
  Annotation.create(startTimeEpochMicros, Constants.CLIENT_SEND, zipkinEndpoint)
);
assertThat(zipkinSpan.annotations).contains(
  Annotation.create(startTimeEpochMicros + durationMicros, Constants.CLIENT_RECV, zipkinEndpoint)
);

代码示例来源:origin: io.zipkin.java/storage-jdbc

int type = a.getValue(ZIPKIN_ANNOTATIONS.A_TYPE);
if (type == -1) {
 span.addAnnotation(Annotation.create(
   a.getValue(ZIPKIN_ANNOTATIONS.A_TIMESTAMP),
   a.getValue(ZIPKIN_ANNOTATIONS.A_KEY),

代码示例来源:origin: io.zipkin.java/spanstore-jdbc

int type = a.getValue(ZIPKIN_ANNOTATIONS.A_TYPE);
if (type == -1) {
 span.addAnnotation(Annotation.create(
   a.getValue(ZIPKIN_ANNOTATIONS.A_TIMESTAMP),
   a.getValue(ZIPKIN_ANNOTATIONS.A_KEY),

代码示例来源:origin: io.zipkin.java/zipkin-storage-jdbc

int type = a.getValue(ZIPKIN_ANNOTATIONS.A_TYPE);
if (type == -1) {
 span.addAnnotation(Annotation.create(
   a.getValue(ZIPKIN_ANNOTATIONS.A_TIMESTAMP),
   a.getValue(ZIPKIN_ANNOTATIONS.A_KEY),

代码示例来源:origin: io.zipkin.java/zipkin-storage-mysql

int type = a.getValue(ZIPKIN_ANNOTATIONS.A_TYPE);
if (type == -1) {
 span.addAnnotation(Annotation.create(
   a.getValue(ZIPKIN_ANNOTATIONS.A_TIMESTAMP),
   a.getValue(ZIPKIN_ANNOTATIONS.A_KEY),

相关文章

微信公众号

最新文章

更多

Annotation类方法