File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
opengemini-client/src/main/java/io/opengemini/client/impl Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 2121import io .opengemini .client .api .BatchConfig ;
2222import io .opengemini .client .api .Configuration ;
2323import io .opengemini .client .api .OpenGeminiException ;
24+ import io .opengemini .client .interceptor .Interceptor ;
25+ import io .opengemini .client .interceptor .OtelInterceptor ;
2426import org .jetbrains .annotations .NotNull ;
2527
28+ import java .util .List ;
29+
2630public class OpenGeminiClientFactory {
2731 public static OpenGeminiClient create (@ NotNull Configuration configuration ) throws OpenGeminiException {
2832 if (configuration .getAddresses () == null || configuration .getAddresses ().isEmpty ()) {
@@ -54,4 +58,13 @@ public static OpenGeminiClient create(@NotNull Configuration configuration) thro
5458 }
5559 return new OpenGeminiClient (configuration );
5660 }
61+
62+ public static OpenGeminiClient createClientWithInterceptors (Configuration config ) throws OpenGeminiException {
63+ OpenGeminiClient client = create (config );
64+ List <Interceptor > interceptors = List .of (
65+ new OtelInterceptor ()
66+ );
67+ client .addInterceptors (interceptors .toArray (new Interceptor [0 ]));
68+ return client ;
69+ }
5770}
You can’t perform that action at this time.
0 commit comments