Beispiel #1
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      = ManagedTracer.CreateConsumer(client, options);
            _tracerFactory = ManagedTracer.CreateTracerFactory(projectId, _consumer, options);
        }
        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());
        }
 /// <inheritdoc />
 public TraceOptions CreateOptions()
 {
     return(TraceOptions.Create(_rateLimiter.CanTrace()));
 }
 /// <summary>
 /// Create a new <see cref="TraceHeaderTraceOptionsFactory"/> from a <see cref="TraceHeaderContext"/>
 /// </summary>
 public TraceOptions CreateOptions(TraceHeaderContext context)
 {
     GaxPreconditions.CheckNotNull(context, nameof(context));
     return(TraceOptions.Create(context.ShouldTrace));
 }