Skip to content

aws.connect.get_current_metric_data

Example SQL Queries

SELECT * FROM
aws.connect.get_current_metric_data
WHERE
"instance_id" = 'VALUE'
AND "filters" = 'VALUE'
AND "current_metrics" = 'VALUE';

Description

Gets the real-time metric data from the specified Amazon Connect instance.

For a description of each metric, see Real-time Metrics Definitions in the Amazon Connect Administrator Guide.

Table Definition

Column NameColumn Data Type
current_metrics Required Input Column

The metrics to retrieve. Specify the name and unit for each metric. The following metrics are available. For a description of all the metrics, see Real-time Metrics Definitions in the Amazon Connect Administrator Guide.

AGENTS_AFTER_CONTACT_WORK

Unit: COUNT

Name in real-time metrics report: ACW

AGENTS_AVAILABLE

Unit: COUNT

Name in real-time metrics report: Available

AGENTS_ERROR

Unit: COUNT

Name in real-time metrics report: Error

AGENTS_NON_PRODUCTIVE

Unit: COUNT

Name in real-time metrics report: NPT (Non-Productive Time)

AGENTS_ON_CALL

Unit: COUNT

Name in real-time metrics report: On contact

AGENTS_ON_CONTACT

Unit: COUNT

Name in real-time metrics report: On contact

AGENTS_ONLINE

Unit: COUNT

Name in real-time metrics report: Online

AGENTS_STAFFED

Unit: COUNT

Name in real-time metrics report: Staffed

CONTACTS_IN_QUEUE

Unit: COUNT

Name in real-time metrics report: In queue

CONTACTS_SCHEDULED

Unit: COUNT

Name in real-time metrics report: Scheduled

OLDEST_CONTACT_AGE

Unit: SECONDS

When you use groupings, Unit says SECONDS and the Value is returned in SECONDS.

When you do not use groupings, Unit says SECONDS but the Value is returned in MILLISECONDS. For example, if you get a response like this:

{ "Metric": { "Name": "OLDEST_CONTACT_AGE", "Unit": "SECONDS" }, "Value": 24113.0 }

The actual OLDEST_CONTACT_AGE is 24 seconds.

When the filter RoutingStepExpression is used, this metric is still calculated from enqueue time. For example, if a contact that has been queued under <Expression 1> for 10 seconds has expired and <Expression 2> becomes active, then OLDEST_CONTACT_AGE for this queue will be counted starting from 10, not 0.

Name in real-time metrics report: Oldest

SLOTS_ACTIVE

Unit: COUNT

Name in real-time metrics report: Active

SLOTS_AVAILABLE

Unit: COUNT

Name in real-time metrics report: Availability

STRUCT(
"name" VARCHAR,
"unit" VARCHAR
)[]
Show child fields
current_metrics[]
Show child fields
current_metrics[].name

The name of the metric.

current_metrics[].unit

The unit for the metric.

filters Required Input Column

The filters to apply to returned metrics. You can filter up to the following limits:

  • Queues: 100

  • Routing profiles: 100

  • Channels: 3 (VOICE, CHAT, and TASK channels are supported.)

  • RoutingStepExpressions: 50

Metric data is retrieved only for the resources associated with the queues or routing profiles, and by any channels included in the filter. (You cannot filter by both queue AND routing profile.) You can include both resource IDs and resource ARNs in the same request.

When using the RoutingStepExpression filter, you need to pass exactly one QueueId. The filter is also case sensitive so when using the RoutingStepExpression filter, grouping by ROUTING_STEP_EXPRESSION is required.

Currently tagging is only supported on the resources that are passed in the filter.

STRUCT(
"queues" VARCHAR[],
"channels" VARCHAR[],
"routing_profiles" VARCHAR[],
"routing_step_expressions" VARCHAR[]
)
Show child fields
filters.channels[]
filters.queues[]
filters.routing_profiles[]
filters.routing_step_expressions[]
instance_id Required Input Column

The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

VARCHAR
groupings Input Column

The grouping applied to the metrics returned. For example, when grouped by QUEUE, the metrics returned apply to each queue rather than aggregated for all queues.

  • If you group by CHANNEL, you should include a Channels filter. VOICE, CHAT, and TASK channels are supported.

  • If you group by ROUTING_PROFILE, you must include either a queue or routing profile filter. In addition, a routing profile filter is required for metrics CONTACTS_SCHEDULED, CONTACTS_IN_QUEUE, and OLDEST_CONTACT_AGE.

  • If no Grouping is included in the request, a summary of metrics is returned.

  • When using the RoutingStepExpression filter, group by ROUTING_STEP_EXPRESSION is required.

VARCHAR[]
Show child fields
groupings[]
max_results Input Column

The maximum number of results to return per page.

BIGINT
next_token Input Column

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

The token expires after 5 minutes from the time it is created. Subsequent requests that use the token must use the same request parameters as the request that generated the token.

VARCHAR
sort_criteria Input Column

The way to sort the resulting response based on metrics. You can enter one sort criteria. By default resources are sorted based on AGENTS_ONLINE, DESCENDING. The metric collection is sorted based on the input metrics.

Note the following:

  • Sorting on SLOTS_ACTIVE and SLOTS_AVAILABLE is not supported.

STRUCT(
"sort_by_metric" VARCHAR,
"sort_order" VARCHAR
)[]
Show child fields
sort_criteria[]
Show child fields
sort_criteria[].sort_by_metric

The current metric names.

sort_criteria[].sort_order

The way to sort.

_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
approximate_total_count

The total count of the result, regardless of the current page size.

BIGINT
data_snapshot_time

The time at which the metrics were retrieved and cached for pagination.

TIMESTAMP_S
metric_results

Information about the real-time metrics.

STRUCT(
"dimensions" STRUCT(
"queue" STRUCT(
"id" VARCHAR,
"arn" VARCHAR
),
"channel" VARCHAR,
"routing_profile" STRUCT(
"id" VARCHAR,
"arn" VARCHAR
),
"routing_step_expression" VARCHAR
),
"collections" STRUCT(
"metric" STRUCT(
"name" VARCHAR,
"unit" VARCHAR
),
"value" DOUBLE
)[]
)[]
Show child fields
metric_results[]
Show child fields
metric_results[].collections[]
Show child fields
metric_results[].collections[].metric

Information about the metric.

Show child fields
metric_results[].collections[].metric.name

The name of the metric.

metric_results[].collections[].metric.unit

The unit for the metric.

metric_results[].collections[].value

The value of the metric.

metric_results[].dimensions

The dimensions for the metrics.

Show child fields
metric_results[].dimensions.channel

The channel used for grouping and filters.

metric_results[].dimensions.queue

Information about the queue for which metrics are returned.

Show child fields
metric_results[].dimensions.queue.arn

The Amazon Resource Name (ARN) of the queue.

metric_results[].dimensions.queue.id

The identifier of the queue.

metric_results[].dimensions.routing_profile

Information about the routing profile assigned to the user.

Show child fields
metric_results[].dimensions.routing_profile.arn

The Amazon Resource Name (ARN) of the routing profile.

metric_results[].dimensions.routing_profile.id

The identifier of the routing profile.

metric_results[].dimensions.routing_step_expression

The expression of a step in a routing criteria.