public InterceptedServerHandler(ServerTracingConfiguration configuration, ServerCallContext context)
        {
            _configuration = configuration;
            _context       = context;

            var span = GetSpanFromContext();

            _logger = new GrpcTraceLogger <TRequest, TResponse>(span, configuration);
        }
        public InterceptedServerHandler(ServerTracingConfiguration configuration, ServerCallContext context)
        {
            _configuration = configuration;
            _context       = context;

            var span = GetSpanFromContext();

            _logger = new GrpcTraceLogger <TRequest, TResponse>(span, configuration);

            var scopeActions = new ScopeActions("new_request", _logger.BeginScope, _logger.EndScope);

            _streamActions = new TracingAsyncStreamReader <TRequest> .StreamActions(scopeActions, _logger.Request);
        }
Example #3
0
        public InterceptedClientHandler(ClientTracingConfiguration configuration, ClientInterceptorContext <TRequest, TResponse> context)
        {
            _configuration = configuration;
            _context       = context;
            if (context.Options.Headers == null)
            {
                _context = new ClientInterceptorContext <TRequest, TResponse>(context.Method, context.Host,
                                                                              context.Options.WithHeaders(new Metadata())); // Add empty metadata to options
            }

            var span = InitializeSpanWithHeaders();

            _logger = new GrpcTraceLogger <TRequest, TResponse>(span, configuration);
            _configuration.Tracer.Inject(span.Context, BuiltinFormats.HttpHeaders, new MetadataCarrier(_context.Options.Headers));
        }
        public InterceptedClientHandler(ClientTracingConfiguration configuration, ClientInterceptorContext <TRequest, TResponse> context)
        {
            _configuration = configuration;
            _context       = context;

            var callOptions = ApplyConfigToCallOptions(_context.Options);

            if (!Equals(callOptions, context.Options))
            {
                _context = new ClientInterceptorContext <TRequest, TResponse>(context.Method, context.Host, callOptions);
            }

            var span = InitializeSpanWithHeaders();

            _logger = new GrpcTraceLogger <TRequest, TResponse>(span, configuration);
            _configuration.Tracer.Inject(span.Context, BuiltinFormats.HttpHeaders, new MetadataCarrier(_context.Options.Headers));
        }
Example #5
0
        public InterceptedClientHandler(ClientTracingConfiguration configuration, ClientInterceptorContext <TRequest, TResponse> context)
        {
            _configuration = configuration;
            _context       = context;

            var callOptions = ApplyConfigToCallOptions(_context.Options);

            if (!Equals(callOptions, context.Options))
            {
                _context = new ClientInterceptorContext <TRequest, TResponse>(context.Method, context.Host, callOptions);
            }

            var span = InitializeSpanWithHeaders();

            _logger = new GrpcTraceLogger <TRequest, TResponse>(span, configuration);
            _configuration.Tracer.Inject(span.Context, BuiltinFormats.HttpHeaders, new MetadataCarrier(_context.Options.Headers));

            var scopeActions = new ScopeActions("new_response", _logger.BeginScope, _logger.EndScope);

            _streamActions = new TracingAsyncStreamReader <TResponse> .StreamActions(scopeActions, _logger.Response, _logger.FinishSuccess, _logger.FinishException);
        }