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

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

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

Nullable介绍

暂无

代码示例

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

/**
 * Gets the Trace/Span context.
 *
 * @return Trace/Span context. Can be <code>null</code> in case we did not get any context in request.
 */
@Nullable
public abstract Span getSpan();

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

/**
 * Get parent span id.
 *
 * @return Parent span id. Can be <code>null</code>.
 * @deprecated use {@link #nullableParentId()}
 */
@Deprecated
@Nullable
public Long getParentSpanId() {
 return nullableParentId();
}

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

/**
 * Creates a new span id.
 *
 * @param traceId Trace Id.
 * @param spanId Span Id.
 * @param parentSpanId Nullable parent span id.
 * @deprecated Please use {@link SpanId.Builder}
 */
@Deprecated
public static SpanId create(long traceId, long spanId, @Nullable Long parentSpanId) {
 return SpanId.builder().traceId(traceId).parentId(parentSpanId).spanId(spanId).build();
}

代码示例来源:origin: blacklau/http-dubbo-zipkin

public void addSpanIdToRequest(@Nullable SpanId spanId) {
  Map<String,String> at = this.invocation.getAttachments();
  if (spanId == null) {
    at.put("Sampled", "0");
  } else {
    
    at.put("Sampled", "1");
    at.put("TraceId", spanId.traceIdString());
    at.put("SpanId", IdConversion.convertToString(spanId.spanId));
    
    if (spanId.nullableParentId() != null) {
      at.put("ParentSpanId", IdConversion.convertToString(spanId.parentId));
    }
  }
}

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

/**
 * Should we sample this request or not? True means sample, false means don't, null means we defer
 * decision to someone further down in the stack.
 */
@Nullable
public final Boolean sampled() {
 if (debug()) return true;
 return (flags & FLAG_SAMPLING_SET) == FLAG_SAMPLING_SET
   ? (flags & FLAG_SAMPLED) == FLAG_SAMPLED
   : null;
}

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

/** Returns null when this is a root span. */
@Nullable
public Long nullableParentId() {
 return root() ? null : parentId;
}

代码示例来源:origin: com.github.kristofa/brave-core

/**
 * Get parent span id.
 *
 * @return Parent span id. Can be <code>null</code>.
 * @deprecated use {@link #nullableParentId()}
 */
@Deprecated
@Nullable
public Long getParentSpanId() {
 return nullableParentId();
}

代码示例来源:origin: com.github.kristofa/brave-core

/**
 * Creates a new span id.
 *
 * @param traceId Trace Id.
 * @param spanId Span Id.
 * @param parentSpanId Nullable parent span id.
 * @deprecated Please use {@link SpanId.Builder}
 */
@Deprecated
public static SpanId create(long traceId, long spanId, @Nullable Long parentSpanId) {
 return SpanId.builder().traceId(traceId).parentId(parentSpanId).spanId(spanId).build();
}

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

@Override
public void addSpanIdToRequest(@Nullable SpanId spanId) {
  if (spanId == null) {
    request.addHeader(BraveHttpHeaders.Sampled.getName(), "0");
  } else {
    request.addHeader(BraveHttpHeaders.Sampled.getName(), "1");
    request.addHeader(BraveHttpHeaders.TraceId.getName(), spanId.traceIdString());
    request.addHeader(BraveHttpHeaders.SpanId.getName(), IdConversion.convertToString(spanId.spanId));
    if (spanId.nullableParentId() != null) {
      request.addHeader(BraveHttpHeaders.ParentSpanId.getName(), IdConversion.convertToString(spanId.parentId));
    }
  }
}

代码示例来源:origin: com.github.kristofa/brave-core

/**
 * Should we sample this request or not? True means sample, false means don't, null means we defer
 * decision to someone further down in the stack.
 */
@Nullable
public final Boolean sampled() {
 if (debug()) return true;
 return (flags & FLAG_SAMPLING_SET) == FLAG_SAMPLING_SET
   ? (flags & FLAG_SAMPLED) == FLAG_SAMPLED
   : null;
}

