Package brave
Class Tag<I>
java.lang.Object
brave.Tag<I>
public abstract class Tag<I> extends Object
This is a centralized type to parse a tag into any variant of a span. This also avoids the
clutter of checking null or guarding on exceptions.
Here's an example of a potentially expensive tag:
{@code SUMMARY_TAG = new Tag("summary") {
- Since:
- 5.11
- See Also:
Tags
,SpanCustomizer.tag(String, String)
,MutableSpan.tag(String, String)
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description String
key()
protected String
key(I input)
Overrides the tag key based on the inputprotected abstract String
parseValue(I input, TraceContext context)
Override to change what data from the input are parsed into the span modeling it.void
tag(I input, TraceContext context, MutableSpan span)
Tags the value parsed from theinput
.void
tag(I input, TraceContext context, SpanCustomizer span)
Tags the value parsed from theinput
.void
tag(I input, ScopedSpan span)
Tags the value parsed from theinput
.void
tag(I input, Span span)
Tags the value parsed from theinput
.void
tag(I input, SpanCustomizer span)
Tags the value parsed from theinput
.String
toString()
protected static String
validateNonEmpty(String label, String value)
-
Constructor Details
-
Tag
- Since:
- 5.11
-
-
Method Details
-
key
-
parseValue
Override to change what data from the input are parsed into the span modeling it. Any exceptions will be logged and ignored.- Returns:
- The result to add as a span tag.
null
means no tag will be added. Note: empty string is a valid tag value! - Since:
- 5.11
-
key
Overrides the tag key based on the input -
tag
Tags the value parsed from theinput
.- Since:
- 5.11
-
tag
Tags the value parsed from theinput
.- Since:
- 5.11
-
tag
Tags the value parsed from theinput
.- Since:
- 5.11
-
tag
Tags the value parsed from theinput
.- Since:
- 5.11
-
tag
Tags the value parsed from theinput
.- Since:
- 5.11
- See Also:
FinishedSpanHandler.handle(TraceContext, MutableSpan)
-
toString
-
validateNonEmpty
-