Skip to content

batch_create_rum_metric_definitions async

batch_create_rum_metric_definitions(
    app_monitor_name: AppMonitorName,
    destination: MetricDestination,
    metric_definitions: MetricDefinitionsRequest,
    *,
    config_overrides: Optional[AsyncRUMClientConfig] = None,
    destination_arn: Optional[DestinationArn] = None,
) -> BatchCreateRumMetricDefinitionsResponse

Specifies the extended metrics and custom metrics that you want a CloudWatch RUM app monitor to send to a destination. Valid destinations include CloudWatch and Evidently.

By default, RUM app monitors send some metrics to CloudWatch. These default metrics are listed in CloudWatch metrics that you can collect with CloudWatch RUM.

In addition to these default metrics, you can choose to send extended metrics, custom metrics, or both.

  • Extended metrics let you send metrics with additional dimensions that aren't included in the default metrics. You can also send extended metrics to both Evidently and CloudWatch. The valid dimension names for the additional dimensions for extended metrics are BrowserName, CountryCode, DeviceType, FileType, OSName, and PageId. For more information, see Extended metrics that you can send to CloudWatch and CloudWatch Evidently.

  • Custom metrics are metrics that you define. You can send custom metrics to CloudWatch. CloudWatch Evidently, or both. With custom metrics, you can use any metric name and namespace. To derive the metrics, you can use any custom events, built-in events, custom attributes, or default attributes.

    You can't send custom metrics to the AWS/RUM namespace. You must send custom metrics to a custom namespace that you define. The namespace that you use can't start with AWS/. CloudWatch RUM prepends RUM/CustomMetrics/ to the custom namespace that you define, so the final namespace for your metrics in CloudWatch is RUM/CustomMetrics/your-custom-namespace .

The maximum number of metric definitions that you can specify in one BatchCreateRumMetricDefinitions operation is 200.

The maximum number of metric definitions that one destination can contain is 2000.

Extended metrics sent to CloudWatch and RUM custom metrics are charged as CloudWatch custom metrics. Each combination of additional dimension name and dimension value counts as a custom metric. For more information, see Amazon CloudWatch Pricing.

You must have already created a destination for the metrics before you send them. For more information, see PutRumMetricsDestination.

If some metric definitions specified in a BatchCreateRumMetricDefinitions operations are not valid, those metric definitions fail and return errors, but all valid metric definitions in the same operation still succeed.

Parameters:

  • app_monitor_name (AppMonitorName) –

    The name of the CloudWatch RUM app monitor that is to send the metrics.

  • destination (MetricDestination) –

    The destination to send the metrics to. Valid values are CloudWatch and Evidently. If you specify Evidently, you must also specify the Amazon Resource Name (ARN) of the CloudWatchEvidently experiment that will receive the metrics and an IAM role that has permission to write to the experiment.

  • destination_arn (Optional[DestinationArn], default: None ) –

    This parameter is required if Destination is Evidently. If Destination is CloudWatch, do not use this parameter.

    This parameter specifies the ARN of the Evidently experiment that is to receive the metrics. You must have already defined this experiment as a valid destination. For more information, see PutRumMetricsDestination.

  • metric_definitions (MetricDefinitionsRequest) –

    An array of structures which define the metrics that you want to send.

Raises:

