@@ -199,26 +199,28 @@ private static string LoadVersion()
199199
200200 public sealed class Builder
201201 {
202- private ILoggerFactory _loggerFactory ;
203- private ISampler _sampler ;
204- private IReporter _reporter ;
205202 private PropagationRegistry _registry ;
206- private IMetrics _metrics = new MetricsImpl ( NoopMetricsFactory . Instance ) ;
207- private readonly string _serviceName ;
208- private IClock _clock = new SystemClock ( ) ;
209203 private readonly Dictionary < string , object > _tags = new Dictionary < string , object > ( ) ;
210- private bool _zipkinSharedRpcSpan ;
211- private IScopeManager _scopeManager = new AsyncLocalScopeManager ( ) ;
212- private IBaggageRestrictionManager _baggageRestrictionManager = new DefaultBaggageRestrictionManager ( ) ;
213- private bool _expandExceptionLogs ;
214- private bool _useTraceId128Bit ;
215204
216205 // We need the loggerFactory for the PropagationRegistry so we have to defer these invocations.
217206 private readonly List < Action < PropagationRegistry > > _registryActions = new List < Action < PropagationRegistry > > ( ) ;
218207
208+ public string ServiceName { get ; }
209+ public ILoggerFactory LoggerFactory { get ; private set ; }
210+ public IBaggageRestrictionManager BaggageRestrictionManager { get ; private set ; } = new DefaultBaggageRestrictionManager ( ) ;
211+ public IMetrics Metrics { get ; private set ; } = new MetricsImpl ( NoopMetricsFactory . Instance ) ;
212+ public bool ZipkinSharedRpcSpan { get ; private set ; }
213+ public ISampler Sampler { get ; private set ; }
214+ public IReporter Reporter { get ; private set ; }
215+ public IClock Clock { get ; private set ; } = new SystemClock ( ) ;
216+ public IScopeManager ScopeManager { get ; private set ; } = new AsyncLocalScopeManager ( ) ;
217+ public bool ExpandExceptionLogs { get ; private set ; }
218+ public bool UseTraceId128Bit { get ; private set ; }
219+ public IReadOnlyDictionary < string , object > Tags => _tags ;
220+
219221 public Builder ( string serviceName )
220222 {
221- _serviceName = CheckValidServiceName ( serviceName ) ;
223+ ServiceName = CheckValidServiceName ( serviceName ) ;
222224
223225 _registryActions . Add ( registry =>
224226 {
@@ -229,19 +231,19 @@ public Builder(string serviceName)
229231
230232 public Builder WithLoggerFactory ( ILoggerFactory loggerFactory )
231233 {
232- _loggerFactory = loggerFactory ;
234+ LoggerFactory = loggerFactory ;
233235 return this ;
234236 }
235237
236238 public Builder WithReporter ( IReporter reporter )
237239 {
238- _reporter = reporter ;
240+ Reporter = reporter ;
239241 return this ;
240242 }
241243
242244 public Builder WithSampler ( ISampler sampler )
243245 {
244- _sampler = sampler ;
246+ Sampler = sampler ;
245247 return this ;
246248 }
247249 public Builder RegisterInjector < TCarrier > ( IFormat < TCarrier > format , Injector < TCarrier > injector )
@@ -264,43 +266,43 @@ public Builder RegisterCodec<TCarrier>(IFormat<TCarrier> format, Codec<TCarrier>
264266
265267 public Builder WithMetrics ( IMetrics metrics )
266268 {
267- _metrics = metrics ;
269+ Metrics = metrics ;
268270 return this ;
269271 }
270272
271273 public Builder WithMetricsFactory ( IMetricsFactory factory )
272274 {
273- _metrics = new MetricsImpl ( factory ) ;
275+ Metrics = new MetricsImpl ( factory ) ;
274276 return this ;
275277 }
276278
277279 public Builder WithScopeManager ( IScopeManager scopeManager )
278280 {
279- _scopeManager = scopeManager ;
281+ ScopeManager = scopeManager ;
280282 return this ;
281283 }
282284
283285 public Builder WithClock ( IClock clock )
284286 {
285- _clock = clock ;
287+ Clock = clock ;
286288 return this ;
287289 }
288290
289291 public Builder WithZipkinSharedRpcSpan ( )
290292 {
291- _zipkinSharedRpcSpan = true ;
293+ ZipkinSharedRpcSpan = true ;
292294 return this ;
293295 }
294296
295297 public Builder WithExpandExceptionLogs ( )
296298 {
297- _expandExceptionLogs = true ;
299+ ExpandExceptionLogs = true ;
298300 return this ;
299301 }
300302
301303 public Builder WithTraceId128Bit ( )
302304 {
303- _useTraceId128Bit = true ;
305+ UseTraceId128Bit = true ;
304306 return this ;
305307 }
306308
@@ -342,45 +344,45 @@ public Builder WithTags(IEnumerable<KeyValuePair<string, string>> tags)
342344
343345 public Builder WithBaggageRestrictionManager ( IBaggageRestrictionManager baggageRestrictionManager )
344346 {
345- _baggageRestrictionManager = baggageRestrictionManager ;
347+ BaggageRestrictionManager = baggageRestrictionManager ;
346348 return this ;
347349 }
348350
349351 public Tracer Build ( )
350352 {
351- if ( _loggerFactory == null )
353+ if ( LoggerFactory == null )
352354 {
353- _loggerFactory = NullLoggerFactory . Instance ;
355+ LoggerFactory = NullLoggerFactory . Instance ;
354356 }
355357
356- _registry = new PropagationRegistry ( _loggerFactory ) ;
358+ _registry = new PropagationRegistry ( LoggerFactory ) ;
357359 foreach ( var configureRegistry in _registryActions )
358360 {
359361 configureRegistry ( _registry ) ;
360362 }
361363
362- if ( _metrics == null )
364+ if ( Metrics == null )
363365 {
364- _metrics = new MetricsImpl ( NoopMetricsFactory . Instance ) ;
366+ Metrics = new MetricsImpl ( NoopMetricsFactory . Instance ) ;
365367 }
366368
367- if ( _reporter == null )
369+ if ( Reporter == null )
368370 {
369- _reporter = new RemoteReporter . Builder ( )
370- . WithLoggerFactory ( _loggerFactory )
371- . WithMetrics ( _metrics )
371+ Reporter = new RemoteReporter . Builder ( )
372+ . WithLoggerFactory ( LoggerFactory )
373+ . WithMetrics ( Metrics )
372374 . Build ( ) ;
373375 }
374- if ( _sampler == null )
376+ if ( Sampler == null )
375377 {
376- _sampler = new RemoteControlledSampler . Builder ( _serviceName )
377- . WithLoggerFactory ( _loggerFactory )
378- . WithMetrics ( _metrics )
378+ Sampler = new RemoteControlledSampler . Builder ( ServiceName )
379+ . WithLoggerFactory ( LoggerFactory )
380+ . WithMetrics ( Metrics )
379381 . Build ( ) ;
380382 }
381383
382- return new Tracer ( _serviceName , _reporter , _sampler , _registry , _clock , _metrics , _loggerFactory ,
383- _tags , _zipkinSharedRpcSpan , _scopeManager , _baggageRestrictionManager , _expandExceptionLogs , _useTraceId128Bit ) ;
384+ return new Tracer ( ServiceName , Reporter , Sampler , _registry , Clock , Metrics , LoggerFactory ,
385+ _tags , ZipkinSharedRpcSpan , ScopeManager , BaggageRestrictionManager , ExpandExceptionLogs , UseTraceId128Bit ) ;
384386 }
385387
386388 public static String CheckValidServiceName ( String serviceName )
0 commit comments