Search Results for

    Show / Hide Table of Contents

    Interface IMetrics

    Interface for metrics operations.

    Namespace: AWS.Lambda.Powertools.Metrics
    Assembly: AWS.Lambda.Powertools.Metrics.dll
    Syntax
    public interface IMetrics

    Properties

    Options

    Gets the metrics options.

    Declaration
    MetricsOptions Options { get; }
    Property Value
    Type Description
    MetricsOptions

    The metrics options.

    Methods

    AddDimension(string, string)

    Adds a dimension to the collection.

    Declaration
    void AddDimension(string key, string value)
    Parameters
    Type Name Description
    string key

    The dimension key.

    string value

    The dimension value.

    AddMetadata(string, object)

    Adds metadata to the collection.

    Declaration
    void AddMetadata(string key, object value)
    Parameters
    Type Name Description
    string key

    The metadata key.

    object value

    The metadata value.

    AddMetric(string, double, MetricUnit, MetricResolution)

    Adds a metric to the collection.

    Declaration
    void AddMetric(string key, double value, MetricUnit unit = MetricUnit.None, MetricResolution resolution = MetricResolution.Default)
    Parameters
    Type Name Description
    string key

    The metric key.

    double value

    The metric value.

    MetricUnit unit

    The metric unit.

    MetricResolution resolution

    The metric resolution.

    CaptureColdStartMetric(ILambdaContext)

    Captures the cold start metric.

    Declaration
    void CaptureColdStartMetric(ILambdaContext context)
    Parameters
    Type Name Description
    ILambdaContext context

    ClearDefaultDimensions()

    Clears the default dimensions.

    Declaration
    void ClearDefaultDimensions()

    Flush(bool)

    Flushes the metrics.

    Declaration
    void Flush(bool metricsOverflow = false)
    Parameters
    Type Name Description
    bool metricsOverflow

    If set to true, indicates a metrics overflow.

    PushSingleMetric(string, double, MetricUnit, string, string, Dictionary<string, string>, MetricResolution)

    Pushes a single metric to the collection.

    Declaration
    void PushSingleMetric(string name, double value, MetricUnit unit, string nameSpace = null, string service = null, Dictionary<string, string> dimensions = null, MetricResolution resolution = MetricResolution.Default)
    Parameters
    Type Name Description
    string name

    The metric name.

    double value

    The metric value.

    MetricUnit unit

    The metric unit.

    string nameSpace

    The namespace.

    string service

    The service name.

    Dictionary<string, string> dimensions

    The default dimensions.

    MetricResolution resolution

    The metric resolution.

    SetCaptureColdStart(bool)

    Sets whether to capture cold start metrics.

    Declaration
    void SetCaptureColdStart(bool captureColdStart)
    Parameters
    Type Name Description
    bool captureColdStart

    If set to true, captures cold start metrics.

    SetDefaultDimensions(Dictionary<string, string>)

    Sets the default dimensions.

    Declaration
    void SetDefaultDimensions(Dictionary<string, string> defaultDimensions)
    Parameters
    Type Name Description
    Dictionary<string, string> defaultDimensions

    The default dimensions.

    SetFunctionName(string)

    Sets the function name.

    Declaration
    void SetFunctionName(string functionName)
    Parameters
    Type Name Description
    string functionName

    SetNamespace(string)

    Sets the namespace for the metrics.

    Declaration
    void SetNamespace(string nameSpace)
    Parameters
    Type Name Description
    string nameSpace

    The namespace.

    SetRaiseOnEmptyMetrics(bool)

    Sets whether to raise an event on empty metrics.

    Declaration
    void SetRaiseOnEmptyMetrics(bool raiseOnEmptyMetrics)
    Parameters
    Type Name Description
    bool raiseOnEmptyMetrics

    If set to true, raises an event on empty metrics.

    SetService(string)

    Sets the service name for the metrics.

    Declaration
    void SetService(string service)
    Parameters
    Type Name Description
    string service

    The service name.

    See Also

    IDisposable
    In this article
    Back to top Powertools for AWS Lambda (.NET) API Documentation