Amazon Connect Service

2023/03/09 - Amazon Connect Service - 1 new api methods

Changes  This release adds a new API, GetMetricDataV2, which returns metric data for Amazon Connect.

GetMetricDataV2 (new) Link ΒΆ

Gets metric data from the specified Amazon Connect instance.

GetMetricDataV2 offers more features than GetMetricData, the previous version of this API. It has new metrics, offers filtering at a metric level, and offers the ability to filter and group data by channels, queues, routing profiles, agents, and agent hierarchy levels. It can retrieve historical data for last the 14 days, in 24-hour intervals.

For a description of the historical metrics that are supported by GetMetricDataV2 and GetMetricData, see Historical metrics definitions in the Amazon Connect Administrator's Guide.

This API is not available in the Amazon Web Services GovCloud (US) Regions.

See also: AWS API Documentation

Request Syntax

client.get_metric_data_v2(
    ResourceArn='string',
    StartTime=datetime(2015, 1, 1),
    EndTime=datetime(2015, 1, 1),
    Filters=[
        {
            'FilterKey': 'string',
            'FilterValues': [
                'string',
            ]
        },
    ],
    Groupings=[
        'string',
    ],
    Metrics=[
        {
            'Name': 'string',
            'Threshold': [
                {
                    'Comparison': 'string',
                    'ThresholdValue': 123.0
                },
            ],
            'MetricFilters': [
                {
                    'MetricFilterKey': 'string',
                    'MetricFilterValues': [
                        'string',
                    ]
                },
            ]
        },
    ],
    NextToken='string',
    MaxResults=123
)
type ResourceArn:

string

param ResourceArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the resource. This includes the instanceId an Amazon Connect instance.

type StartTime:

datetime

param StartTime:

[REQUIRED]

The timestamp, in UNIX Epoch time format, at which to start the reporting interval for the retrieval of historical metrics data. The time must be before the end time timestamp. The time range between the start and end time must be less than 24 hours. The start time cannot be earlier than 14 days before the time of the request. Historical metrics are available for 14 days.

type EndTime:

datetime

param EndTime:

[REQUIRED]

The timestamp, in UNIX Epoch time format, at which to end the reporting interval for the retrieval of historical metrics data. The time must be later than the start time timestamp.

The time range between the start and end time must be less than 24 hours.

type Filters:

list

param Filters:

[REQUIRED]

The filters to apply to returned metrics. You can filter on the following resources:

  • Queues

  • Routing profiles

  • Agents

  • Channels

  • User hierarchy groups

At least one filter must be passed from queues, routing profiles, agents, or user hierarchy groups.

To filter by phone number, see Create a historical metrics report in the Amazon Connect Administrator's Guide.

Note the following limits:

  • Filter keys: A maximum of 5 filter keys are supported in a single request. Valid filter keys: QUEUE | ROUTING_PROFILE | AGENT | CHANNEL | AGENT_HIERARCHY_LEVEL_ONE | AGENT_HIERARCHY_LEVEL_TWO | AGENT_HIERARCHY_LEVEL_THREE | AGENT_HIERARCHY_LEVEL_FOUR | AGENT_HIERARCHY_LEVEL_FIVE

  • Filter values: A maximum of 100 filter values are supported in a single request. For example, a GetMetricDataV2 request can filter by 50 queues, 35 agents, and 15 routing profiles for a total of 100 filter values. VOICE, CHAT, and TASK are valid filterValue for the CHANNEL filter key.

  • (dict) --

    Contains the filter to apply when retrieving metrics with the GetMetricDataV2 API.

    • FilterKey (string) --

      The key to use for filtering data. For example, QUEUE, ROUTING_PROFILE, AGENT, CHANNEL, AGENT_HIERARCHY_LEVEL_ONE, AGENT_HIERARCHY_LEVEL_TWO, AGENT_HIERARCHY_LEVEL_THREE, AGENT_HIERARCHY_LEVEL_FOUR, AGENT_HIERARCHY_LEVEL_FIVE. There must be at least 1 key and a maximum 5 keys.

    • FilterValues (list) --

      The identifiers to use for filtering data. For example, if you have a filter key of QUEUE, you would add queue IDs or ARNs in FilterValues.

      • (string) --

