AppMonetization / Client / update_metric
update_metric¶
- AppMonetization.Client.update_metric(**kwargs)¶
Updates an existing metric. Only a draft metric, one that has never been published, can be modified. After a metric is published, every field is frozen and any update is rejected with a ConflictException. To change a published metric, archive it and create a new metric.
See also: AWS API Documentation
Request Syntax
response = client.update_metric( appId='string', metricId='string', name='string', description='string', eventType='string', unitName='string', definition={ 'filters': [ { 'field': 'string', 'operator': 'EQUALS'|'NOT_EQUALS'|'IN'|'NOT_IN', 'values': [ 'string', ] }, ], 'function': 'SUM'|'COUNT'|'MAX', 'functionField': 'string', 'groupBy': [ 'string', ], 'period': 'MONTHLY' } )
- Parameters:
appId (string) –
[REQUIRED]
The ID of the app.
metricId (string) –
[REQUIRED]
The ID of the metric to update.
name (string) – A human-readable display name for the metric.
description (string) – A description of what the metric measures.
eventType (string) – The event type this metric aggregates.
unitName (string) – The unit of measure for the metric (for example, “requests”), in lowercase snake_case.
definition (dict) –
The aggregation definition: filters, aggregation function, grouping, and period.
filters (list) – [REQUIRED]
The predicates selecting which events contribute to the metric. Combined with logical AND.
(dict) –
A single predicate that selects which events contribute to a metric.
field (string) – [REQUIRED]
The event property key the filter is evaluated against.
operator (string) – [REQUIRED]
The comparison operator (EQUALS, NOT_EQUALS, IN, or NOT_IN).
values (list) – [REQUIRED]
The values the field is compared against.
(string) –
A value the field is compared against, 1-256 characters. Single quotes (’) and backslashes () are not allowed.
function (string) – [REQUIRED]
The aggregation function applied to matching events (SUM, COUNT, or MAX).
functionField (string) –
The event property key the aggregation function operates on. Required for SUM and MAX; ignored for COUNT.
groupBy (list) – [REQUIRED]
The event fields to group aggregated results by.
(string) –
Name of an event property key referenced by a metric filter or aggregation (filter field, functionField, groupBy). Lowercase snake_case, 1-64 characters: letters, digits, and underscores only, starting with a letter. Unlike PropertyKey, dots are not allowed, so a metric can’t reference a property whose key contains a dot.
period (string) – [REQUIRED]
The reset or rollup period for the aggregation.
- Return type:
dict
- Returns:
Response Syntax
{ 'metric': { 'appId': 'string', 'metricId': 'string', 'name': 'string', 'description': 'string', 'eventType': 'string', 'unitName': 'string', 'definition': { 'filters': [ { 'field': 'string', 'operator': 'EQUALS'|'NOT_EQUALS'|'IN'|'NOT_IN', 'values': [ 'string', ] }, ], 'function': 'SUM'|'COUNT'|'MAX', 'functionField': 'string', 'groupBy': [ 'string', ], 'period': 'MONTHLY' }, 'arn': 'string', 'stage': 'DRAFT'|'PUBLISHED' } }
Response Structure
(dict) –
Output for UpdateMetric.
metric (dict) –
The updated metric.
appId (string) –
The ID of the app the metric belongs to.
metricId (string) –
The ID of the metric. We assign this value when you create the metric; it is unique within the app. Treat it as opaque.
name (string) –
A human-readable display name for the metric.
description (string) –
A description of what the metric measures.
eventType (string) –
The event type this metric aggregates.
unitName (string) –
The unit of measure for the metric.
definition (dict) –
The aggregation definition: filters, aggregation function, grouping, and period.
filters (list) –
The predicates selecting which events contribute to the metric. Combined with logical AND.
(dict) –
A single predicate that selects which events contribute to a metric.
field (string) –
The event property key the filter is evaluated against.
operator (string) –
The comparison operator (EQUALS, NOT_EQUALS, IN, or NOT_IN).
values (list) –
The values the field is compared against.
(string) –
A value the field is compared against, 1-256 characters. Single quotes (’) and backslashes () are not allowed.
function (string) –
The aggregation function applied to matching events (SUM, COUNT, or MAX).
functionField (string) –
The event property key the aggregation function operates on. Required for SUM and MAX; ignored for COUNT.
groupBy (list) –
The event fields to group aggregated results by.
(string) –
Name of an event property key referenced by a metric filter or aggregation (filter field, functionField, groupBy). Lowercase snake_case, 1-64 characters: letters, digits, and underscores only, starting with a letter. Unlike PropertyKey, dots are not allowed, so a metric can’t reference a property whose key contains a dot.
period (string) –
The reset or rollup period for the aggregation.
arn (string) –
The Amazon Resource Name (ARN) of the metric. Output only.
stage (string) –
The offering stage this metric was read from: DRAFT or PUBLISHED. Present on metric reads; absent on write responses.
Exceptions
AppMonetization.Client.exceptions.AccessDeniedExceptionAppMonetization.Client.exceptions.ValidationExceptionAppMonetization.Client.exceptions.ConflictExceptionAppMonetization.Client.exceptions.InvalidConfigurationExceptionAppMonetization.Client.exceptions.InternalServerExceptionAppMonetization.Client.exceptions.ServiceQuotaExceededExceptionAppMonetization.Client.exceptions.ResourceNotFoundExceptionAppMonetization.Client.exceptions.RevisionConflictExceptionAppMonetization.Client.exceptions.ThrottlingException