Table of Contents
A low-level client representing CloudWatch RUM
With Amazon CloudWatch RUM, you can perform real-user monitoring to collect client-side data about your web application performance from actual user sessions in real time. The data collected includes page load times, client-side errors, and user behavior. When you view this data, you can see it all aggregated together and also see breakdowns by the browsers and devices that your customers use.
<p>You can use the collected data to quickly identify and debug client-side performance issues. CloudWatch RUM helps you visualize anomalies in your application performance and find relevant debugging data such as error messages, stack traces, and user sessions. You can also use RUM to understand the range of end-user impact including the number of users, geolocations, and browsers used.</p>
import boto3 client = boto3.client('rum')
These are the available methods:
Check if an operation can be paginated.
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
response = 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'
}
)
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.
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.
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?
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.
A list of pages in the CloudWatch RUM console that are to be displayed with a "favorite" icon.
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.
The ID of the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.
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>
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.
An array that lists the types of telemetry data that this app monitor is to collect.
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 .
[REQUIRED]
The top-level internet domain name for which your application has administrative authority.
[REQUIRED]
A name for the app monitor.
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>
dict
Response Syntax
{
'Id': 'string'
}
Response Structure
(dict) --
Id (string) --
The unique ID of the new app monitor.
Exceptions
Deletes an existing app monitor. This immediately stops the collection of data.
See also: AWS API Documentation
Request Syntax
response = client.delete_app_monitor(
Name='string'
)
[REQUIRED]
The name of the app monitor to delete.
{}
Response Structure
Exceptions
Retrieves the complete configuration information for one app monitor.
See also: AWS API Documentation
Request Syntax
response = client.get_app_monitor(
Name='string'
)
[REQUIRED]
The app monitor to retrieve information for.
{
'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
A structure containing all the configuration information for the app monitor.
A structure that contains much of the configuration data for the app monitor.
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.
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?
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.
A list of pages in the CloudWatch RUM console that are to be displayed with a "favorite" icon.
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.
The ID of the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.
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>
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.
An array that lists the types of telemetry data that this app monitor is to collect.
The date and time that this app monitor was created.
A structure that contains information about whether this app monitor stores a copy of the telemetry data that RUM collects using CloudWatch Logs.
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.
Indicated whether the app monitor stores copies of the data that RUM collects in CloudWatch Logs.
The name of the log group where the copies are stored.
The top-level internet domain name for which your application has administrative authority.
The unique ID of this app monitor.
The date and time of the most recent changes to this app monitor's configuration.
The name of the app monitor.
The current state of the app monitor.
The list of tag keys and values associated with this app monitor.
Exceptions
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
response = client.get_app_monitor_data(
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
MaxResults=123,
Name='string',
NextToken='string',
TimeRange={
'After': 123,
'Before': 123
}
)
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.
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.
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
The values of the Name that are to be be included in the returned results.
[REQUIRED]
The name of the app monitor that collected the data that you want to retrieve.
[REQUIRED]
A structure that defines the time range that you want to retrieve results from.
The beginning of the time range to retrieve performance events from.
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.
dict
Response Syntax
{
'Events': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
Events (list) --
The events that RUM collected that match your request.
NextToken (string) --
A token that you can use in a subsequent operation to retrieve the next set of results.
Exceptions
Create a paginator for an operation.
Returns an object that can wait for some condition.
Returns a list of the Amazon CloudWatch RUM app monitors in the account.
See also: AWS API Documentation
Request Syntax
response = client.list_app_monitors(
MaxResults=123,
NextToken='string'
)
dict
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.
Exceptions
Displays the tags associated with a CloudWatch RUM resource.
See also: AWS API Documentation
Request Syntax
response = client.list_tags_for_resource(
ResourceArn='string'
)
[REQUIRED]
The ARN of the resource that you want to see the tags of.
{
'ResourceArn': 'string',
'Tags': {
'string': 'string'
}
}
Response Structure
The ARN of the resource that you are viewing.
The list of tag keys and values associated with the resource you specified.
Exceptions
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
response = 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'
}
)
[REQUIRED]
A structure that contains information about the app monitor that collected this telemetry information.
The unique ID of the app monitor.
The name of the app monitor.
The version of the app monitor.
[REQUIRED]
A unique identifier for this batch of RUM event data.
[REQUIRED]
The ID of the app monitor that is sending this data.
[REQUIRED]
An array of structures that contain the telemetry event data.
A structure that contains the information for one performance event that RUM collects from a user session with your application.
A string containing details about the event.
A unique ID for this event.
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.
The exact time that this event occurred.
The JSON schema that denotes the type of event this is, such as a page load or a new session.
[REQUIRED]
A structure that contains information about the user session that this batch of events was collected from.
The session ID that the performance events are from.
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.
dict
Response Syntax
{}
Response Structure
Exceptions
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
response = client.tag_resource(
ResourceArn='string',
Tags={
'string': 'string'
}
)
[REQUIRED]
The ARN of the CloudWatch RUM resource that you're adding tags to.
[REQUIRED]
The list of key-value pairs to associate with the resource.
dict
Response Syntax
{}
Response Structure
Exceptions
Removes one or more tags from the specified resource.
See also: AWS API Documentation
Request Syntax
response = client.untag_resource(
ResourceArn='string',
TagKeys=[
'string',
]
)
[REQUIRED]
The ARN of the CloudWatch RUM resource that you're removing tags from.
[REQUIRED]
The list of tag keys to remove from the resource.
dict
Response Syntax
{}
Response Structure
Exceptions
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
response = 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'
)
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 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.
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?
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.
A list of pages in the CloudWatch RUM console that are to be displayed with a "favorite" icon.
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.
The ID of the Amazon Cognito identity pool that is used to authorize the sending of data to RUM.
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>
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.
An array that lists the types of telemetry data that this app monitor is to collect.
[REQUIRED]
The name of the app monitor to update.
dict
Response Syntax
{}
Response Structure
Exceptions
The available paginators are:
paginator = client.get_paginator('get_app_monitor_data')
Creates an iterator that will paginate through responses from CloudWatchRUM.Client.get_app_monitor_data().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
Name='string',
TimeRange={
'After': 123,
'Before': 123
},
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
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.
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.
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
The values of the Name that are to be be included in the returned results.
[REQUIRED]
The name of the app monitor that collected the data that you want to retrieve.
[REQUIRED]
A structure that defines the time range that you want to retrieve results from.
The beginning of the time range to retrieve performance events from.
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.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'Events': [
'string',
],
}
Response Structure
(dict) --
Events (list) --
The events that RUM collected that match your request.
paginator = client.get_paginator('list_app_monitors')
Creates an iterator that will paginate through responses from CloudWatchRUM.Client.list_app_monitors().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
{
'AppMonitorSummaries': [
{
'Created': 'string',
'Id': 'string',
'LastModified': 'string',
'Name': 'string',
'State': 'CREATED'|'DELETING'|'ACTIVE'
},
],
}
Response Structure
An array of structures that contain information about the returned app monitors.
A structure that includes some data about app monitors and their settings.
The date and time that the app monitor was created.
The unique ID of this app monitor.
The date and time of the most recent changes to this app monitor's configuration.
The name of this app monitor.
The current state of this app monitor.