private CloudTrace(string projectId, TraceConfiguration config = null, Task <TraceServiceClient> client = null)
        {
            GaxPreconditions.CheckNotNull(projectId, nameof(projectId));

            // Create the default values if not set.
            client = client ?? TraceServiceClient.CreateAsync();
            config = config ?? TraceConfiguration.Create();

            var consumer = ConsumerFactory <TraceProto> .GetConsumer(
                new GrpcTraceConsumer(client), MessageSizer <TraceProto> .GetSize, config.BufferOptions);

            _tracerFactory = new ManagedTracerFactory(projectId, consumer,
                                                      RateLimitingTraceOptionsFactory.Create(config), TraceIdFactory.Create());
        }
예제 #2
0
        private CloudTrace(string projectId, TraceConfiguration config = null, Task <TraceServiceClient> client = null)
        {
            _projectId = GaxPreconditions.CheckNotNull(projectId, nameof(projectId));

            // Create the default values if not set.
            client = client ?? TraceServiceClient.CreateAsync();
            config = config ?? TraceConfiguration.Create();

            _traceIdfactory = TraceIdFactory.Create();
            _consumer       = ConsumerFactory <TraceProto> .GetConsumer(
                new GrpcTraceConsumer(client), TraceSizer.Instance, config.BufferOptions);

            _rateFactory   = RateLimitingTraceOptionsFactory.Create(config);
            _headerFactory = TraceHeaderTraceOptionsFactory.Create();
        }
예제 #3
0
        private CloudTrace(string projectId, TraceConfiguration config      = null, TraceServiceClient client = null,
                           Func <HttpRequest, bool?> traceFallbackPredicate = null)
        {
            GaxPreconditions.CheckNotNull(projectId, nameof(projectId));

            // Create the default values if not set.
            client = client ?? TraceServiceClient.Create();
            config = config ?? TraceConfiguration.Create();

            _traceFallbackPredicate = traceFallbackPredicate;

            _consumer = ConsumerFactory <TraceProto> .GetConsumer(
                new GrpcTraceConsumer(client), MessageSizer <TraceProto> .GetSize, config.BufferOptions);

            _tracerFactory = new ManagedTracerFactory(projectId, _consumer,
                                                      RateLimitingTraceOptionsFactory.Create(config), TraceIdFactory.Create());
        }
 /// <summary>
 /// Create a new <see cref="RateLimitingTraceOptionsFactory"/>.
 /// </summary>
 /// <param name="config">Optional trace configuration, if unset the default will be used.</param>
 public static RateLimitingTraceOptionsFactory Create(TraceConfiguration config = null)
 {
     return(new RateLimitingTraceOptionsFactory(config ?? TraceConfiguration.Create()));
 }