Skip to content
ikopylov edited this page Dec 25, 2014 · 2 revisions

App.config section format

Sample App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="PerfCountersConfigurationSection" type="Qoollo.PerformanceCounters.Configuration.PerfCountersConfigurationSectionConfigClass, Qoollo.PerformanceCounters" allowExeDefinition="MachineToApplication" requirePermission="false"/>
  </configSections>

  <PerfCountersConfigurationSection xmlns="Qoollo.PerformanceCounters.Configuration.PerfCountersConfigurationSection_NS">
    <compositeCounters>
      <nullCounters />
      <internalCounters />
      <winCounters instantiationMode="UseExistedIfPossible" />
      <netCounters serverAddress="127.0.0.1" serverPort="26115" distributionPeriodMs="1000" />
      <graphiteCounters serverAddress="127.0.0.1" distributionPeriodMs="1000" />
    </compositeCounters>
  </PerfCountersConfigurationSection>
</configuration>

You can create counter factory from 'App.config':

var counterFactory = PerfCountersInstantiationFactory.CreateCounterFactoryFromAppConfig("PerfCountersConfigurationSection");

Configuration parameters

  • CompositeCounters - composition for other counter types:
    • WrappedCounters - list of child counters;
  • NullCounters - counters that not count;
  • InternalCounters - counters, which values are available only inside application;
  • WinCounter - Windows Performance Counter:
    • InstantiationMode - the way of creation categories in Windows (possible values: AlwaysCreateNew, UseExistedIfPossible, UseOnlyExisted);
    • CategoryNamePrefix - prefix in name for root category;
    • MachineName - machine name if you want to send values to remote computer;
    • IsReadOnlyCounters - is read only;
    • PreferedBitness - what type will be used for windows counters (Int32 or Int64);
    • ExistedInstancesTreatment - what to do with existed instances in multi-instance category (possible values: IgnoreExisted, LoadExisted, RemoveExisted);
  • NetCounters - distribute values to remote WCF service:
    • DistributionPeriodMs - distribution period;
    • ServerAddress - server address (ip address or host name);
    • ServerPort - server TCP port;
  • GraphiteCounters - distribute values to Graphite server:
    • DistributionPeriodMs - distribution period;
    • ServerAddress - server address;
    • ServerPort - server TCP port;
    • NamePrefixFormatString - prefix for counter name. Can contain substitution tokens: {MachineName}, {MachineAddress}, {ProcessName}, {ProcessId}.
Clone this wiki locally