@@ -55,19 +55,6 @@ public static AttributeProcessor create(ProcessorConfig config) {
5555 return new AttributeProcessor (config .actions , normalizedInclude , normalizedExclude );
5656 }
5757
58- // this won't be needed once we update to 0.13.0
59- // see https://github.com/open-telemetry/opentelemetry-java/pull/2284
60- @ Nullable
61- public static String getAttribute (Attributes attributes , AttributeKey <String > key ) {
62- Object existingValueObj = attributes .get (key );
63- // checking the return type won't be needed once we update to 0.13.0
64- // see https://github.com/open-telemetry/opentelemetry-java/pull/2284
65- if (existingValueObj instanceof String ) {
66- return (String ) existingValueObj ;
67- }
68- return null ;
69- }
70-
7158 // Function to process actions
7259 public SpanData processActions (SpanData span ) {
7360 SpanData updatedSpan = span ;
@@ -103,7 +90,7 @@ private static SpanData processInsertAction(SpanData span, ProcessorAction actio
10390 builder .putAll (existingSpanAttributes );
10491 return new MySpanData (span , builder .build ());
10592 }
106- String fromAttributeValue = getAttribute ( existingSpanAttributes , actionObj .fromAttribute );
93+ String fromAttributeValue = existingSpanAttributes . get ( actionObj .fromAttribute );
10794 if (fromAttributeValue != null ) {
10895 AttributesBuilder builder = Attributes .builder ();
10996 builder .put (actionObj .key , fromAttributeValue );
@@ -115,7 +102,7 @@ private static SpanData processInsertAction(SpanData span, ProcessorAction actio
115102
116103 private static SpanData processUpdateAction (SpanData span , ProcessorAction actionObj ) {
117104 // Currently we only support String
118- String existingValue = getAttribute ( span .getAttributes (), actionObj .key );
105+ String existingValue = span .getAttributes (). get ( actionObj .key );
119106 if (existingValue == null ) {
120107 return span ;
121108 }
@@ -126,7 +113,7 @@ private static SpanData processUpdateAction(SpanData span, ProcessorAction actio
126113 builder .put (actionObj .key , actionObj .value );
127114 return new MySpanData (span , builder .build ());
128115 }
129- String fromAttributeValue = getAttribute ( span .getAttributes (), actionObj .fromAttribute );
116+ String fromAttributeValue = span .getAttributes (). get ( actionObj .fromAttribute );
130117 if (fromAttributeValue != null ) {
131118 AttributesBuilder builder = span .getAttributes ().toBuilder ();
132119 builder .put (actionObj .key , fromAttributeValue );
@@ -137,7 +124,7 @@ private static SpanData processUpdateAction(SpanData span, ProcessorAction actio
137124
138125 private static SpanData processDeleteAction (SpanData span , ProcessorAction actionObj ) {
139126 // Currently we only support String
140- String existingValue = getAttribute ( span .getAttributes (), actionObj .key );
127+ String existingValue = span .getAttributes (). get ( actionObj .key );
141128 if (existingValue == null ) {
142129 return span ;
143130 }
@@ -154,7 +141,7 @@ private static SpanData processDeleteAction(SpanData span, ProcessorAction actio
154141
155142 private static SpanData procesHashAction (SpanData span , ProcessorAction actionObj ) {
156143 // Currently we only support String
157- String existingValue = getAttribute ( span .getAttributes (), actionObj .key );
144+ String existingValue = span .getAttributes (). get ( actionObj .key );
158145 if (existingValue == null ) {
159146 return span ;
160147 }
@@ -165,7 +152,7 @@ private static SpanData procesHashAction(SpanData span, ProcessorAction actionOb
165152
166153 private static SpanData processExtractAction (SpanData span , ProcessorAction actionObj ) {
167154 // Currently we only support String
168- String existingValue = getAttribute ( span .getAttributes (), actionObj .key );
155+ String existingValue = span .getAttributes (). get ( actionObj .key );
169156 if (existingValue == null ) {
170157 return span ;
171158 }
0 commit comments