Example #1
0
        /// <summary>
        /// Carga la configuración por defecto
        /// </summary>
        private static void LoadConfigurationFromDefaultConfiguration()
        {
            string defaultCategoryName        = "Alemana";
            string defaultCategoryDescription = "Contadores de Alemana";

            PerformanceCounterContainer.AddPerformanceCounterCategory(defaultCategoryName,
                                                                      defaultCategoryDescription, true,
                                                                      PerformanceCounterCategoryType.MultiInstance);
        }
Example #2
0
        /// <summary>
        /// Carga la configuración a partir de <paramref name="section"/>
        /// </summary>
        /// <param name="section">Sección de configuración del archivo de configuración</param>
        private static void LoadConfigurationFromConfigurationSection(
            InstrumentationSection section)
        {
            foreach (PerformanceCounterCategoryElement categoryElement in section.CategoryCollection)
            {
                PerformanceCounterContainer.AddPerformanceCounterCategory(categoryElement.Name,
                                                                          categoryElement.Description, categoryElement.IsActive, categoryElement.Type);

                foreach (PerformanceCounterElement counterElement in categoryElement.PerformanceCounterCollection)
                {
                    PerformanceCounterContainer.AddCounter(categoryElement.Name,
                                                           counterElement.Name, counterElement.Description, counterElement.Type);

                    foreach (PerformanceCounterInstanceElement instanceElement in counterElement.InstanceCollection)
                    {
                        PerformanceCounterContainer.AddCounterInstance(categoryElement.Name, counterElement.Name,
                                                                       instanceElement.Name, instanceElement.IsActive);
                    }
                }
            }
        }