Fundamentals

In this section you will find information on App Metrics fundamentals like how to define and record application metrics. For a quick start on App Metrics usage, first see the Getting Started Guide, then review the following documentation sections.

    Configuration

    App Metrics provides access to configuration options via the MetricsBuilder. These configuration options include: Property Description DefaultContextLabel Metrics recorded through the IMetrics interface are grouped into “Contexts”, for example a database context or application context. Metrics names should be unique per context. If no context label is presented when recording a metric. This value can be changed through the DefaultContextLabel option, default is “Application”.

    Defining & Recording

    Defining Metrics App Metrics provides an IMetrics used to record application metrics. An instance of IMetrics can be built using the MetricsBuilder and is intended to be used as single instance. Each metric being measured is defined via one the available metric types and only needs to be defined once using a static class. The following is an example of how you could define your custom metrics: public static class MyMetricsRegistry { public static GaugeOptions Errors => new GaugeOptions { Name = "Errors" }; public static CounterOptions SampleCounter => new CounterOptions { Name = "Sample Counter", MeasurementUnit = Unit.

    Tagging & Organizing