コード例 #1
0
        public DefaultTelemetryFilter(ITelemetryProcessor next, IOptions <AnalyticsOptions> optionsAccessor)
        {
            this.Next           = next;
            this.Options        = optionsAccessor.Value;
            this.FilterFunction = (telemetry) =>
            {
                if (telemetry is RequestTelemetry requestTelemetry)
                {
                    if (Convert.ToString(requestTelemetry.Url).StartsWith(this.Options.EndPointAddress, StringComparison.OrdinalIgnoreCase))
                    {
                        return(false);
                    }
                }

                if (null != this.Options.Filter)
                {
                    return(this.Options.Filter.Invoke(telemetry));
                }

                return(true);
            };
        }
コード例 #2
0
 public AnalyticsBuilder(IServiceCollection services, AnalyticsOptions options)
 {
     this.Services = services;
     this.Options = options;
 }