Class SpanDataModifier
-
- All Implemented Interfaces:
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<in T> 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<in T> attributeValuePredicate)Modify span data before it enters the exporter pipeline. <T> SpanDataModifierreplaceSpanAttribute(AttributeKey<T> attributeKey, Function<in T, 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
spanNamePredicatewill not be exported.- Parameters:
spanNamePredicate- A function that returns true if a span with passed name should be rejected.- Returns:
this.
-
rejectSpansByAttributeValue
<T> SpanDataModifier rejectSpansByAttributeValue(AttributeKey<T> attributeKey, Predicate<in T> attributeValuePredicate)
Remove matching spans from the exporter pipeline.
Any span that contains an attribute with key
attributeKeyand value matching theattributeValuePredicatewill not be exported.- Parameters:
attributeKey- An attribute key to match.attributeValuePredicate- A function that returns true if a span containing an attribute with matching value should be rejected.- Returns:
this.
-
removeSpanAttribute
<T> SpanDataModifier removeSpanAttribute(AttributeKey<T> attributeKey)
Modify span data before it enters the exporter pipeline.
Any attribute with key
attributeKeyand will be removed from the span before it is exported.- Parameters:
attributeKey- An attribute key to match.- Returns:
this.
-
removeSpanAttribute
<T> SpanDataModifier removeSpanAttribute(AttributeKey<T> attributeKey, Predicate<in T> attributeValuePredicate)
Modify span data before it enters the exporter pipeline.
Any attribute with key
attributeKeyand value matching theattributeValuePredicatewill 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 matching value should be removed from the span.- Returns:
this.
-
replaceSpanAttribute
<T> SpanDataModifier replaceSpanAttribute(AttributeKey<T> attributeKey, Function<in T, out T> attributeValueModifier)
Modify span data before it enters the exporter pipeline.
The value of any attribute with key
attributeKeywill be passed to theattributeValueModifierfunction. The value returned by the function will replace the original value. When the modifier function returnsnullthe attribute will be removed from the span.- Parameters:
attributeKey- An attribute key to match.attributeValueModifier- A function that receives the old attribute value and returns the new one.- Returns:
this.
-
build
SpanExporter build()
-
-
-
-