代码示例来源:origin: com.github.kristofa/brave-core

/** Returns null when this is a root span. */
@Nullable
public Long nullableParentId() {
 return root() ? null : parentId;
}

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

/**
 * Indicates if we need to sample this request or not.
 *
 * @return <code>true</code> in case we should sample this request, <code>false</code> in case we should not sample this
 *         request or <code>null</code> in case we did not get any indication about sampling this request. In this case
 *         new client requests should decide about sampling or not.
 */
@Nullable
public abstract Boolean getSample();

代码示例来源:origin: com.github.kristofa/brave-http

@Override
public void addSpanIdToRequest(@Nullable SpanId spanId) {
  if (spanId == null) {
    request.addHeader(BraveHttpHeaders.Sampled.getName(), "0");
  } else {
    request.addHeader(BraveHttpHeaders.Sampled.getName(), "1");
    request.addHeader(BraveHttpHeaders.TraceId.getName(), IdConversion.convertToString(spanId.traceId));
    request.addHeader(BraveHttpHeaders.SpanId.getName(), IdConversion.convertToString(spanId.spanId));
    if (spanId.nullableParentId() != null) {
      request.addHeader(BraveHttpHeaders.ParentSpanId.getName(), IdConversion.convertToString(spanId.parentId));
    }
  }
}

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

/**
 * @deprecated since 3.15 use {@link #setStateCurrentTrace(SpanId, String)}
 */
@Deprecated
public void setStateCurrentTrace(long traceId, long spanId, @Nullable Long parentSpanId, String name) {
  SpanId context = SpanId.builder().traceId(traceId).spanId(spanId).parentId(parentSpanId).build();
  setStateCurrentTrace(context, name);
}

代码示例来源:origin: com.github.kristofa/brave-core

/**
 * Indicates if we need to sample this request or not.
 *
 * @return <code>true</code> in case we should sample this request, <code>false</code> in case we should not sample this
 *         request or <code>null</code> in case we did not get any indication about sampling this request. In this case
 *         new client requests should decide about sampling or not.
 */
@Nullable
public abstract Boolean getSample();

代码示例来源:origin: xuminwlt/j360-dubbo-app-all

@Override
public void addSpanIdToRequest(@Nullable SpanId spanId) {
  // 添加下游信息
  if (spanId == null) {
    ((RpcInvocation) invocation).setAttachment(BraveHttpHeaders.Sampled.getName(), "0");
  } else {
    ((RpcInvocation) invocation).setAttachment(BraveHttpHeaders.Sampled.getName(), "1");
    ((RpcInvocation) invocation).setAttachment(BraveHttpHeaders.TraceId.getName(), IdConversion.convertToString(spanId.traceId));
    ((RpcInvocation) invocation).setAttachment(BraveHttpHeaders.SpanId.getName(), IdConversion.convertToString(spanId.spanId));
    if (spanId.nullableParentId() != null) {
      ((RpcInvocation) invocation).setAttachment(BraveHttpHeaders.ParentSpanId.getName(), IdConversion.convertToString(spanId.parentId));
    }
  }
}

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

@Nullable
@Override
Span currentLocalSpan() {
 return currentLocalSpan;
}

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

/**
 * Gets the Span for the client request that was started as part of current request.
 * <p/>
 * Should be thread-aware to support multiple parallel requests.
 * 
 * @return Client request span for current thread.
 */
@Nullable Span getCurrentClientSpan();

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

/**
 * Gets the Span for the local request that was started as part of current request.
 * <p/>
 * Should be thread-aware to support multiple parallel requests.
 * 
 * @return Local request span for current thread.
 */
@Nullable
Span getCurrentLocalSpan();

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

/**
 * Returns the upstream sampling decision or null to make one here.
 *
 * @see SpanId#sampled()
 */
@Nullable
public abstract Boolean getSample();

相关文章

Nullable类方法