Chat Support
Loupe - Log - Monitor - Resolve
Gibraltar.Agent.Metrics Namespace / EventMetricDefinition Class / EventMetricDefinition Constructor
The metrics capture system label.
The name of the category with which this definition is associated.
The name of the definition within the category.

In This Topic
    EventMetricDefinition Constructor
    In This Topic
    Create a new (empty) event metric definition, ready to have value columns defined for it (with AddValue()).
    Syntax
    'Declaration
     
    
    Public Function New( _
       ByVal metricsSystem As String, _
       ByVal categoryName As String, _
       ByVal counterName As String _
    )
    public EventMetricDefinition( 
       string metricsSystem,
       string categoryName,
       string counterName
    )

    Parameters

    metricsSystem
    The metrics capture system label.
    categoryName
    The name of the category with which this definition is associated.
    counterName
    The name of the definition within the category.
    Remarks

    In any session there should only be one metric definition with a given combination of metric type, category, and counter name (the three-part Key). These values together are used to correlate metrics between sessions and to distinguish all metrics from each other within a session. Collisions between incompatible metrics (different definitions) using the same three-part Key could result in run-time errors.

    After creating a new empty event metric definition, some number of value columns must be defined for it by calling newDefinition.AddValue(...). Once all desired columns have been added, the definition must be officially registered by calling newDefinition = newDefinition.Register(). The registration checks again that the 3-part Key is not already defined, and if it was, it returns the existing registration (or throws an exception if the existing registration is not compatible), so it is important to use the returned event metric definition rather than the one passed in. This is done for thread safety, in case two threads find the same event metric not yet defined and both try to create the definition; as long as they define the event metric the same way (for that same Key), they will both get the same completed definition returned, without errors. It is not necessary to save the return if the variable is not to be used further (e.g. going out of scope); the official definition can also be looked up separately later, without going through another new definition object.

    Event metric definitions can also be created by applying EventMetric and EventMetricValue attributes to a class, struct, or interface and registering that Type (or an object assignable to that type) using the static Register() method. The constructor is not used when using attribute-based metric definitions.

    Example
    See the EventMetric Class Overview for an example.
    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