File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
instrumentation/apache-dubbo-2.7/library-autoconfigure/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7 Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 88import io .opentelemetry .context .propagation .TextMapGetter ;
99import java .lang .reflect .Method ;
1010import java .util .Map ;
11+ import java .util .Set ;
1112import org .apache .dubbo .rpc .RpcInvocation ;
1213
1314enum DubboHeadersGetter implements TextMapGetter <DubboRequest > {
1415 INSTANCE ;
1516
1617 @ Override
17- @ SuppressWarnings ("unchecked" ) // unchecked for dubbo 2.7.6
18+ @ SuppressWarnings ("unchecked" ) // unchecked for 2.7.6, 2.7.7
1819 public Iterable <String > keys (DubboRequest request ) {
1920 RpcInvocation invocation = request .invocation ();
2021 Map <String , String > attachments = invocation .getAttachments ();
21- // in 2.7.6+, type of attachments is StringToObjectMap, it doesn't contain keySet method.
22- if ("ObjectToStringMap" .equals (attachments .getClass ().getSimpleName ())) {
22+ Set <String > keys = invocation .getAttachments ().keySet ();
23+ // In 2.7.6, 2.7.7, the StringToObjectMap implementation does not correctly retrieve the keySet.
24+ if (keys .size () == 0 && "ObjectToStringMap" .equals (attachments .getClass ().getSimpleName ())) {
2325 Method getObjectAttachmentsMethod = null ;
2426 try {
2527 getObjectAttachmentsMethod = invocation .getClass ().getMethod ("getObjectAttachments" );
@@ -28,7 +30,7 @@ public Iterable<String> keys(DubboRequest request) {
2830 // ignore
2931 }
3032 }
31- return invocation . getAttachments (). keySet () ;
33+ return keys ;
3234 }
3335
3436 @ Override
You can’t perform that action at this time.
0 commit comments