-
public final class SpanDataModifierA utility that can be used to create a SpanExporter that allows filtering and modification of span data before it is sent to Allows modification of span data before it is sent to a delegate exporter. Spans can be rejected entirely based on their name or attribute content, or their attributes may be modified.
-
-
Method Summary
Modifier and Type Method Description static SpanDataModifierbuilder(SpanExporter delegate)SpanDataModifierrejectSpansByName(Predicate<String> spanNamePredicate)Remove matching spans from the exporter pipeline. <T> SpanDataModifierrejectSpansByAttributeValue(AttributeKey<T> attributeKey, Predicate<out Object> attributeValuePredicate)Remove matching spans from the exporter pipeline. <T> SpanDataModifierremoveSpanAttribute(AttributeKey<T> attributeKey)Modify span data before it enters the exporter pipeline. <T> SpanDataModifierremoveSpanAttribute(AttributeKey<T> attributeKey, Predicate<out Object> attributeValuePredicate)Modify span data before it enters the exporter pipeline. <T> SpanDataModifierreplaceSpanAttribute(AttributeKey<T> attributeKey, Function<out Object, out T> attributeValueModifier)Modify span data before it enters the exporter pipeline. SpanExporterbuild()-
-
Method Detail
-
builder
static SpanDataModifier builder(SpanExporter delegate)
-
rejectSpansByName
SpanDataModifier rejectSpansByName(Predicate<String> spanNamePredicate)
Remove matching spans from the exporter pipeline.
Spans with names that match the
{@code spanNamePredicate}will not be exported.- Parameters:
spanNamePredicate- A function that returns true if a span with passed name should berejected.
-
rejectSpansByAttributeValue
<T> SpanDataModifier rejectSpansByAttributeValue(AttributeKey<T> attributeKey, Predicate<out Object> attributeValuePredicate)
Remove matching spans from the exporter pipeline.
Any span that contains an attribute with key
{@code attributeKey}and value matching the{@code attributeValuePredicate}will not be exported.- Parameters:
attributeKey- An attribute key to match.attributeValuePredicate- A function that returns true if a span containing an attributewith matching value should be rejected.
-
removeSpanAttribute
<T> SpanDataModifier removeSpanAttribute(AttributeKey<T> attributeKey)
Modify span data before it enters the exporter pipeline.
Any attribute with key
{@code attributeKey}and will be removed from the span before it isexported.- Parameters:
attributeKey- An attribute key to match.
-
removeSpanAttribute
<T> SpanDataModifier removeSpanAttribute(AttributeKey<T> attributeKey, Predicate<out Object> attributeValuePredicate)
Modify span data before it enters the exporter pipeline.
Any attribute with key
{@code attributeKey}and value matching the{@code * attributeValuePredicate}will be removed from the span before it is exported.- Parameters:
attributeKey- An attribute key to match.attributeValuePredicate- A function that returns true if an attribute with matchingvalue should be removed from the span.
-
replaceSpanAttribute
<T> SpanDataModifier replaceSpanAttribute(AttributeKey<T> attributeKey, Function<out Object, out T> attributeValueModifier)
Modify span data before it enters the exporter pipeline.
The value of any attribute with key
{@code attributeKey}will be passed to the{@code * attributeValueModifier}function. The value returned by the function will replace theoriginal value. When the modifier function returns{@code null}the attribute will be removedfrom the span.- Parameters:
attributeKey- An attribute key to match.attributeValueModifier- A function that receives the old attribute value and returnsthe new one.
-
build
SpanExporter build()
-
-
-
-