Tabnine Logo
BraveSpan
Code IndexAdd Tabnine to your IDE (free)

How to use
BraveSpan
in
brave.opentracing

Best Java code snippets using brave.opentracing.BraveSpan (Showing top 13 results out of 315)

origin: stagemonitor/stagemonitor

@Override
public boolean isRoot(Span span) {
  // TODO replace with Span#unwrap once https://github.com/opentracing/opentracing-java/pull/211 is merged
  if (span instanceof SpanWrapper) {
    span = ((SpanWrapper) span).getDelegate();
  }
  if (span instanceof BraveSpan) {
    final BraveSpan braveSpan = (BraveSpan) span;
    return braveSpan.unwrap().context().parentId() == null;
  }
  return false;
}
origin: openzipkin-contrib/brave-opentracing

@Override public BraveSpan log(Map<String, ?> fields) {
 if (finishCalled) return this;
 if (fields.isEmpty()) return this;
 return log(toAnnotation(fields));
}
origin: openzipkin-contrib/brave-opentracing

@Override public BraveSpan setTag(String key, String value) {
 if (finishCalled) return this;
 if (trySetPeer(delegate, key, value)) return this;
 if (trySetKind(key, value)) return this;
 delegate.tag(key, value);
 return this;
}
origin: openzipkin-contrib/brave-opentracing

/**
 * <em>Note:</em>If the key is {@linkplain Tags#SAMPLING_PRIORITY} and the value is zero, the
 * current span will be abandoned and future references to the {@link #context()} will be
 * unsampled. This does not affect the active span, nor does it affect any equivalent instances of
 * this object. This is a best efforts means to handle late sampling decisions.
 */
@Override public BraveSpan setTag(String key, Number value) {
 if (finishCalled) return this;
 if (trySetPeer(key, value)) return this;
 // handle late sampling decision
 if (Tags.SAMPLING_PRIORITY.getKey().equals(key) && value.intValue() == 0) {
  delegate.abandon();
  // convert the span to no-op
  delegate = tracer.toSpan(delegate.context().toBuilder().sampled(false).build());
 }
 return setTag(key, value.toString());
}
origin: openzipkin-contrib/brave-opentracing

BraveSpan result = new BraveSpan(braveTracer, span);
result.remotePort = remotePort;
for (Map.Entry<String, String> tag : tags.entrySet()) {
 result.setTag(tag.getKey(), tag.getValue());
origin: openzipkin-contrib/brave-opentracing

@Override public void finish() {
 if (finishCalled) return;
 finishCalled = true;
 trySetRemoteIpAndPort();
 delegate.finish();
}
origin: openzipkin-contrib/brave-opentracing

/**
 * Converts a map to a string of form: "key1=value1 key2=value2"
 */
static String toAnnotation(Map<String, ?> fields) {
 // special-case the "event" field which is similar to the semantics of a zipkin annotation
 Object event = fields.get("event");
 if (event != null && fields.size() == 1) return event.toString();
 return joinOnEqualsSpace(fields);
}
origin: openzipkin-contrib/brave-opentracing

@Override public BraveSpan setTag(String key, boolean value) {
 if (finishCalled) return this;
 if (Tags.ERROR.getKey().equals(key) && !value) return this;
 return setTag(key, Boolean.toString(value));
}
origin: openzipkin-contrib/brave-opentracing

/** Attempts to get a span from the current api, falling back to brave's native one */
BraveSpan currentSpan() {
 BraveScope scope = currentScopes.get().peekFirst();
 if (scope != null) {
  return scope.span();
 } else {
  brave.Span braveSpan = tracer.currentSpan();
  if (braveSpan != null) {
   return new BraveSpan(tracer, braveSpan);
  }
 }
 return null;
}
origin: openzipkin-contrib/brave-opentracing

@Override public void close() {
 if (finishSpanOnClose) {
  wrapped.finish();
 }
 scope.close();
 source.deregister(this);
}
origin: openzipkin-contrib/brave-opentracing

@Override public BraveSpan log(long timestampMicroseconds, Map<String, ?> fields) {
 if (finishCalled) return this;
 if (fields.isEmpty()) return this;
 // in real life, do like zipkin-go-opentracing: "key1=value1 key2=value2"
 return log(timestampMicroseconds, toAnnotation(fields));
}
origin: openzipkin-contrib/brave-opentracing

@Override public void finish(long finishMicros) {
 if (finishCalled) return;
 finishCalled = true;
 trySetRemoteIpAndPort();
 delegate.finish(finishMicros);
}
origin: stagemonitor/stagemonitor

@Override
public boolean isSampled(Span span) {
  // TODO replace with Span#unwrap once https://github.com/opentracing/opentracing-java/pull/211 is merged
  if (span instanceof SpanWrapper) {
    span = ((SpanWrapper) span).getDelegate();
  }
  if (span instanceof BraveSpan) {
    final BraveSpan braveSpan = (BraveSpan) span;
    return braveSpan.unwrap().context().sampled();
  }
  return false;
}
brave.opentracingBraveSpan

Javadoc

Holds the brave.Span used by the underlying brave.Tracer.

This type also includes hooks to integrate with the underlying brave.Tracer. Ex you can access the underlying span with #unwrap

Operations to add data to the span are ignored once #finish() or #finish(long) are called.

Most used methods

  • <init>
  • finish
  • joinOnEqualsSpace
  • log
  • setTag
  • toAnnotation
    Converts a map to a string of form: "key1=value1 key2=value2"
  • trySetKind
  • trySetPeer
  • trySetRemoteIpAndPort
  • unwrap
    Returns wrapped brave.Span

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • requestLocationUpdates (LocationManager)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now