type Groupings:

list

param Groupings:

The grouping applied to the metrics that are returned. For example, when results are grouped by queue, the metrics returned are grouped by queue. The values that are returned apply to the metrics for each queue. They are not aggregated for all queues.

If no grouping is specified, a summary of all metrics is returned.

Valid grouping keys: QUEUE | ROUTING_PROFILE | AGENT | CHANNEL | AGENT_HIERARCHY_LEVEL_ONE | AGENT_HIERARCHY_LEVEL_TWO | AGENT_HIERARCHY_LEVEL_THREE | AGENT_HIERARCHY_LEVEL_FOUR | AGENT_HIERARCHY_LEVEL_FIVE

  • (string) --

type Metrics:

list

param Metrics:

[REQUIRED]

The metrics to retrieve. Specify the name, groupings, and filters for each metric. The following historical metrics are available. For a description of each metric, see Historical metrics definitions in the Amazon Connect Administrator's Guide.

AGENT_ADHERENT_TIME

This metric is available only in Amazon Web Services Regions where Forecasting, capacity planning, and scheduling is available.

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AGENT_NON_RESPONSE

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AGENT_OCCUPANCY

Unit: Percentage

Valid groupings and filters: Routing Profile, Agent, Agent Hierarchy

AGENT_SCHEDULE_ADHERENCE

This metric is available only in Amazon Web Services Regions where Forecasting, capacity planning, and scheduling is available.

Unit: Percent

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AGENT_SCHEDULED_TIME

This metric is available only in Amazon Web Services Regions where Forecasting, capacity planning, and scheduling is available.

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AVG_ABANDON_TIME

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AVG_AFTER_CONTACT_WORK_TIME

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AVG_AGENT_CONNECTING_TIME

Unit: Seconds

Valid metric filter key: INITIATION_METHOD. For now, this metric only supports the following as INITIATION_METHOD: INBOUND | OUTBOUND | CALLBACK | API

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AVG_HANDLE_TIME

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AVG_HOLD_TIME

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AVG_INTERACTION_AND_HOLD_TIME

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

AVG_INTERACTION_TIME

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile

AVG_QUEUE_ANSWER_TIME

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile

CONTACTS_ABANDONED

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

CONTACTS_CREATED

Unit: Count

Valid metric filter key: INITIATION_METHOD

Valid groupings and filters: Queue, Channel, Routing Profile

CONTACTS_HANDLED

Unit: Count

Valid metric filter key: INITIATION_METHOD, DISCONNECT_REASON

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

CONTACTS_HOLD_ABANDONS

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

CONTACTS_QUEUED

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

CONTACTS_TRANSFERRED_OUT

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

CONTACTS_TRANSFERRED_OUT_BY_AGENT

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

CONTACTS_TRANSFERRED_OUT_FROM_QUEUE

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

MAX_QUEUED_TIME

Unit: Seconds

Valid groupings and filters: Queue, Channel, Routing Profile, Agent, Agent Hierarchy

SERVICE_LEVEL

You can include up to 20 SERVICE_LEVEL metrics in a request.

Unit: Percent

Valid groupings and filters: Queue, Channel, Routing Profile

Threshold: For ThresholdValue, enter any whole number from 1 to 604800 (inclusive), in seconds. For Comparison, you must enter LT (for "Less than").

SUM_CONTACTS_ANSWERED_IN_X

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile

SUM_CONTACTS_ABANDONED_IN_X

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile

SUM_CONTACTS_DISCONNECTED

Valid metric filter key: DISCONNECT_REASON

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile

SUM_RETRY_CALLBACK_ATTEMPTS

Unit: Count

