AppMonetization / Client / get_metric

get_metric

AppMonetization.Client.get_metric(**kwargs)

Returns the details of a metric.

See also: AWS API Documentation

Request Syntax

response = client.get_metric(
    appId='string',
    metricId='string',
    stage='DRAFT'|'PUBLISHED',
    scope='sandbox'|'live'
)
Parameters:
  • appId (string) –

    [REQUIRED]

    The ID of the app.

  • metricId (string) –

    [REQUIRED]

    The ID of the metric to retrieve.

  • stage (string) – The offering stage to read the metric from: DRAFT (the latest draft) or PUBLISHED (the offering customers see). Absent: PUBLISHED when scope=live, DRAFT when scope=sandbox.

  • scope (string) –

    [REQUIRED]

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

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

    • metric (dict) –

      The requested 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