CloudWatch RUM

2021/11/29 - CloudWatch RUM - 10 new api methods

Changes  This is the first public release of CloudWatch RUM

ListAppMonitors (new) Link ¶

Returns a list of the Amazon CloudWatch RUM app monitors in the account.

See also: AWS API Documentation

Request Syntax

client.list_app_monitors(
    MaxResults=123,
    NextToken='string'
)
type MaxResults

integer

param MaxResults

The maximum number of results to return in one operation.

type NextToken

string

param NextToken

Use the token returned by the previous operation to request the next page of results.

rtype

dict

returns

Response Syntax

{
    'AppMonitorSummaries': [
        {
            'Created': 'string',
            'Id': 'string',
            'LastModified': 'string',
            'Name': 'string',
            'State': 'CREATED'|'DELETING'|'ACTIVE'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • AppMonitorSummaries (list) --

      An array of structures that contain information about the returned app monitors.

      • (dict) --

        A structure that includes some data about app monitors and their settings.

        • Created (string) --

          The date and time that the app monitor was created.

        • Id (string) --

          The unique ID of this app monitor.

        • LastModified (string) --

          The date and time of the most recent changes to this app monitor's configuration.

        • Name (string) --

          The name of this app monitor.

        • State (string) --

          The current state of this app monitor.

    • NextToken (string) --

      A token that you can use in a subsequent operation to retrieve the next set of results.

DeleteAppMonitor (new) Link ¶

Deletes an existing app monitor. This immediately stops the collection of data.

See also: AWS API Documentation

Request Syntax

client.delete_app_monitor(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

The name of the app monitor to delete.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

GetAppMonitor (new) Link ¶

Retrieves the complete configuration information for one app monitor.

See also: AWS API Documentation

Request Syntax

client.get_app_monitor(
    Name='string'
)
type Name

string

param Name

[REQUIRED]

The app monitor to retrieve information for.

rtype

dict

returns

Response Syntax

{
    'AppMonitor': {
        'AppMonitorConfiguration': {
            'AllowCookies': True|False,
            'EnableXRay': True|False,
            'ExcludedPages': [
                'string',
            ],
            'FavoritePages': [
                'string',
            ],
            'GuestRoleArn': 'string',
            'IdentityPoolId': 'string',
            'IncludedPages': [
                'string',
            ],
            'SessionSampleRate': 123.0,
            'Telemetries': [
                'errors'|'performance'|'http',
            ]
        },
        'Created': 'string',
        'DataStorage': {
            'CwLog': {
                'CwLogEnabled': True|False,
                'CwLogGroup': 'string'
            }
        },
        'Domain': 'string',
        'Id': 'string',
        'LastModified': 'string',
        'Name': 'string',
        'State': 'CREATED'|'DELETING'|'ACTIVE',
        'Tags': {
            'string': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • AppMonitor (dict) --

      A structure containing all the configuration information for the app monitor.

      • AppMonitorConfiguration (dict) --

        A structure that contains much of the configuration data for the app monitor.

        • AllowCookies (boolean) --

          If you set this to true , the RUM web client sets two cookies, a session cookie and a user cookie. The cookies allow the RUM web client to collect data relating to the number of users an application has and the behavior of the application across a sequence of events. Cookies are stored in the top-level domain of the current page.

        • EnableXRay (boolean) --

          If you set this to true , RUM enables X-Ray tracing for the user sessions that RUM samples. RUM adds an X-Ray trace header to allowed HTTP requests. It also records an X-Ray segment for allowed HTTP requests. You can see traces and segments from these user sessions in the X-Ray console and the CloudWatch ServiceLens console. For more information, see What is X-Ray?

        • ExcludedPages (list) --

          A list of URLs in your website or application to exclude from RUM data collection.

          You can't include both ExcludedPages and IncludedPages in the same operation.

          • (string) --

        • FavoritePages (list) --

          A list of pages in the CloudWatch RUM console that are to be displayed with a "favorite" icon.

          • (string) --

        • GuestRoleArn (string) --

          The ARN of the guest IAM role that is attached to the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.

        • IdentityPoolId (string) --

          The ID of the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.

        • IncludedPages (list) --

          If this app monitor is to collect data from only certain pages in your application, this structure lists those pages.

          <p>You can't include both <code>ExcludedPages</code> and <code>IncludedPages</code> in the same operation.</p>

          • (string) --

        • SessionSampleRate (float) --

          Specifies the percentage of user sessions to use for RUM data collection. Choosing a higher percentage gives you more data but also incurs more costs.

          The number you specify is the percentage of user sessions that will be used.

          If you omit this parameter, the default of 10 is used.

        • Telemetries (list) --

          An array that lists the types of telemetry data that this app monitor is to collect.

          • errors indicates that RUM collects data about unhandled JavaScript errors raised by your application.

          • performance indicates that RUM collects performance data about how your application and its resources are loaded and rendered. This includes Core Web Vitals.

          • http indicates that RUM collects data about HTTP errors thrown by your application.

          • (string) --

      • Created (string) --

        The date and time that this app monitor was created.

      • DataStorage (dict) --

        A structure that contains information about whether this app monitor stores a copy of the telemetry data that RUM collects using CloudWatch Logs.

        • CwLog (dict) --

          A structure that contains the information about whether the app monitor stores copies of the data that RUM collects in CloudWatch Logs. If it does, this structure also contains the name of the log group.

          • CwLogEnabled (boolean) --

            Indicated whether the app monitor stores copies of the data that RUM collects in CloudWatch Logs.

          • CwLogGroup (string) --

            The name of the log group where the copies are stored.

      • Domain (string) --

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

      • Id (string) --

        The unique ID of this app monitor.

      • LastModified (string) --

        The date and time of the most recent changes to this app monitor's configuration.

      • Name (string) --

        The name of the app monitor.

      • State (string) --

        The current state of the app monitor.

      • Tags (dict) --

        The list of tag keys and values associated with this app monitor.

        • (string) --

          • (string) --

UpdateAppMonitor (new) Link ¶

Updates the configuration of an existing app monitor. When you use this operation, only the parts of the app monitor configuration that you specify in this operation are changed. For any parameters that you omit, the existing values are kept.

You can't use this operation to change the tags of an existing app monitor. To change the tags of an existing app monitor, use TagResource.

To create a new app monitor, use CreateAppMonitor.

After you update an app monitor, sign in to the CloudWatch RUM console to get the updated 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?

See also: AWS API Documentation

Request Syntax

client.update_app_monitor(
    AppMonitorConfiguration={
        'AllowCookies': True|False,
        'EnableXRay': True|False,
        'ExcludedPages': [
            'string',
        ],
        'FavoritePages': [
            'string',
        ],
        'GuestRoleArn': 'string',
        'IdentityPoolId': 'string',
        'IncludedPages': [
            'string',
        ],
        'SessionSampleRate': 123.0,
        'Telemetries': [
            'errors'|'performance'|'http',
        ]
    },
    CwLogEnabled=True|False,
    Domain='string',
    Name='string'
)
type AppMonitorConfiguration

dict

param AppMonitorConfiguration

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.

  • AllowCookies (boolean) --

    If you set this to true , the RUM web client sets two cookies, a session cookie and a user cookie. The cookies allow the RUM web client to collect data relating to the number of users an application has and the behavior of the application across a sequence of events. Cookies are stored in the top-level domain of the current page.

  • EnableXRay (boolean) --

    If you set this to true , RUM enables X-Ray tracing for the user sessions that RUM samples. RUM adds an X-Ray trace header to allowed HTTP requests. It also records an X-Ray segment for allowed HTTP requests. You can see traces and segments from these user sessions in the X-Ray console and the CloudWatch ServiceLens console. For more information, see What is X-Ray?

  • ExcludedPages (list) --

    A list of URLs in your website or application to exclude from RUM data collection.

    You can't include both ExcludedPages and IncludedPages in the same operation.

    • (string) --

  • FavoritePages (list) --

    A list of pages in the CloudWatch RUM console that are to be displayed with a "favorite" icon.

    • (string) --

  • GuestRoleArn (string) --

    The ARN of the guest IAM role that is attached to the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.

  • IdentityPoolId (string) --

    The ID of the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.

  • IncludedPages (list) --

    If this app monitor is to collect data from only certain pages in your application, this structure lists those pages.

    <p>You can't include both <code>ExcludedPages</code> and <code>IncludedPages</code> in the same operation.</p>

    • (string) --

  • SessionSampleRate (float) --

    Specifies the percentage of user sessions to use for RUM data collection. Choosing a higher percentage gives you more data but also incurs more costs.

    The number you specify is the percentage of user sessions that will be used.

    If you omit this parameter, the default of 10 is used.

  • Telemetries (list) --

    An array that lists the types of telemetry data that this app monitor is to collect.

    • errors indicates that RUM collects data about unhandled JavaScript errors raised by your application.

    • performance indicates that RUM collects performance data about how your application and its resources are loaded and rendered. This includes Core Web Vitals.

    • http indicates that RUM collects data about HTTP errors thrown by your application.

    • (string) --

type CwLogEnabled

boolean

param CwLogEnabled

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.

type Domain

string

param Domain

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

type Name

string

param Name

[REQUIRED]

The name of the app monitor to update.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

TagResource (new) Link ¶

Assigns one or more tags (key-value pairs) to the specified CloudWatch RUM resource. Currently, the only resources that can be tagged app monitors.

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 use the TagResource action with a resource that already has tags. If you specify a new tag key for the resource, this tag is appended to the list of tags associated with the alarm. If you specify a tag key that is already associated with the resource, the new tag value that you specify replaces the previous value for that tag.

You can associate as many as 50 tags with a resource.

For more information, see Tagging Amazon Web Services resources.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    ResourceArn='string',
    Tags={
        'string': 'string'
    }
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The ARN of the CloudWatch RUM resource that you're adding tags to.

type Tags

dict

param Tags

[REQUIRED]

The list of key-value pairs to associate with the resource.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

CreateAppMonitor (new) Link ¶

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?

See also: AWS API Documentation

Request Syntax

client.create_app_monitor(
    AppMonitorConfiguration={
        'AllowCookies': True|False,
        'EnableXRay': True|False,
        'ExcludedPages': [
            'string',
        ],
        'FavoritePages': [
            'string',
        ],
        'GuestRoleArn': 'string',
        'IdentityPoolId': 'string',
        'IncludedPages': [
            'string',
        ],
        'SessionSampleRate': 123.0,
        'Telemetries': [
            'errors'|'performance'|'http',
        ]
    },
    CwLogEnabled=True|False,
    Domain='string',
    Name='string',
    Tags={
        'string': 'string'
    }
)
type AppMonitorConfiguration

dict

param AppMonitorConfiguration

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.

  • AllowCookies (boolean) --

    If you set this to true , the RUM web client sets two cookies, a session cookie and a user cookie. The cookies allow the RUM web client to collect data relating to the number of users an application has and the behavior of the application across a sequence of events. Cookies are stored in the top-level domain of the current page.

  • EnableXRay (boolean) --

    If you set this to true , RUM enables X-Ray tracing for the user sessions that RUM samples. RUM adds an X-Ray trace header to allowed HTTP requests. It also records an X-Ray segment for allowed HTTP requests. You can see traces and segments from these user sessions in the X-Ray console and the CloudWatch ServiceLens console. For more information, see What is X-Ray?

  • ExcludedPages (list) --

    A list of URLs in your website or application to exclude from RUM data collection.

    You can't include both ExcludedPages and IncludedPages in the same operation.

    • (string) --

  • FavoritePages (list) --

    A list of pages in the CloudWatch RUM console that are to be displayed with a "favorite" icon.

    • (string) --

  • GuestRoleArn (string) --

    The ARN of the guest IAM role that is attached to the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.

  • IdentityPoolId (string) --

    The ID of the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.

  • IncludedPages (list) --

    If this app monitor is to collect data from only certain pages in your application, this structure lists those pages.

    <p>You can't include both <code>ExcludedPages</code> and <code>IncludedPages</code> in the same operation.</p>

    • (string) --

  • SessionSampleRate (float) --

    Specifies the percentage of user sessions to use for RUM data collection. Choosing a higher percentage gives you more data but also incurs more costs.

    The number you specify is the percentage of user sessions that will be used.

    If you omit this parameter, the default of 10 is used.

  • Telemetries (list) --

    An array that lists the types of telemetry data that this app monitor is to collect.

    • errors indicates that RUM collects data about unhandled JavaScript errors raised by your application.

    • performance indicates that RUM collects performance data about how your application and its resources are loaded and rendered. This includes Core Web Vitals.

    • http indicates that RUM collects data about HTTP errors thrown by your application.

    • (string) --

type CwLogEnabled

boolean

param CwLogEnabled

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 .

type Domain

string

param Domain

[REQUIRED]

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

type Name

string

param Name

[REQUIRED]

A name for the app monitor.

type Tags

dict

param Tags

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.

<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>

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'Id': 'string'
}

Response Structure

  • (dict) --

    • Id (string) --

      The unique ID of the new app monitor.

GetAppMonitorData (new) Link ¶

Retrieves the raw performance events that RUM has collected from your web application, so that you can do your own processing or analysis of this data.

See also: AWS API Documentation

Request Syntax

client.get_app_monitor_data(
    Filters=[
        {
            'Name': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    MaxResults=123,
    Name='string',
    NextToken='string',
    TimeRange={
        'After': 123,
        'Before': 123
    }
)
type Filters

list

param Filters

An array of structures that you can use to filter the results to those that match one or more sets of key-value pairs that you specify.

  • (dict) --

    A structure that defines a key and values that you can use to filter the results. The only performance events that are returned are those that have values matching the ones that you specify in one of your QueryFilter structures.

    For example, you could specify Browser as the Name and specify Chrome,Firefox as the Values to return events generated only from those browsers.

    Specifying Invert as the Name works as a "not equal to" filter. For example, specify Invert as the Name and specify Chrome as the value to return all events except events from user sessions with the Chrome browser.

    • Name (string) --

      The name of a key to search for. The filter returns only the events that match the Name and Values that you specify.

      Valid values for Name are Browser | Device | Country | Page | OS | EventType | Invert

    • Values (list) --

      The values of the Name that are to be be included in the returned results.

      • (string) --

type MaxResults

integer

param MaxResults

The maximum number of results to return in one operation.

type Name

string

param Name

[REQUIRED]

The name of the app monitor that collected the data that you want to retrieve.

type NextToken

string

param NextToken

Use the token returned by the previous operation to request the next page of results.

type TimeRange

dict

param TimeRange

[REQUIRED]

A structure that defines the time range that you want to retrieve results from.

  • After (integer) -- [REQUIRED]

    The beginning of the time range to retrieve performance events from.

  • Before (integer) --

    The end of the time range to retrieve performance events from. If you omit this, the time range extends to the time that this operation is performed.

rtype

dict

returns

Response Syntax

{
    'Events': [
        'string',
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Events (list) --

      The events that RUM collected that match your request.

      • (string) --

    • NextToken (string) --

      A token that you can use in a subsequent operation to retrieve the next set of results.

PutRumEvents (new) Link ¶

Sends telemetry events about your application performance and user behavior to CloudWatch RUM. The code snippet that RUM generates for you to add to your application includes PutRumEvents operations to send this data to RUM.

Each PutRumEvents operation can send a batch of events from one user session.

See also: AWS API Documentation

Request Syntax

client.put_rum_events(
    AppMonitorDetails={
        'id': 'string',
        'name': 'string',
        'version': 'string'
    },
    BatchId='string',
    Id='string',
    RumEvents=[
        {
            'details': 'string',
            'id': 'string',
            'metadata': 'string',
            'timestamp': datetime(2015, 1, 1),
            'type': 'string'
        },
    ],
    UserDetails={
        'sessionId': 'string',
        'userId': 'string'
    }
)
type AppMonitorDetails

dict

param AppMonitorDetails

[REQUIRED]

A structure that contains information about the app monitor that collected this telemetry information.

  • id (string) --

    The unique ID of the app monitor.

  • name (string) --

    The name of the app monitor.

  • version (string) --

    The version of the app monitor.

type BatchId

string

param BatchId

[REQUIRED]

A unique identifier for this batch of RUM event data.

type Id

string

param Id

[REQUIRED]

The ID of the app monitor that is sending this data.

type RumEvents

list

param RumEvents

[REQUIRED]

An array of structures that contain the telemetry event data.

  • (dict) --

    A structure that contains the information for one performance event that RUM collects from a user session with your application.

    • details (string) -- [REQUIRED]

      A string containing details about the event.

    • id (string) -- [REQUIRED]

      A unique ID for this event.

    • metadata (string) --

      Metadata about this event, which contains a JSON serialization of the identity of the user for this session. The user information comes from information such as the HTTP user-agent request header and document interface.

    • timestamp (datetime) -- [REQUIRED]

      The exact time that this event occurred.

    • type (string) -- [REQUIRED]

      The JSON schema that denotes the type of event this is, such as a page load or a new session.

type UserDetails

dict

param UserDetails

[REQUIRED]

A structure that contains information about the user session that this batch of events was collected from.

  • sessionId (string) --

    The session ID that the performance events are from.

  • userId (string) --

    The ID of the user for this user session. This ID is generated by RUM and does not include any personally identifiable information about the user.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

ListTagsForResource (new) Link ¶

Displays the tags associated with a CloudWatch RUM resource.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    ResourceArn='string'
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The ARN of the resource that you want to see the tags of.

rtype

dict

returns

Response Syntax

{
    'ResourceArn': 'string',
    'Tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • ResourceArn (string) --

      The ARN of the resource that you are viewing.

    • Tags (dict) --

      The list of tag keys and values associated with the resource you specified.

      • (string) --

        • (string) --

UntagResource (new) Link ¶

Removes one or more tags from the specified resource.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    ResourceArn='string',
    TagKeys=[
        'string',
    ]
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The ARN of the CloudWatch RUM resource that you're removing tags from.

type TagKeys

list

param TagKeys

[REQUIRED]

The list of tag keys to remove from the resource.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --