AppMonetization / Client / list_metrics

list_metrics

AppMonetization.Client.list_metrics(**kwargs)

Returns the metrics for an app. Returns a paginated list; we recommend using pagination to ensure that the operation returns quickly and successfully.

See also: AWS API Documentation

Request Syntax

response = client.list_metrics(
    appId='string',
    stage='DRAFT'|'PUBLISHED',
    maxResults=123,
    nextToken='string',
    scope='sandbox'|'live'
)
Parameters:
  • appId (string) –

    [REQUIRED]

    The ID of the app.

  • stage (string) – The offering stage to list metrics from: DRAFT (the latest authored draft) or PUBLISHED (the published offering customers see). Absent: PUBLISHED when scope=live, DRAFT when scope=sandbox. A stage with nothing published lists as empty.

  • maxResults (integer) – The maximum number of items to return in a single page. Valid range is 1 to 100.

  • nextToken (string) – An opaque pagination token. Pass the value returned in a response back on the next request to retrieve the following page; absent when there are no more results.

  • scope (string) –

    [REQUIRED]

    Required. The environment: live or sandbox. live reads the published offering by default; sandbox reads the app’s draft (what the sandbox runs).

Return type:

dict

Returns:

Response Syntax

{
    'metrics': [
        {
            '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'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    Output for ListMetrics.

    • metrics (list) –

      A list of metrics.

      • (dict) –

        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.

        • 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.

    • nextToken (string) –

      An opaque pagination token. Pass the value returned in a response back on the next request to retrieve the following page; absent when there are no more results.

Exceptions

  • AppMonetization.Client.exceptions.AccessDeniedException

  • AppMonetization.Client.exceptions.ValidationException

  • AppMonetization.Client.exceptions.InternalServerException

  • AppMonetization.Client.exceptions.ResourceNotFoundException

  • AppMonetization.Client.exceptions.ThrottlingException