Source code in docs_src/capo_rum/_services/async_rum.py
async def batch_create_rum_metric_definitions(
    self,
    app_monitor_name: "capo_rum.types.app_monitor_name.AppMonitorName",
    destination: "capo_rum.types.metric_destination.MetricDestination",
    metric_definitions: "capo_rum.types.metric_definitions_request.MetricDefinitionsRequest",
    *,
    config_overrides: Optional[AsyncRUMClientConfig] = None,
    destination_arn: Optional[
        "capo_rum.types.destination_arn.DestinationArn"
    ] = None,
) -> "capo_rum.types.batch_create_rum_metric_definitions_response.BatchCreateRumMetricDefinitionsResponse":
    """<p>Specifies the extended metrics and custom metrics that you want a CloudWatch RUM app monitor to send to a destination. Valid destinations include CloudWatch and Evidently.</p> <p>By default, RUM app monitors send some metrics to CloudWatch. These default metrics are listed in <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-metrics.html">CloudWatch metrics that you can collect with CloudWatch RUM</a>.</p> <p>In addition to these default metrics, you can choose to send extended metrics, custom metrics, or both.</p> <ul> <li> <p>Extended metrics let you send metrics with additional dimensions that aren't included in the default metrics. You can also send extended metrics to both Evidently and CloudWatch. The valid dimension names for the additional dimensions for extended metrics are <code>BrowserName</code>, <code>CountryCode</code>, <code>DeviceType</code>, <code>FileType</code>, <code>OSName</code>, and <code>PageId</code>. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-vended-metrics.html"> Extended metrics that you can send to CloudWatch and CloudWatch Evidently</a>.</p> </li> <li> <p>Custom metrics are metrics that you define. You can send custom metrics to CloudWatch. CloudWatch Evidently, or both. With custom metrics, you can use any metric name and namespace. To derive the metrics, you can use any custom events, built-in events, custom attributes, or default attributes. </p> <p>You can't send custom metrics to the <code>AWS/RUM</code> namespace. You must send custom metrics to a custom namespace that you define. The namespace that you use can't start with <code>AWS/</code>. CloudWatch RUM prepends <code>RUM/CustomMetrics/</code> to the custom namespace that you define, so the final namespace for your metrics in CloudWatch is <code>RUM/CustomMetrics/<i>your-custom-namespace</i> </code>.</p> </li> </ul> <p>The maximum number of metric definitions that you can specify in one <code>BatchCreateRumMetricDefinitions</code> operation is 200.</p> <p>The maximum number of metric definitions that one destination can contain is 2000.</p> <p>Extended metrics sent to CloudWatch and RUM custom metrics are charged as CloudWatch custom metrics. Each combination of additional dimension name and dimension value counts as a custom metric. For more information, see <a href="https://aws.amazon.com/cloudwatch/pricing/">Amazon CloudWatch Pricing</a>.</p> <p>You must have already created a destination for the metrics before you send them. For more information, see <a href="https://docs.aws.amazon.com/cloudwatchrum/latest/APIReference/API_PutRumMetricsDestination.html">PutRumMetricsDestination</a>.</p> <p>If some metric definitions specified in a <code>BatchCreateRumMetricDefinitions</code> operations are not valid, those metric definitions fail and return errors, but all valid metric definitions in the same operation still succeed.</p>

    Args:
        app_monitor_name: <p>The name of the CloudWatch RUM app monitor that is to send the metrics.</p>
        destination: <p>The destination to send the metrics to. Valid values are <code>CloudWatch</code> and <code>Evidently</code>. If you specify <code>Evidently</code>, you must also specify the Amazon Resource Name (ARN) of the CloudWatchEvidently experiment that will receive the metrics and an IAM role that has permission to write to the experiment.</p>
        destination_arn: <p>This parameter is required if <code>Destination</code> is <code>Evidently</code>. If <code>Destination</code> is <code>CloudWatch</code>, do not use this parameter.</p> <p>This parameter specifies the ARN of the Evidently experiment that is to receive the metrics. You must have already defined this experiment as a valid destination. For more information, see <a href="https://docs.aws.amazon.com/cloudwatchrum/latest/APIReference/API_PutRumMetricsDestination.html">PutRumMetricsDestination</a>.</p>
        metric_definitions: <p>An array of structures which define the metrics that you want to send.</p>

    Raises:
        capo_rum.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permissions to perform this action.</p>
        capo_rum.errors.conflict_exception.ConflictException: <p>This operation attempted to create a resource that already exists.</p>
        capo_rum.errors.internal_server_exception.InternalServerException: <p>Internal service exception.</p>
        capo_rum.errors.resource_not_found_exception.ResourceNotFoundException: <p>Resource not found.</p>
        capo_rum.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This request exceeds a service quota.</p>
        capo_rum.errors.throttling_exception.ThrottlingException: <p>The request was throttled because of quota limits.</p>
        capo_rum.errors.validation_exception.ValidationException: <p>One of the arguments for the request is not valid.</p>
        capo_rum.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rum.types.batch_create_rum_metric_definitions_request.BatchCreateRumMetricDefinitionsRequest]",
    ) -> AsyncOperationResponse[
        "capo_rum.types.batch_create_rum_metric_definitions_response.BatchCreateRumMetricDefinitionsResponse"
    ]:
        import capo_rum._operations.rum.batch_create_rum_metric_definitions

        (
            output,
            http_response,
        ) = await capo_rum._operations.rum.batch_create_rum_metric_definitions.async_batch_create_rum_metric_definitions(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("BatchCreateRumMetricDefinitions")
    )
    input_: capo_rum.types.batch_create_rum_metric_definitions_request.BatchCreateRumMetricDefinitionsRequest = {
        "app_monitor_name": app_monitor_name,
        "destination": destination,
        "metric_definitions": metric_definitions,
    }
    if destination_arn is not None:
        input_["destination_arn"] = destination_arn

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output