示例#1
0
        /// <summary>
        /// Adds a console provider to the factory
        /// </summary>
        /// <param name="factory">The factory to add the console provider to</param>
        /// <param name="name">The user friendly and unique name of the provider</param>
        /// <param name="reportingInterval">The number of seconds before each call to counters to report values</param>
        /// <param name="includeLabels">True if the labels should be prefixed</param>
        /// <returns>The metric factory</returns>
        public static IMetricFactory AddConsole(this IMetricFactory factory, string name, long reportingInterval, bool includeLabels)
        {
            factory.AddProvider(name, new ConsoleMetricsProvider(reportingInterval, includeLabels));

            return(factory);
        }
        /// <summary>
        /// Adds an Application Insights provider to the factory
        /// </summary>
        /// <param name="factory">The factory to add the application insights provider to</param>
        /// <param name="name">The user friendly and unique name of the provider</param>
        /// <param name="instrumentationKey">The application insights instrumentation key to write to</param>
        /// <param name="enrichmentProperties">The dictionary of properties that are to be used when enriching telemetry objects processed by this initializer</param>
        /// <returns>The metric factory</returns>
        public static IMetricFactory AddApplicationInsights(this IMetricFactory factory, string name, string instrumentationKey, Dictionary <string, string> enrichmentProperties = null)
        {
            factory.AddProvider(name, new ApplicationInsightsMetricsProvider(instrumentationKey, enrichmentProperties));

            return(factory);
        }
示例#3
0
        /// <summary>
        /// Adds a Prometheus provider to the factory
        /// </summary>
        /// <param name="factory">The factory to add the application insights provider to</param>
        /// <param name="name">The user friendly and unique name of the provider</param>
        /// <param name="hostName">The host name that will server the data</param>
        /// <param name="port">The port that the metrics server willb exposed on</param>
        /// <param name="url">The URL suffix the metrics server will be exposed on (default: metrics/)</param>
        /// <param name="bufferSize">The number of metrics in a bucket, use multiples of 500 for optimal performance</param>
        /// <param name="ageBuckets">The number of buckets to keep before aging out</param>
        /// <param name="pulseDuration">The duration in seconds of a pulse summary</param>
        public static IMetricFactory AddPrometheus(this IMetricFactory factory, string name, int port, string hostName = null, string url = "metrics/", int bufferSize = 1500, int ageBuckets = 5, int pulseDuration = 10)
        {
            factory.AddProvider(name, new PrometheusMetricsProvider(hostName, port, url, bufferSize, ageBuckets, pulseDuration));

            return(factory);
        }
示例#4
0
        /// <summary>
        /// Adds a callback provider to the factory
        /// </summary>
        /// <param name="factory">The factory to add the callback provider to</param>
        /// <param name="name">The user friendly and unique name of the provider</param>
        /// <param name="reportingInterval">The number of seconds before each call to counters to report values</param>
        /// <param name="singleValueWriter">The callback method that is invoked for single value writes</param>
        /// <param name="summaryWriter">The callback method that is invoked for summary data writes</param>
        /// <param name="userState">A user state object that consumers can provide that is meaningful to their callbacks</param>
        /// <returns>The metric factory</returns>
        public static IMetricFactory AddCallback(this IMetricFactory factory, string name, long reportingInterval, CallbackMetricsProvider.MetricWriterSingleValue singleValueWriter, CallbackMetricsProvider.MetricWriterSummary summaryWriter, object userState)
        {
            factory.AddProvider(name, new CallbackMetricsProvider(reportingInterval, singleValueWriter, summaryWriter, userState));

            return(factory);
        }