brave.internal.Nullable类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(184)

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

Nullable介绍

暂无

代码示例

代码示例来源:origin: openzipkin/brave

/**
 * Sets the current span in scope until the returned object is closed. It is a programming error
 * to drop or never close the result. Using try-with-resources is preferred for this reason.
 *
 * @param currentSpan span to place into scope or null to clear the scope
 */
public abstract Scope newScope(@Nullable TraceContext currentSpan);

代码示例来源:origin: openzipkin/brave

/**
 * The parent's {@link #spanId} or null if this the root span in a trace.
 *
 * @see #parentIdAsLong()
 */
@Nullable public final Long parentId() {
 return parentId != 0 ? parentId : null;
}

代码示例来源:origin: openzipkin/brave

/**
 * The entire URL, including the scheme, host and query parameters if available or null if
 * unreadable.
 *
 * <p>Conventionally associated with the key "http.url"
 */
@Nullable public abstract String url(Req request);

代码示例来源:origin: openzipkin/brave

/**
 * The HTTP status code or null if unreadable.
 *
 * <p>Conventionally associated with the key "http.status_code"
 *
 * @see #statusCodeAsInt(Object)
 */
@Nullable public abstract Integer statusCode(Resp response);

代码示例来源:origin: openzipkin/brave

/**
 * Returns an overriding sampling decision for a new trace. Return null ignore the request and use
 * the {@link brave.sampler.Sampler trace ID sampler}.
 */
@Nullable public abstract <Req> Boolean trySample(HttpAdapter<Req, ?> adapter, Req request);

代码示例来源:origin: openzipkin/brave

/**
 * The HTTP method, or verb, such as "GET" or "POST" or null if unreadable.
 *
 * <p>Conventionally associated with the key "http.method"
 */
@Nullable public abstract String method(Req request);

代码示例来源:origin: openzipkin/brave

/**
  * Returns the same value, an updated one, or null to drop the annotation.
  *
  * @see brave.Span#annotate(long, String)
  */
 @Nullable String update(long timestamp, String value);
}

代码示例来源:origin: openzipkin/brave

/** Allows you to create flags from a boolean value without allocating a builder instance */
public static SamplingFlags build(@Nullable Boolean sampled) {
 if (sampled != null) return sampled ? SAMPLED : NOT_SAMPLED;
 return EMPTY;
}

代码示例来源:origin: openzipkin/brave

public static TraceContextOrSamplingFlags create(@Nullable Boolean sampled, boolean debug) {
 if (debug) return DEBUG;
 if (sampled == null) return EMPTY;
 return sampled ? SAMPLED : NOT_SAMPLED;
}

代码示例来源:origin: openzipkin/brave

/**
  * Returns the same value, an updated one, or null to drop the tag.
  *
  * @see brave.Span#tag(String, String)
  */
 @Nullable String update(String key, String value);
}

代码示例来源:origin: openzipkin/brave

/**
 * When null {@link brave.Tracing.Builder#localServiceName(String) default} will be used for
 * zipkin.
 */
@Nullable public String localServiceName() {
 return localServiceName;
}

代码示例来源:origin: openzipkin/brave

/**
 * The text representation of the primary IPv4 or IPv6 address associated with the remote side of
 * this connection. Ex. 192.168.99.100 null if unknown.
 *
 * @see brave.Span#remoteIpAndPort(String, int)
 */
@Nullable public String remoteIp() {
 return remoteIp;
}

代码示例来源:origin: openzipkin/brave

/**
  * Customizes the span based on the response received from the server.
  *
  * <p>{@inheritDoc}
  */
 @Override public <Resp> void response(HttpAdapter<?, Resp> adapter, @Nullable Resp res,
   @Nullable Throwable error, SpanCustomizer customizer) {
  super.response(adapter, res, error, customizer);
 }
}

代码示例来源:origin: openzipkin/brave

/**
  * Customizes the span based on the response sent to the client.
  *
  * <p>{@inheritDoc}
  */
 @Override public <Resp> void response(HttpAdapter<?, Resp> adapter, @Nullable Resp res,
   @Nullable Throwable error, SpanCustomizer customizer) {
  super.response(adapter, res, error, customizer);
 }
}

代码示例来源:origin: openzipkin/brave

/**
  * Finishes the client span after assigning it tags according to the response or error.
  *
  * <p>This is typically called once the response headers are received, and after the span is
  * {@link brave.Tracer.SpanInScope#close() no longer in scope}.
  *
  * @see HttpClientParser#response(HttpAdapter, Object, Throwable, SpanCustomizer)
  */
 public void handleReceive(@Nullable Resp response, @Nullable Throwable error, Span span) {
  handleFinish(response, error, span);
 }
}

代码示例来源:origin: openzipkin/brave

/** Returns true if the key/value was removed from the pair-indexed list at index {@code i} */
static boolean updateOrRemove(ArrayList list, int i, Object value, @Nullable Object newValue) {
 if (newValue == null) {
  list.remove(i);
  list.remove(i);
  return true;
 } else if (!value.equals(newValue)) {
  list.set(i + 1, newValue);
 }
 return false;
}

代码示例来源:origin: openzipkin/brave

/** Returns the last value associated with the key or null */
@Nullable public String tag(String key) {
 if (key == null) throw new NullPointerException("key == null");
 if (key.isEmpty()) throw new IllegalArgumentException("key is empty");
 String result = null;
 for (int i = 0, length = tags.size(); i < length; i += 2) {
  if (key.equals(tags.get(i))) result = tags.get(i + 1);
 }
 return result;
}

代码示例来源:origin: openzipkin/brave

@Nullable public static String ipOrNull(@Nullable String ip) {
 if (ip == null || ip.isEmpty()) return null;
 if ("::1".equals(ip) || "127.0.0.1".equals(ip)) return ip; // special-case localhost
 IpFamily format = detectFamily(ip);
 if (format == IpFamily.IPv4Embedded) {
  ip = ip.substring(ip.lastIndexOf(':') + 1);
 } else if (format == IpFamily.Unknown) {
  ip = null;
 }
 return ip;
}

代码示例来源:origin: openzipkin/brave

/** @see TraceContext#sampled() */
public Builder sampled(@Nullable Boolean sampled) {
 if (sampled == null) {
  flags &= ~(FLAG_SAMPLED_SET | FLAG_SAMPLED);
  return this;
 }
 return sampled(sampled.booleanValue());
}

代码示例来源:origin: openzipkin/brave

/**
 * The absolute http path, without any query parameters or null if unreadable. Ex.
 * "/objects/abcd-ff"
 *
 * <p>Conventionally associated with the key "http.path"
 * @see #route(Object)
 */
@Nullable public String path(Req request) {
 String url = url(request);
 if (url == null) return null;
 return URI.create(url).getPath(); // TODO benchmark
}

相关文章