Show / Hide Table of Contents

    Interface IMonitor

    The Phobos monitor - used to create metrics which themselves can be incremented and transmitted to a reporting source on the other end of the network.

    Namespace:Phobos.Monitoring
    Assembly:Phobos.Monitoring.dll
    Syntax
    public interface IMonitor

    Properties

    AppName

    The beginning of the namespace we use to track metrics for this monitor. I.e. if AppName is "petabridge" then all metrics will be named "petabridge.thing1.metric1"

    Declaration
    string AppName { get; }
    Property Value
    Type Description
    System.String

    Recorder

    The underlying IMetricRecorder, usually only directly accessed for testing purposes.

    Declaration
    IMetricRecorder Recorder { get; }
    Property Value
    Type Description
    IMetricRecorder

    Methods

    CreateCounter(String, IReadOnlyList<String>, Double)

    Creates a new Counter instance.

    Declaration
    Counter CreateCounter(string name, IReadOnlyList<string> allNames, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the counter we're going to measure.

    System.Collections.Generic.IReadOnlyList<System.String> allNames

    The set of all names that we can use for this metric.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    Returns
    Type Description
    Counter

    The new counter instance.

    CreateCounter(String, Double)

    Creates a new Counter instance.

    Declaration
    Counter CreateCounter(string name, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the counter we're going to measure.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    Returns
    Type Description
    Counter

    The new counter instance.

    CreateGauge(String, IReadOnlyList<String>, Double)

    Creates a new Gauge instance.

    Declaration
    Gauge CreateGauge(string name, IReadOnlyList<string> allNames, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the gauge we're going to measure.

    System.Collections.Generic.IReadOnlyList<System.String> allNames

    The set of all names that we can use for this metric.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    Returns
    Type Description
    Gauge

    The new gauge instance.

    CreateGauge(String, Double)

    Creates a new Gauge instance.

    Declaration
    Gauge CreateGauge(string name, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the gauge we're going to measure.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    Returns
    Type Description
    Gauge

    The new gauge instance.

    CreateTiming(String, IReadOnlyList<String>, Double)

    Creates a new Timing instance.

    Declaration
    Timing CreateTiming(string name, IReadOnlyList<string> allNames, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the timing we're going to measure.

    System.Collections.Generic.IReadOnlyList<System.String> allNames

    The set of all names that we can use for this metric.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    Returns
    Type Description
    Timing

    The new timing instance.

    Examples

    using(myMonitor.StartTiming("foo")){ // actual work } // will automatically record a new "foo" Timing instance based on the values recorded.

    CreateTiming(String, Double)

    Creates a new Timing instance.

    Declaration
    Timing CreateTiming(string name, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the timing we're going to measure.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    Returns
    Type Description
    Timing

    The new timing instance.

    Examples

    using(myMonitor.StartTiming("foo")){ // actual work } // will automatically record a new "foo" Timing instance based on the values recorded.

    DecrementCounter(String, Int64, Double)

    Decrement a Counter directly without having to allocate one.

    Declaration
    void DecrementCounter(string name, long value = -1L, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the counter we're going to measure.

    System.Int64 value

    The value to be recorded for this counter. Defaults to -1.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    IncrementCounter(String, Int64, Double)

    Increment a Counter directly without having to allocate one.

    Declaration
    void IncrementCounter(string name, long value = 1L, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the counter we're going to measure.

    System.Int64 value

    The value to be recorded for this counter. Defaults to 1.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    RecordGauge(String, Int64, Double)

    Record to a Gauge directly without having to allocate one.

    Declaration
    void RecordGauge(string name, long value, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the gauge we're going to measure.

    System.Int64 value

    The value to be recorded for this gauge.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    RecordTiming(String, Int64, Double)

    Increment a Timing directly without having to allocate one.

    Declaration
    void RecordTiming(string name, long value, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the timing we're going to measure.

    System.Int64 value

    The value to be recorded for this timing.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    RecordTiming(String, TimeSpan, Double)

    Increment a Timing directly without having to allocate one.

    Declaration
    void RecordTiming(string name, TimeSpan value, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The specified name of the timing we're going to measure.

    System.TimeSpan value

    The value to be recorded for this timing.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    StartTiming(IReadOnlyList<String>, Double)

    Creates a TimingScope that can be used to automatically track and record a Timing upon disposal.

    Declaration
    TimingScope StartTiming(IReadOnlyList<string> allNames, double sampleRate = 1)
    Parameters
    Type Name Description
    System.Collections.Generic.IReadOnlyList<System.String> allNames

    The set of all names that we can use for this metric.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    Returns
    Type Description
    TimingScope

    A disposable TimingScope.

    StartTiming(String, Double)

    Creates a TimingScope that can be used to automatically track and record a Timing upon disposal.

    Declaration
    TimingScope StartTiming(string name, double sampleRate = 1)
    Parameters
    Type Name Description
    System.String name

    The name of this Timing.

    System.Double sampleRate

    The sample rate. Defaults to DefaultSampleRate.

    Returns
    Type Description
    TimingScope

    A disposable TimingScope.

    Back to top Copyright © 2015-2018 Petabridge®