

# Metric

A usage metric definition for an app. Metrics aggregate raw usage events (by event type) into a metered quantity used for quota enforcement and usage-based billing.

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

 ** appId **   <a name="appmonetization-Type-Metric-appId"></a>
The ID of the app the metric belongs to.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[A-Za-z0-9_-]+`   
Required: Yes

 ** definition **   <a name="appmonetization-Type-Metric-definition"></a>
The aggregation definition: filters, aggregation function, grouping, and period.  
Type: [MetricDefinition](API_MetricDefinition.md) object  
Required: Yes

 ** description **   <a name="appmonetization-Type-Metric-description"></a>
A description of what the metric measures.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 512.  
Required: Yes

 ** eventType **   <a name="appmonetization-Type-Metric-eventType"></a>
The event type this metric aggregates.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[a-z][a-z0-9_.]{0,63}`   
Required: Yes

 ** metricId **   <a name="appmonetization-Type-Metric-metricId"></a>
The ID of the metric. We assign this value when you create the metric; it is unique within the app. Treat it as opaque.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[A-Za-z0-9_-]+`   
Required: Yes

 ** name **   <a name="appmonetization-Type-Metric-name"></a>
A human-readable display name for the metric.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `\s*\S[\s\S]*`   
Required: Yes

 ** unitName **   <a name="appmonetization-Type-Metric-unitName"></a>
The unit of measure for the metric.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[a-z][a-z0-9_]*`   
Required: Yes

 ** arn **   <a name="appmonetization-Type-Metric-arn"></a>
The Amazon Resource Name (ARN) of the metric. Output only.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.  
Pattern: `arn:(aws|aws-cn|aws-us-gov):.+:.+:.+:.+`   
Required: No

 ** stage **   <a name="appmonetization-Type-Metric-stage"></a>
The offering stage this metric was read from: DRAFT or PUBLISHED. Present on metric reads; absent on write responses.  
Type: String  
Valid Values: `DRAFT | PUBLISHED`   
Required: No

## See Also
<a name="API_Metric_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/Metric) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/appmonetization-2022-07-26/Metric) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/appmonetization-2022-07-26/Metric) 