@@ -94,6 +94,50 @@ This property makes it possible to:
9494- deploy a new SDK shared library 
9595- keep the application unchanged 
9696
97+ ### Case study, using Factory and shared gRPC client between OTLP gRPC exporters 
98+ 
99+ To reduce the cost of gRPC, the SDK allow users to share gRPC clients between 
100+ OTLP gRPC exporters when these exporters have the same settings. This can be 
101+ used as follows from the application code: 
102+ 
103+ ```cpp 
104+ // Include following headers 
105+ #include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" 
106+ #include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h" 
107+ #include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" 
108+ #include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h" 
109+ #include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_options.h" 
110+ 
111+ // Create exporters with shared gRPC Client 
112+ namespace otlp = opentelemetry::exporter::otlp; 
113+ 
114+ void SetupOtlp() { 
115+   otlp::OtlpGrpcClientOptions client_opts; 
116+   otlp::OtlpGrpcExporterOptions trace_opts; 
117+   otlp::OtlpGrpcLogRecordExporterOptions log_opts; 
118+ 
119+   // Setting client_opts, trace_opts and log_opts 
120+   // client_opts.endpoint = "localhost:1234"; 
121+   // Or we can use client_opts = trace_opts; to copy options from environment of 
122+   // trace OTLP exporter. 
123+ 
124+   std::shared_ptr<otlp::OtlpGrpcClient> shared_client = 
125+     otlp::OtlpGrpcClientFactory::Create(client_opts); 
126+ 
127+   // Create exporters 
128+   auto trace_exporter = 
129+     otlp::OtlpGrpcExporterFactory::Create(trace_opts, shared_client); 
130+   auto log_exporter = 
131+     otlp::OtlpGrpcLogRecordExporterFactory::Create(log_opts, shared_client); 
132+ 
133+   // Other initialization codes ... 
134+ } 
135+ ``` 
136+ 
137+ Be careful, create OTLP exporters with an existing ` OtlpGrpcClient `  will ignore
138+ the options of gRPC when passing the ` OtlpGrpcExporterOptions `  or other option
139+ object.
140+ 
97141## SDK extension  
98142
99143Applications owners who want to extend existing SDK classes are expected
0 commit comments