Valid groupings and filters: Queue, Channel, Routing Profile

  • (dict) --

    Contains information about the metric.

    • Name (string) --

      The name of the metric.

    • Threshold (list) --

      Contains information about the threshold for service level metrics.

      • (dict) --

        Contains information about the threshold for service level metrics.

        • Comparison (string) --

          The type of comparison. Only "less than" (LT) comparisons are supported.

        • ThresholdValue (float) --

          The threshold value to compare.

    • MetricFilters (list) --

      Contains the filters to be used when returning data.

      • (dict) --

        Contains information about the filter used when retrieving metrics. MetricFiltersV2 can be used on the following metrics: AVG_AGENT_CONNECTING_TIME, CONTACTS_CREATED, CONTACTS_HANDLED, SUM_CONTACTS_DISCONNECTED.

        • MetricFilterKey (string) --

          The key to use for filtering data.

          Valid metric filter keys: INITIATION_METHOD, DISCONNECT_REASON

        • MetricFilterValues (list) --

          The values to use for filtering data.

          Valid metric filter values for INITIATION_METHOD: INBOUND | OUTBOUND | TRANSFER | QUEUE_TRANSFER | CALLBACK | API

          Valid metric filter values for DISCONNECT_REASON: CUSTOMER_DISCONNECT | AGENT_DISCONNECT | THIRD_PARTY_DISCONNECT | TELECOM_PROBLEM | BARGED | CONTACT_FLOW_DISCONNECT | OTHER | EXPIRED | API

          • (string) --

type NextToken:

string

param NextToken:

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

type MaxResults:

integer

param MaxResults:

The maximum number of results to return per page.

rtype:

dict

returns:

Response Syntax

{
    'NextToken': 'string',
    'MetricResults': [
        {
            'Dimensions': {
                'string': 'string'
            },
            'Collections': [
                {
                    'Metric': {
                        'Name': 'string',
                        'Threshold': [
                            {
                                'Comparison': 'string',
                                'ThresholdValue': 123.0
                            },
                        ],
                        'MetricFilters': [
                            {
                                'MetricFilterKey': 'string',
                                'MetricFilterValues': [
                                    'string',
                                ]
                            },
                        ]
                    },
                    'Value': 123.0
                },
            ]
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      If there are additional results, this is the token for the next set of results.

    • MetricResults (list) --

      Information about the metrics requested in the API request If no grouping is specified, a summary of metric data is returned.

      • (dict) --

        Contains information about the metric results.

        • Dimensions (dict) --

          The dimension for the metrics.

          • (string) --

            • (string) --

        • Collections (list) --

          The set of metrics.

          • (dict) --

            Contains the name, thresholds, and metric filters.

            • Metric (dict) --

              The metric name, thresholds, and metric filters of the returned metric.

              • Name (string) --

                The name of the metric.

              • Threshold (list) --

                Contains information about the threshold for service level metrics.

                • (dict) --

                  Contains information about the threshold for service level metrics.

                  • Comparison (string) --

                    The type of comparison. Only "less than" (LT) comparisons are supported.

                  • ThresholdValue (float) --

                    The threshold value to compare.

              • MetricFilters (list) --

                Contains the filters to be used when returning data.

                • (dict) --

                  Contains information about the filter used when retrieving metrics. MetricFiltersV2 can be used on the following metrics: AVG_AGENT_CONNECTING_TIME, CONTACTS_CREATED, CONTACTS_HANDLED, SUM_CONTACTS_DISCONNECTED.

                  • MetricFilterKey (string) --

                    The key to use for filtering data.

                    Valid metric filter keys: INITIATION_METHOD, DISCONNECT_REASON

                  • MetricFilterValues (list) --

                    The values to use for filtering data.

                    Valid metric filter values for INITIATION_METHOD: INBOUND | OUTBOUND | TRANSFER | QUEUE_TRANSFER | CALLBACK | API

                    Valid metric filter values for DISCONNECT_REASON: CUSTOMER_DISCONNECT | AGENT_DISCONNECT | THIRD_PARTY_DISCONNECT | TELECOM_PROBLEM | BARGED | CONTACT_FLOW_DISCONNECT | OTHER | EXPIRED | API

                    • (string) --

            • Value (float) --

              The corresponding value of the metric returned in the response.