

# MetricDefinition

The definition of how raw events are aggregated into a metric: which events to include (filters), how to combine them (function and functionField), how to group them, and over what period.

## Contents
<a name="API_MetricDefinition_Contents"></a>

 ** filters **   <a name="appmonetization-Type-MetricDefinition-filters"></a>
The predicates selecting which events contribute to the metric. Combined with logical AND.  
Type: Array of [MetricFilter](API_MetricFilter.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 10 items.  
Required: Yes

 ** function **   <a name="appmonetization-Type-MetricDefinition-function"></a>
The aggregation function applied to matching events (SUM, COUNT, or MAX).  
Type: String  
Valid Values: `SUM | COUNT | MAX`   
Required: Yes

 ** groupBy **   <a name="appmonetization-Type-MetricDefinition-groupBy"></a>
The event fields to group aggregated results by.  
Type: Array of strings  
Array Members: Minimum number of 0 items. Maximum number of 5 items.  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[a-z][a-z0-9_]*`   
Required: Yes

 ** period **   <a name="appmonetization-Type-MetricDefinition-period"></a>
The reset or rollup period for the aggregation.  
Type: String  
Valid Values: `MONTHLY`   
Required: Yes

 ** functionField **   <a name="appmonetization-Type-MetricDefinition-functionField"></a>
The event property key the aggregation function operates on. Required for SUM and MAX; ignored for COUNT.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[a-z][a-z0-9_]*`   
Required: No

## See Also
<a name="API_MetricDefinition_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/appmonetization-2022-07-26/MetricDefinition) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/appmonetization-2022-07-26/MetricDefinition) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/appmonetization-2022-07-26/MetricDefinition) 