Java源码示例:zipkin2.internal.Nullable
示例1
@RequestMapping(value = "/traces", method = RequestMethod.GET, produces = APPLICATION_JSON_VALUE)
public String getTraces(
@Nullable @RequestParam(value = "serviceName", required = false) String serviceName,
@Nullable @RequestParam(value = "spanName", required = false) String spanName,
@Nullable @RequestParam(value = "annotationQuery", required = false) String annotationQuery,
@Nullable @RequestParam(value = "minDuration", required = false) Long minDuration,
@Nullable @RequestParam(value = "maxDuration", required = false) Long maxDuration,
@Nullable @RequestParam(value = "endTs", required = false) Long endTs,
@Nullable @RequestParam(value = "lookback", required = false) Long lookback,
@RequestParam(value = "limit", defaultValue = "10") int limit)
throws IOException {
QueryRequest queryRequest =
QueryRequest.newBuilder()
.serviceName(serviceName)
.spanName(spanName)
.parseAnnotationQuery(annotationQuery)
.minDuration(minDuration)
.maxDuration(maxDuration)
.endTs(endTs != null ? endTs : System.currentTimeMillis())
.lookback(lookback != null ? lookback : defaultLookback)
.limit(limit)
.build();
List<List<Span>> traces = storage.spanStore().getTraces(queryRequest).execute();
return new String(writeTraces(SpanBytesEncoder.JSON_V2, traces), UTF_8);
}
示例2
@RequestMapping(
value = "/dependencies",
method = RequestMethod.GET,
produces = APPLICATION_JSON_VALUE)
public byte[] getDependencies(
@RequestParam(value = "endTs", required = true) long endTs,
@Nullable @RequestParam(value = "lookback", required = false) Long lookback)
throws IOException {
Call<List<DependencyLink>> call =
storage.spanStore().getDependencies(endTs, lookback != null ? lookback : defaultLookback);
return DependencyLinkBytesEncoder.JSON_V1.encodeList(call.execute());
}
示例3
/**
* Returns {@code null} when there's neither a cause nor an AWS error message. This assumes it was
* a plain HTTP status failure.
*/
@Nullable static Throwable maybeError(Context.FailedExecution context) {
Throwable error = context.exception();
if (error.getCause() == null && error instanceof AwsServiceException) {
AwsServiceException serviceException = (AwsServiceException) error;
if (serviceException.awsErrorDetails().errorMessage() == null) {
return null;
}
}
return error;
}
示例4
HttpClientResponse(
@Nullable SdkHttpRequest request,
@Nullable SdkHttpResponse response,
@Nullable Throwable error
) {
if (response == null && error == null) {
throw new NullPointerException("response == null && error == null");
}
this.request = request;
this.response = response;
this.error = error;
}
示例5
ActuateCollectorMetrics(@Nullable String transport, MeterRegistry meterRegistry) {
this.registryInstance = meterRegistry;
if (transport == null) {
messages = messagesDropped = bytes = spans = spansDropped = null;
messageBytes = messageSpans = null;
return;
}
this.messages =
Counter.builder("zipkin_collector.messages")
.description("cumulative amount of messages received")
.tag("transport", transport)
.register(registryInstance);
this.messagesDropped =
Counter.builder("zipkin_collector.messages_dropped")
.description("cumulative amount of messages received that were later dropped")
.tag("transport", transport)
.register(registryInstance);
this.bytes =
Counter.builder("zipkin_collector.bytes")
.description("cumulative amount of bytes received")
.tag("transport", transport)
.baseUnit("bytes")
.register(registryInstance);
this.spans =
Counter.builder("zipkin_collector.spans")
.description("cumulative amount of spans received")
.tag("transport", transport)
.register(registryInstance);
this.spansDropped =
Counter.builder("zipkin_collector.spans_dropped")
.description("cumulative amount of spans received that were later dropped")
.tag("transport", transport)
.register(registryInstance);
this.messageSpans = new AtomicInteger(0);
Gauge.builder("zipkin_collector.message_spans", messageSpans, AtomicInteger::get)
.description("count of spans per message")
.tag("transport", transport)
.register(registryInstance);
this.messageBytes = new AtomicInteger(0);
Gauge.builder("zipkin_collector.message_bytes", messageBytes, AtomicInteger::get)
.description("size of a message containing serialized spans")
.tag("transport", transport)
.baseUnit("bytes")
.register(registryInstance);
}
示例6
@Nullable
@Override
public String method(@Nonnull Invocation invocation) {
return invocation.getOperationMeta().getHttpMethod();
}
示例7
@Nullable
@Override
public String url(@Nonnull Invocation invocation) {
return invocation.getEndpoint().getEndpoint();
}
示例8
@Nullable
@Override
public String path(@Nonnull Invocation request) {
return request.getOperationMeta().getOperationPath();
}
示例9
@Nullable
@Override
public String requestHeader(@Nonnull Invocation invocation, @Nonnull String key) {
return invocation.getContext().get(key);
}
示例10
@Nullable
@Override
public Integer statusCode(@Nonnull Response response) {
return response.getStatusCode();
}
示例11
@Nullable
@Override
public String method(@Nonnull Invocation invocation) {
return invocation.getOperationMeta().getHttpMethod();
}
示例12
@Nullable
@Override
public String url(@Nonnull Invocation invocation) {
return invocation.getEndpoint().getEndpoint();
}
示例13
@Nullable
@Override
public String path(@Nonnull Invocation request) {
return request.getOperationMeta().getOperationPath();
}
示例14
@Nullable
@Override
public String requestHeader(@Nonnull Invocation invocation, @Nonnull String key) {
return invocation.getContext().get(key);
}
示例15
@Nullable
@Override
public Integer statusCode(@Nonnull Response response) {
return response.getStatusCode();
}
示例16
@Nullable String localServiceName();