zipkin.Annotation类的使用及代码示例

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

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

Annotation介绍

暂无

代码示例

代码示例来源: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: io.zipkin.finagle/zipkin-finagle

/**
 * Sets the endpoint in the span for any future annotations. Also sets the endpoint in any
 * previous annotations that lack one.
 */
synchronized MutableSpan setEndpoint(Endpoint endpoint) {
 for (int i = 0; i < annotations.size(); i++) {
  Annotation a = annotations.get(i);
  if (a.endpoint.equals(Endpoints.UNKNOWN)) {
   annotations.set(i, a.toBuilder().endpoint(endpoint).build());
  }
 }
 this.endpoint = endpoint;
 return this;
}

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

@Override  public Annotation fromJson(JsonReader reader) throws IOException {
 Annotation.Builder result = Annotation.builder();
 reader.beginObject();
 while (reader.hasNext()) {
  switch (reader.nextName()) {
   case "timestamp":
    result.timestamp(reader.nextLong());
    break;
   case "value":
    result.value(reader.nextString());
    break;
   case "endpoint":
    result.endpoint(ENDPOINT_ADAPTER.fromJson(reader));
    break;
   default:
    reader.skipValue();
  }
 }
 reader.endObject();
 return result.build();
}

代码示例来源: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: io.zipkin.finagle/zipkin-finagle

synchronized Span toSpan() {
 // fill in the host/service data for all the annotations
 for (Annotation ann : annotations) {
  Endpoint ep = Endpoints.boundEndpoint(ann.endpoint);
  span.addAnnotation(
    ann.toBuilder().endpoint(ep.toBuilder().serviceName(service).build()).build());
 }
 for (BinaryAnnotation ann : binaryAnnotations) {
  Endpoint ep = Endpoints.boundEndpoint(ann.endpoint);
  // TODO: service name for "ca" or "sa" is likely incorrect
  span.addBinaryAnnotation(
    ann.toBuilder().endpoint(ep.toBuilder().serviceName(service).build()).build());
 }
 return span.build();
}

代码示例来源: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: 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: 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/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类方法