Skip to content

create_app_monitor async

create_app_monitor(
    name: AppMonitorName,
    *,
    config_overrides: Optional[AsyncRUMClientConfig] = None,
    domain: Optional[AppMonitorDomain] = None,
    domain_list: Optional[AppMonitorDomainList] = None,
    tags: Optional[TagMap] = None,
    app_monitor_configuration: Optional[AppMonitorConfiguration] = None,
    cw_log_enabled: Optional[bool] = None,
    custom_events: Optional[CustomEvents] = None,
    deobfuscation_configuration: Optional[DeobfuscationConfiguration] = None,
    platform: Optional[AppMonitorPlatform] = None,
) -> CreateAppMonitorResponse

Creates a Amazon CloudWatch RUM app monitor, which collects telemetry data from your application and sends that data to RUM. The data includes performance and reliability information such as page load time, client-side errors, and user behavior.

You use this operation only to create a new app monitor. To update an existing app monitor, use UpdateAppMonitor instead.

After you create an app monitor, sign in to the CloudWatch RUM console to get the JavaScript code snippet to add to your web application. For more information, see How do I find a code snippet that I've already generated?

Parameters:

  • name (AppMonitorName) –

    A name for the app monitor.

  • domain (Optional[AppMonitorDomain], default: None ) –

    The top-level internet domain name for which your application has administrative authority.

  • domain_list (Optional[AppMonitorDomainList], default: None ) –

    List the domain names for which your application has administrative authority. The CreateAppMonitor requires either the domain or the domain list.

  • tags (Optional[TagMap], default: None ) –

    Assigns one or more tags (key-value pairs) to the app monitor.

    Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.

    Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.

    You can associate as many as 50 tags with an app monitor.

    For more information, see Tagging Amazon Web Services resources.

  • app_monitor_configuration (Optional[AppMonitorConfiguration], default: None ) –

    A structure that contains much of the configuration data for the app monitor. If you are using Amazon Cognito for authorization, you must include this structure in your request, and it must include the ID of the Amazon Cognito identity pool to use for authorization. If you don't include AppMonitorConfiguration, you must set up your own authorization method. For more information, see Authorize your application to send data to Amazon Web Services.

    If you omit this argument, the sample rate used for RUM is set to 10% of the user sessions.

  • cw_log_enabled (Optional[bool], default: None ) –

    Data collected by RUM is kept by RUM for 30 days and then deleted. This parameter specifies whether RUM sends a copy of this telemetry data to Amazon CloudWatch Logs in your account. This enables you to keep the telemetry data for more than 30 days, but it does incur Amazon CloudWatch Logs charges.

    If you omit this parameter, the default is false.

  • custom_events (Optional[CustomEvents], default: None ) –

    Specifies whether this app monitor allows the web client to define and send custom events. If you omit this parameter, custom events are DISABLED.

    For more information about custom events, see Send custom events.

  • deobfuscation_configuration (Optional[DeobfuscationConfiguration], default: None ) –

    A structure that contains the configuration for how an app monitor can deobfuscate stack traces.

  • platform (Optional[AppMonitorPlatform], default: None ) –

    The platform type for the app monitor. Valid values are Web for web applications, Android for Android applications, and iOS for IOS applications. If you omit this parameter, the default is Web.

Raises:

