Loupe - Log - Monitor - Resolve
Gibraltar.Agent.Metrics Namespace / EventMetricDefinition Class / Register Method / Register(EventMetricDefinition,EventMetricValueDefinition) Method
A reference to an event metric definition template to be registered, and to receive the official registered event metric definition.
The definition of a value column in this event metric definition to designate as the default one to graph for this metric.

In This Topic
    Register(EventMetricDefinition,EventMetricValueDefinition) 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, _
       ByVal defaultValue As EventMetricValueDefinition _
    ) 

    Parameters

    newDefinition
    A reference to an event metric definition template to be registered, and to receive the official registered event metric definition.
    defaultValue
    The definition of a value column in this event metric definition to designate as the default one to graph for this metric.
    Exceptions
    ExceptionDescription
    A null newDefinition was provided.
    A defaultValue was provided but it is not from the provided EventMetricDefinition
    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.

    This overload allows an EventMetricValueDefinition to be designated as the default value column to graph for this event metric. When adding value columns to the definition template, the EventMetricValueDefinition returned by one of them can be saved to pass in this overload, for convenience. The defaultValue parameter will overwrite any previous setting of the DefaultValue property of the event metric definition template. If the completed template is not ultimately used because a metric definition already exists with the same 3-part Key, then the defaultValue parameter will have no effect; a metric definition which is already registered can not be altered, to ensure consistency within the session log.

    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