public static IAppBuilder UseApplicationInsights(
            this IAppBuilder builder,
            RequestTrackingConfiguration requestTrackingConfiguration          = null,
            OperationIdContextMiddlewareConfiguration operationIdConfiguration = null)
        {
            builder.Use <OperationIdContextMiddleware>(operationIdConfiguration);
            builder.Use <HttpRequestTrackingMiddleware>(requestTrackingConfiguration);

            return(builder);
        }
示例#2
0
        public HttpRequestTrackingMiddleware(
            OwinMiddleware next,
            RequestTrackingConfiguration configuration = null) : base(next)
        {
            _configuration = configuration ?? new RequestTrackingConfiguration();

            _client = _configuration.TelemetryConfiguration != null
                ? new TelemetryClient(_configuration.TelemetryConfiguration)
                : new TelemetryClient();
        }
示例#3
0
        public HttpRequestTrackingMiddleware(
            OwinMiddleware next,
            RequestTrackingConfiguration configuration = null) : base(next)
        {
            _configuration = configuration ?? new RequestTrackingConfiguration();

            _configuration.ShouldTrackRequest = _configuration.ShouldTrackRequest ?? (ctx => Task.FromResult(true));

            _configuration.GetAdditionalContextProperties = _configuration.GetAdditionalContextProperties ??
                                                            (ctx => Task.FromResult(Enumerable.Empty <KeyValuePair <string, string> >()));

            _client = _configuration.TelemetryConfiguration != null
                ? new TelemetryClient(_configuration.TelemetryConfiguration)
                : new TelemetryClient();
        }