Loupe - Log - Monitor - Resolve
Gibraltar.Agent.Metrics Namespace / SampledMetricAttribute Class
Members

In This Topic
    SampledMetricAttribute Class
    In This Topic
    Describes shared parameters for sampled metrics defined on the current object.
    Syntax
    'Declaration
     
    
    <AttributeUsageAttribute(AttributeTargets.Class Or  _
        AttributeTargets.Interface Or  _
        AttributeTargets.Struct, 
       AllowMultiple=False, 
       Inherited=False)>
    Public NotInheritable Class SampledMetricAttribute 
       Inherits System.Attribute
    [AttributeUsage(AttributeTargets.Class | 
        AttributeTargets.Interface | 
        AttributeTargets.Struct, 
       AllowMultiple=false, 
       Inherited=false)]
    public sealed class SampledMetricAttribute : System.Attribute 
    Remarks

    An object (class, struct, or interface) can be decorated with this attribute to describe how to define a group of sampled metrics among its direct members. Use the SampledMetricValue attribute on individual properties (etc) to complete the definition of various sampled metrics to be collected on this object. Any number of sampled metrics may be defined among the direct members (properties, fields, and zero-argument methods) of this object, but they will all share the metrics system and category name declared in this attribute. If sampling is performed for the entire group in one call, they will also share the same instance name (see SampledMetricInstanceName attribute and the instanceName argument of relevant API methods). The sampled metrics can also be sampled separately (with independent instance names) through their individual definitions instead of as a group on a specific class, struct, or interface type.

    This attribute may be used on other classes, structs, and interfaces even with the same metric namespace and category name, but each use of the SampledMetricValue attribute to define individual sampled metrics must use a counter name unique within the particular namespace and category name across all uses of the SampledMetric attribute (or other sampled metric definitions through API calls). Also, sampled metrics and event metrics may not overlap with the same counter name within a given namespace and category name. When sampling a particular object's sampled metrics as a group, only those sampled metrics defined with a SampledMetricValue attribute within the specific enclosing type (marked with a SampledMetric attribute) will be seen as part of the group to sample, not sampled metrics defined under different enclosing types even with the same namespace and category name.

    As with event metrics, multiple sampled metric groups (allowing different category names and instance names) can be combined on an object by defining them on separate interfaces. Such advanced tricks may require selection of a specific sampled metric group by type (e.g. by typeof a particular interface) in order to sample each possible sampled metric group as desired for that object. Selection of a definition by a specific type may also be required when sampling an inheritor object, to ensure that all desired sampled metrics are found and sampled.

    Inheritance Hierarchy

    System.Object
       System.Attribute
          Gibraltar.Agent.Metrics.SampledMetricAttribute

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also