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());
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
        private CloudTrace(string projectId, TraceOptions options        = null, TraceServiceClient client = null,
                           TraceDecisionPredicate traceFallbackPredicate = null)
        {
            GaxPreconditions.CheckNotNull(projectId, nameof(projectId));

            // Create the default values if not set.
            client  = client ?? TraceServiceClient.Create();
            options = options ?? TraceOptions.Create();
            _traceFallbackPredicate = traceFallbackPredicate ?? TraceDecisionPredicate.Default;

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

            _tracerFactory = new ManagedTracerFactory(projectId, _consumer,
                                                      RateLimitingTraceOptionsFactory.Create(options), TraceIdFactory.Create());
        }
Exemplo n.º 4
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());
        }