- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1k
 
Add support for Nacos Client (#9961) #12849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Improved code formatting - Enhanced muzzle validation - Managed dependency versions
        
          
                ...elemetry/javaagent/instrumentation/nacos/client/v2_0_3/NacosClientInstrumentationModule.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...gent/instrumentation/nacos/client/v2_0_3/instrumentations/GrpcConnectionInstrumentation.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...gent/instrumentation/nacos/client/v2_0_3/instrumentations/GrpcConnectionInstrumentation.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| 
               | 
          ||
| package com.alibaba.nacos.common.remote.client; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually we place test classes in the same package as the instrumentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this because com.alibaba.nacos.common.remote.client.RpcClient#handleServerRequest is a protected method. Is there a better way to handle this here?
        
          
                ...ient-2.0.3/javaagent/src/test/java/com/alibaba/nacos/common/remote/client/RpcClientTest.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | @Target(TYPE) | ||
| @Retention(RUNTIME) | ||
| @Documented | ||
| public @interface DoNotMock { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class added here is to resolve a test compilation error in the nacos-client version 2.0.3 jar:
Compilation failed; see the compiler output below.
Error: Warning found, but specified -Werror
G:\temp.gradle\caches\modules-2\files-2.1\com.alibaba.nacos\nacos-client\2.0.3\a73c03b466a1f1565ee2b0e459c43046d6c8c15b\nacos-client-2.0.3.jar(/com/alibaba/nacos/shaded/com/google/common/util/concurrent/ListenableFuture.class): Warning: Unable to find class 'DoNotMock' annotation method 'value()': Can't find it com.alibaba.nacos.shaded.com.google.errorprone.annotations.DoNotMock class file.
This issue can be reproduced by removing the class file DoNotMock and then running ./gradlew :instrumentation:nacos-client-2.0.0:javaagent:test -PtestLatestDeps=true.
- Updated version to support Nacos client version 2.0.0 - Default the plugin to be disabled
        
          
                ...va/io/opentelemetry/javaagent/instrumentation/nacos/client/v2_0_0/NacosClientSingletons.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...ient-2.0.0/javaagent/src/test/java/com/alibaba/nacos/common/remote/client/RpcClientTest.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...ient-2.0.0/javaagent/src/test/java/com/alibaba/nacos/common/remote/client/RpcClientTest.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | assertNotNull(response); | ||
| assertTrue(response.isSuccess()); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in most of our tests, we use the assertThat() convention for consistency
| assertNotNull(response); | |
| assertTrue(response.isSuccess()); | |
| assertThat(response).isNotNull(); | |
| assertThat(response.isSuccess()).isTrue(); | 
| rpcClient.getClass().getName(), "handleServerRequest", request)); | ||
| }); | ||
| }); | ||
| testing.clearData(); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wouldn't expect these clearData() method calls to be needed. were they added due to some issue you encountered?
| versions.set("[2.0.0,)") | ||
| skip("0.5.0", "0.6.1", "1.1.2", "1.1.4", "1.4.7") | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have the versions.set() to only include versions 2.0.0 and above of the nacos-client module, so I wouldn't expect to need to skip anything below 2.x ?
| | [Micrometer](https://micrometer.io/) | 1.5+ (disabled by default) | [opentelemetry-micrometer-1.5](../instrumentation/micrometer/micrometer-1.5/library) | none | | ||
| | [MongoDB Driver](https://mongodb.github.io/mongo-java-driver/) | 3.1+ | [opentelemetry-mongo-3.1](../instrumentation/mongo/mongo-3.1/library) | [Database Client Spans], [Database Client Metrics] [6] | | ||
| | [MyBatis](https://mybatis.org/mybatis-3/) | 3.2+ | N/A | none | | ||
| | [Nacos Client](https://nacos.io/) | 2.0.0+ | N/A | none | | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you put a note in here that indicates it's disabled by default? similar to how Micrometer does it
…opentelemetry/javaagent/instrumentation/nacos/client/v2_0_0/NacosClientSingletons.java Co-authored-by: Jay DeLuca <[email protected]>
…/alibaba/nacos/common/remote/client/RpcClientTest.java Co-authored-by: Jay DeLuca <[email protected]>
…/alibaba/nacos/common/remote/client/RpcClientTest.java Co-authored-by: Jay DeLuca <[email protected]>
| 
           🔧 The result from spotlessApply was committed to the PR branch.  | 
    
Enhancement Methods
com.alibaba.nacos.common.remote.client.grpc.GrpcConnection#requestcom.alibaba.nacos.common.remote.client.RpcClient#handleServerRequestEnable Configuration
otel.instrumentation.nacos-client.enabledfalseSpan Info Details
nacos.group
nacos.service.name
Nacos/unsubscribeService
nacos.group
nacos.tenant
nacos.service.name