Loupe - Log - Monitor - Resolve
Gibraltar.Agent.Metrics Namespace / SampledMetricDefinition Class / WriteSample Method / WriteSample(Object,String) Method
A data object to sample, compatible with the binding type of this definition.
The instance name to fall back on if this definition does not specify an instance name binding (may be null).

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

    Parameters

    metricData
    A data object to sample, compatible with the binding type of this definition.
    fallbackInstanceName
    The instance name to fall back on if this definition does not specify an instance name binding (may be null).
    Exceptions
    ExceptionDescription
    The provided metricData object is null
    This sampled metric definition is not bound to sample automatically from a user data object. A different overload must be used to specify the data value(s) directly.
    - or -
    The provided user data object type is not assignable to this sampled 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 SampledMetric and SampledMetricValue 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 SampledMetricInstanceName attribute. If none is bound, the instance name parameter will be used as a fall-back. The determined metric instance will be created if it does not already exist.

    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