public AppInsightsTelemetryProvider (TelemetryClient client,
			[ImportMany (typeof (IContextEnricher))] IEnumerable<IContextEnricher> contextEnrichers,
			[ImportMany (typeof (ITelemetryEnricher))] IEnumerable<ITelemetryEnricher> telemetryEnrichers,
			[Import("AppInsightsInitializer", typeof(IContextInitializer))] IContextInitializer contextInitializer,
			[Import ("AppInsightsTranslator", typeof (ITelemetryTranslator))] ITelemetryTranslator telemetryTranslator)
		{
			this.client = client;
			this.contextEnrichers = contextEnrichers;
			this.telemetryEnrichers = telemetryEnrichers;
			this.contextInitializer = contextInitializer;
			this.telemetryTranslator = telemetryTranslator;

			Initialize ();
		}
Exemplo n.º 2
0
        public AppInsightsTelemetryProvider(TelemetryClient client,
                                            [ImportMany(typeof(IContextEnricher))] IEnumerable <IContextEnricher> contextEnrichers,
                                            [ImportMany(typeof(ITelemetryEnricher))] IEnumerable <ITelemetryEnricher> telemetryEnrichers,
                                            [Import("AppInsightsInitializer", typeof(IContextInitializer))] IContextInitializer contextInitializer,
                                            [Import("AppInsightsTranslator", typeof(ITelemetryTranslator))] ITelemetryTranslator telemetryTranslator)
        {
            this.client              = client;
            this.contextEnrichers    = contextEnrichers;
            this.telemetryEnrichers  = telemetryEnrichers;
            this.contextInitializer  = contextInitializer;
            this.telemetryTranslator = telemetryTranslator;

            Initialize();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds a context initializer.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="initializer">The initializer.</param>
        /// <returns>
        /// The configuration for a fluent interface.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">If any arguments are null.</exception>
        public static TelemetryConfiguration InitializeContextWith(this TelemetryConfiguration configuration, IContextInitializer initializer)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            if (initializer == null)
            {
                throw new ArgumentNullException("initializer");
            }

            configuration.ContextInitializers.Add(initializer);

            return(configuration);
        }
Exemplo n.º 4
0
        private static bool IsInstanceFiltered(IContextInitializer instance, FilteredInitializerAttribute filter)
        {
            var attributes = instance.GetType().GetCustomAttributes(filter.GetType(), true);

            return(attributes.Cast <FilteredInitializerAttribute>().All(atr => atr.name != filter.name));
        }