createAppMonitor method
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?
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter name :
A name for the app monitor.
Parameter 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.
Parameter customEvents :
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.
Parameter 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.
Parameter deobfuscationConfiguration :
A structure that contains the configuration for how an app monitor can
deobfuscate stack traces.
Parameter domain :
The top-level internet domain name for which your application has
administrative authority.
Parameter domainList :
List the domain names for which your application has administrative
authority. The CreateAppMonitor requires either the domain or
the domain list.
Parameter platform :
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.
Parameter 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.
You can associate as many as 50 tags with an app monitor.
For more information, see Tagging Amazon Web Services resources.
Implementation
Future<CreateAppMonitorResponse> createAppMonitor({
required String name,
AppMonitorConfiguration? appMonitorConfiguration,
CustomEvents? customEvents,
bool? cwLogEnabled,
DeobfuscationConfiguration? deobfuscationConfiguration,
String? domain,
List<String>? domainList,
AppMonitorPlatform? platform,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'Name': name,
if (appMonitorConfiguration != null)
'AppMonitorConfiguration': appMonitorConfiguration,
if (customEvents != null) 'CustomEvents': customEvents,
if (cwLogEnabled != null) 'CwLogEnabled': cwLogEnabled,
if (deobfuscationConfiguration != null)
'DeobfuscationConfiguration': deobfuscationConfiguration,
if (domain != null) 'Domain': domain,
if (domainList != null) 'DomainList': domainList,
if (platform != null) 'Platform': platform.value,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/appmonitor',
exceptionFnMap: _exceptionFns,
);
return CreateAppMonitorResponse.fromJson(response);
}