Skip to main content

metrics

Creates, updates, deletes, gets or lists a metrics resource.

Overview

Namemetrics
TypeResource
Idaws.connect.metrics

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringThe Amazon Resource Name (ARN) of the metric. May be qualified with $SAVED or $LATEST.
categorystringThe category of the metric.
created_timestring (date-time)The timestamp of when the metric was created.
created_userobjectInformation on the identity that created the file.
creation_methodstringThe method used to create the metric. Valid values: SERVICE_LEVEL_BUILDER (created with the guided service-level experience) | METRIC_BUILDER (created with the free-form metric builder). (SERVICE_LEVEL_BUILDER, METRIC_BUILDER)
default_statstringThe default stat aggregation for the metric.
descriptionstringThe description of the metric.
effective_timestring (date-time)The earliest time that can be queried for this metric.
filtersarrayThe filters applied to the metric.
groupingsarrayThe groupings available for this metric.
idstringThe identifier of the metric.
last_modified_regionstringThe region where the metric was last modified. (pattern: <code>[a-z]{2}(-[a-z]+){1,2}(-[0-9])?</code>)
last_modified_timestring (date-time)The timestamp of when the metric was last modified.
last_modified_userobjectInformation on the identity that created the file.
metric_calculationobjectContains the formula and component metrics that define a custom metric calculation.
namestringThe name of the metric.
positive_trend_indicatorstringSpecifies how to interpret a positive trend in metric data. Valid values: POSITIVE | NEGATIVE | NEUTRAL. (POSITIVE, NEGATIVE, NEUTRAL)
primary_event_sourcestringThe primary event source for the metric data.
primary_event_source_effective_timestamp_typestringThe timestamp type that determines where the metric appears on a time series.
refresh_rateinteger (int64)The minimum interval, in seconds, between data refreshes for this metric.
statusstringThe publish status of a metric. Valid values: PUBLISHED | SAVED. (PUBLISHED, SAVED)
supported_statsarrayThe stat aggregations available for this metric.
supports_custom_calculationbooleanSpecifies whether the metric can be used as a component of custom metrics.
supports_preaggregate_calculationbooleanSpecifies whether the metric can be used inside aggregating statistical functions (SUM, AVG, etc.) in custom metric calculations.
tagsobjectThe tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.
typestringThe type of the metric. Valid values: AWS_MANAGED | CUSTOMER_MANAGED. (AWS_MANAGED, CUSTOMER_MANAGED)
unitstringThe display unit for metric data. Valid values: INTEGER | DOUBLE | PERCENT | SECONDS. (INTEGER, DOUBLE, PERCENT, SECONDS)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_metricselectinstance_id, metric_id, regionRetrieves the full definition of an existing metric from the specified Connect Customer instance.
list_metricsselectinstance_id, regiontype, maxResults, nextTokenRetrieves a paginated list of metric summaries for the specified Connect Customer instance. Use pagination to ensure that the operation returns quickly and successfully.
search_metricsselectregionSearches for metrics in the specified Connect Customer instance using search criteria and optional tag-based filters. Use pagination to ensure that the operation returns quickly and successfully.
create_metricinsertinstance_id, region, MetricCalculationCreates a new metric definition for the specified Connect Customer instance. You can create custom metrics that use formulas referencing existing Amazon Web Services-managed metrics, optionally with filters applied.
update_metric_contentupdateinstance_id, metric_id, regionUpdates the calculation, unit, and/or trend indicator of an existing metric in the specified Connect Customer instance.
delete_metricdeleteinstance_id, metric_id, regionDeletes an existing metric from the specified Connect Customer instance. This operation fails with ResourceConflictException if the metric is currently in use in a dashboard.
update_metric_metadataexecinstance_id, metric_id, regionUpdates the name and/or description of an existing metric in the specified Connect Customer instance.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
instance_idstringThe identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.
metric_idstringThe identifier of the metric to update. Adding the $SAVED qualifier will update the saved version of the metric. Adding $LATEST or omitting a qualifier will update the published version.
regionstringAWS region (default: us-east-1)
maxResultsintegerThe maximum number of results to return per page.
nextTokenstringThe 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.
typestringThe type of metrics to list. Valid values: AWS_MANAGED | CUSTOMER_MANAGED.

SELECT examples

Retrieves the full definition of an existing metric from the specified Connect Customer instance.

SELECT
arn,
category,
created_time,
created_user,
creation_method,
default_stat,
description,
effective_time,
filters,
groupings,
id,
last_modified_region,
last_modified_time,
last_modified_user,
metric_calculation,
name,
positive_trend_indicator,
primary_event_source,
primary_event_source_effective_timestamp_type,
refresh_rate,
status,
supported_stats,
supports_custom_calculation,
supports_preaggregate_calculation,
tags,
type,
unit
FROM aws.connect.metrics
WHERE instance_id = '{{ instance_id }}' -- required
AND metric_id = '{{ metric_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a new metric definition for the specified Connect Customer instance. You can create custom metrics that use formulas referencing existing Amazon Web Services-managed metrics, optionally with filters applied.

INSERT INTO aws.connect.metrics (
Name,
MetricCalculation,
Unit,
Status,
ClientToken,
Description,
PositiveTrendIndicator,
Tags,
instance_id,
region
)
SELECT
'{{ Name }}',
'{{ MetricCalculation }}' /* required */,
'{{ Unit }}',
'{{ Status }}',
'{{ ClientToken }}',
'{{ Description }}',
'{{ PositiveTrendIndicator }}',
'{{ Tags }}',
'{{ instance_id }}',
'{{ region }}'
RETURNING
metric_arn,
metric_id
;

UPDATE examples

Updates the calculation, unit, and/or trend indicator of an existing metric in the specified Connect Customer instance.

UPDATE aws.connect.metrics
SET
MetricCalculation = '{{ MetricCalculation }}',
Unit = '{{ Unit }}',
PositiveTrendIndicator = '{{ PositiveTrendIndicator }}'
WHERE
instance_id = '{{ instance_id }}' --required
AND metric_id = '{{ metric_id }}' --required
AND region = '{{ region }}' --required;

DELETE examples

Deletes an existing metric from the specified Connect Customer instance. This operation fails with ResourceConflictException if the metric is currently in use in a dashboard.

DELETE FROM aws.connect.metrics
WHERE instance_id = '{{ instance_id }}' --required
AND metric_id = '{{ metric_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Updates the name and/or description of an existing metric in the specified Connect Customer instance.

EXEC aws.connect.metrics.update_metric_metadata
@instance_id='{{ instance_id }}' --required,
@metric_id='{{ metric_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"Name": "{{ Name }}",
"Description": "{{ Description }}"
}'
;