Loupe - Log - Monitor - Resolve
Gibraltar.Agent.Metrics Namespace / EventMetricDefinition Class / WriteSample Method / WriteSample(Object) Method
A data object to sample, compatible with the binding type of this definition.

In This Topic
    WriteSample(Object) Method
    In This Topic
    Write a metric sample to an automatically-determined instance of this metric definition using the provided data object.
    Syntax
    'Declaration
     
    
    Public Overloads Sub WriteSample( _
       ByVal metricData As Object _
    ) 
    public void WriteSample( 
       object metricData
    )

    Parameters

    metricData
    A data object to sample, compatible with the binding type of this definition.
    Exceptions
    ExceptionDescription
    This event metric definition is not bound to sample automatically from a user data object. CreateSample() and SetValue() must be used to specify the data values directly.
    -or-
    The provided user data object is not assignable to this event metric's bound type and can not be sampled automatically for this metric definition.
    Remarks

    This overload may only be used if this metric definition was created by EventMetric and EventMetricValue attributes on a particular Type (class, struct, or interface), and only for userDataObjects of a type assignable to that bound type for this definition.

    The metric instance name will be obtained from the member which was marked with the EventMetricInstanceName attribute. If none is bound, the default instance will be used (a null instance name). The determined metric instance will be created if it does not already exist. See the overloads with an instanceName parameter to specify a particular metric instance name.

    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