Source code in docs_src/capo_rum/_services/async_rum.py
async def create_app_monitor(
    self,
    name: "capo_rum.types.app_monitor_name.AppMonitorName",
    *,
    config_overrides: Optional[AsyncRUMClientConfig] = None,
    domain: Optional["capo_rum.types.app_monitor_domain.AppMonitorDomain"] = None,
    domain_list: Optional[
        "capo_rum.types.app_monitor_domain_list.AppMonitorDomainList"
    ] = None,
    tags: Optional["capo_rum.types.tag_map.TagMap"] = None,
    app_monitor_configuration: Optional[
        "capo_rum.types.app_monitor_configuration.AppMonitorConfiguration"
    ] = None,
    cw_log_enabled: Optional[bool] = None,
    custom_events: Optional["capo_rum.types.custom_events.CustomEvents"] = None,
    deobfuscation_configuration: Optional[
        "capo_rum.types.deobfuscation_configuration.DeobfuscationConfiguration"
    ] = None,
    platform: Optional[
        "capo_rum.types.app_monitor_platform.AppMonitorPlatform"
    ] = None,
) -> "capo_rum.types.create_app_monitor_response.CreateAppMonitorResponse":
    """<p>Creates a Amazon CloudWatch RUM app monitor, which collects telemetry data from your application and sends that data to RUM. The data includes performance and reliability information such as page load time, client-side errors, and user behavior.</p> <p>You use this operation only to create a new app monitor. To update an existing app monitor, use <a href="https://docs.aws.amazon.com/cloudwatchrum/latest/APIReference/API_UpdateAppMonitor.html">UpdateAppMonitor</a> instead.</p> <p>After you create an app monitor, sign in to the CloudWatch RUM console to get the JavaScript code snippet to add to your web application. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-find-code-snippet.html">How do I find a code snippet that I've already generated?</a> </p>

    Args:
        name: <p>A name for the app monitor.</p>
        domain: <p>The top-level internet domain name for which your application has administrative authority.</p>
        domain_list: <p> List the domain names for which your application has administrative authority. The <code>CreateAppMonitor</code> requires either the domain or the domain list. </p>
        tags: <p>Assigns one or more tags (key-value pairs) to the app monitor.</p> <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p> <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p> <p>You can associate as many as 50 tags with an app monitor.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a>.</p>
        app_monitor_configuration: <p>A structure that contains much of the configuration data for the app monitor. If you are using Amazon Cognito for authorization, you must include this structure in your request, and it must include the ID of the Amazon Cognito identity pool to use for authorization. If you don't include <code>AppMonitorConfiguration</code>, you must set up your own authorization method. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-get-started-authorization.html">Authorize your application to send data to Amazon Web Services</a>.</p> <p>If you omit this argument, the sample rate used for RUM is set to 10% of the user sessions.</p>
        cw_log_enabled: <p>Data collected by RUM is kept by RUM for 30 days and then deleted. This parameter specifies whether RUM sends a copy of this telemetry data to Amazon CloudWatch Logs in your account. This enables you to keep the telemetry data for more than 30 days, but it does incur Amazon CloudWatch Logs charges.</p> <p>If you omit this parameter, the default is <code>false</code>.</p>
        custom_events: <p>Specifies whether this app monitor allows the web client to define and send custom events. If you omit this parameter, custom events are <code>DISABLED</code>.</p> <p>For more information about custom events, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-custom-events.html">Send custom events</a>.</p>
        deobfuscation_configuration: <p> A structure that contains the configuration for how an app monitor can deobfuscate stack traces. </p>
        platform: <p>The platform type for the app monitor. Valid values are <code>Web</code> for web applications, <code>Android</code> for Android applications, and <code>iOS</code> for IOS applications. If you omit this parameter, the default is <code>Web</code>.</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.create_app_monitor_request.CreateAppMonitorRequest]",
    ) -> AsyncOperationResponse[
        "capo_rum.types.create_app_monitor_response.CreateAppMonitorResponse"
    ]:
        import capo_rum._operations.rum.create_app_monitor

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAppMonitor")
    )
    input_: capo_rum.types.create_app_monitor_request.CreateAppMonitorRequest = {
        "name": name
    }
    if domain is not None:
        input_["domain"] = domain
    if domain_list is not None:
        input_["domain_list"] = domain_list
    if tags is not None:
        input_["tags"] = tags
    if app_monitor_configuration is not None:
        input_["app_monitor_configuration"] = app_monitor_configuration
    if cw_log_enabled is not None:
        input_["cw_log_enabled"] = cw_log_enabled
    if custom_events is not None:
        input_["custom_events"] = custom_events
    if deobfuscation_configuration is not None:
        input_["deobfuscation_configuration"] = deobfuscation_configuration
    if platform is not None:
        input_["platform"] = platform

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