Skip to content
This repository has been archived by the owner on Jul 31, 2020. It is now read-only.

Latest commit

 

History

History
44 lines (25 loc) · 1.79 KB

File metadata and controls

44 lines (25 loc) · 1.79 KB

Filtering Metrics

Report Filtering

App Metrics allows you to filter Metrics per reporter.

Below is an example reporting configuration which provides a filter to a console reporter filtering Metrics containing a tag key of "filter-tag1" and are Counters

[!code-csharpMain]

Globally Filtering

Metrics can also be set at a global level which would apply to all Metric data queries.

Below is an example of how to apply a global filter in a Web Host.

[!code-csharpMain]

Requesting the /metrics endpoint with the above configuration would result in only Counter Metrics being shown in the response.

Overriding the Global Filter

In cases where a global filter is set as well as a filter on a reporter, the reporter's filter will be used instead.

It is also possible to override the global filter if you where to retrieve a snapshot of the current metrics data via the Advanced Metric contract.

[!code-csharpMain]

Supported Filtering

Metrics can be filtered by:

  • Metric Type
  • Tags
  • Context
  • Metric Name (Exact match or where name starts with)

Tip

Custom Metric Filters can be implemented rather than using the DefaultMetricsFilter by implementing IMetricsFilter.

Next Steps