Loupe - Log - Monitor - Resolve
Gibraltar.Agent.Metrics Namespace / EventMetricDefinition Class / Register Method / Register(EventMetricDefinition) Method
A reference to an event metric definition template to be registered, and to receive the official registered event metric definition.

In This Topic
    Register(EventMetricDefinition) Method
    In This Topic
    Register the referenced EventMetricDefinition template, or update the reference to the official definition if a compatible event metric definition already exists for the same 3-part Key.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Sub Register( _
       ByRef newDefinition As EventMetricDefinition _
    ) 
    public static void Register( 
       ref EventMetricDefinition newDefinition
    )

    Parameters

    newDefinition
    A reference to an event metric definition template to be registered, and to receive the official registered event metric definition.
    Exceptions
    ExceptionDescription
    A null definition can not be registered nor used to look up a registered event metric definition.
    Remarks
    This is the final step for creating a new event metric definition programmatically, after constructing a new EventMetricDefinition(...) and calling AddValue(...) as desired to define value columns. If a metric definition is already registered with the same Key, it will be checked for compatibility. An incompatible existing definition (e.g. a sampled metric, or missing value columns from the provided template) will result in an ArgumentException to signal your programming mistake; each different metric definition in an application session must have a unique 3-part Key. If a compatible existing event metric definition is found, the reference to the EventMetricDefinition will be updated to the registered definition. If no metric definition exists with the same 3-part key as the template, then the new definition will be officially registered and may be used as a valid definition. This approach ensures thread-safe creation of singular event metric definitions without the need for locking by your code.
    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