We announced the upcoming end-of-support for AWS SDK for JavaScript v2.
We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Class: AWS.RUM

Inherits:
AWS.Service show all
Identifier:
rum
API Version:
2018-05-10
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

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.

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.

Sending a Request Using RUM

var rum = new AWS.RUM();
rum.batchCreateRumMetricDefinitions(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the RUM object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var rum = new AWS.RUM({apiVersion: '2018-05-10'});

You can also set the API version globally in AWS.config.apiVersions using the rum service identifier:

AWS.config.apiVersions = {
  rum: '2018-05-10',
  // other service API versions
};

var rum = new AWS.RUM();

Version:

  • 2018-05-10

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.RUM(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a RUM object

var rum = new AWS.RUM({apiVersion: '2018-05-10'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.RUM.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.RUM.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.RUM.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

  • useFipsEndpoint (Boolean)

    Enables FIPS compatible endpoints. Defaults to false.

  • useDualstackEndpoint (Boolean)

    Enables IPv6 dualstack endpoint. Defaults to false.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

batchCreateRumMetricDefinitions(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the batchCreateRumMetricDefinitions operation

var params = {
  AppMonitorName: 'STRING_VALUE', /* required */
  Destination: CloudWatch | Evidently, /* required */
  MetricDefinitions: [ /* required */
    {
      Name: 'STRING_VALUE', /* required */
      DimensionKeys: {
        '<DimensionKey>': 'STRING_VALUE',
        /* '<DimensionKey>': ... */
      },
      EventPattern: 'STRING_VALUE',
      Namespace: 'STRING_VALUE',
      UnitLabel: 'STRING_VALUE',
      ValueKey: 'STRING_VALUE'
    },
    /* more items */
  ],
  DestinationArn: 'STRING_VALUE'
};
rum.batchCreateRumMetricDefinitions(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorName — (String)

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

    • Destination — (String)

      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.

      Possible values include:
      • "CloudWatch"
      • "Evidently"
    • DestinationArn — (String)

      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.

    • MetricDefinitions — (Array<map>)

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

      • DimensionKeys — (map<String>)

        Use this field only if you are sending the metric to CloudWatch.

        This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in CloudWatch. For extended metrics, valid values for the entries in this field are the following:

        • "metadata.pageId": "PageId"

        • "metadata.browserName": "BrowserName"

        • "metadata.deviceType": "DeviceType"

        • "metadata.osName": "OSName"

        • "metadata.countryCode": "CountryCode"

        • "event_details.fileType": "FileType"

        For both extended metrics and custom metrics, all dimensions listed in this field must also be included in EventPattern.

      • EventPattern — (String)

        The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's session against the pattern, and events that match the pattern are sent to the metric destination.

        When you define extended metrics, the metric definition is not valid if EventPattern is omitted.

        Example event patterns:

        • '{ "event_type": ["com.amazon.rum.js_error_event"], "metadata": { "browserName": [ "Chrome", "Safari" ], } }'

        • '{ "event_type": ["com.amazon.rum.performance_navigation_event"], "metadata": { "browserName": [ "Chrome", "Firefox" ] }, "event_details": { "duration": [{ "numeric": [ "<", 2000 ] }] } }'

        • '{ "event_type": ["com.amazon.rum.performance_navigation_event"], "metadata": { "browserName": [ "Chrome", "Safari" ], "countryCode": [ "US" ] }, "event_details": { "duration": [{ "numeric": [ ">=", 2000, "<", 8000 ] }] } }'

        If the metrics destination is CloudWatch and the event also matches a value in DimensionKeys, then the metric is published with the specified dimensions.

      • Namerequired — (String)

        The name for the metric that is defined in this structure. For custom metrics, you can specify any name that you like. For extended metrics, valid values are the following:

        • PerformanceNavigationDuration

        • PerformanceResourceDuration

        • NavigationSatisfiedTransaction

        • NavigationToleratedTransaction

        • NavigationFrustratedTransaction

        • WebVitalsCumulativeLayoutShift

        • WebVitalsFirstInputDelay

        • WebVitalsLargestContentfulPaint

        • JsErrorCount

        • HttpErrorCount

        • SessionCount

      • Namespace — (String)

        If this structure is for a custom metric instead of an extended metrics, use this parameter to define the metric namespace for that custom metric. Do not specify this parameter if this structure is for an extended metric.

        You cannot use any string that starts with AWS/ for your namespace.

      • UnitLabel — (String)

        The CloudWatch metric unit to use for this metric. If you omit this field, the metric is recorded with no unit.

      • ValueKey — (String)

        The field within the event object that the metric value is sourced from.

        If you omit this field, a hardcoded value of 1 is pushed as the metric value. This is useful if you want to count the number of events that the filter catches.

        If this metric is sent to CloudWatch Evidently, this field will be passed to Evidently raw. Evidently will handle data extraction from the event.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Errors — (Array<map>)

        An array of error objects, if the operation caused any errors.

        • ErrorCoderequired — (String)

          The error code.

        • ErrorMessagerequired — (String)

          The error message for this metric definition.

        • MetricDefinitionrequired — (map)

          The metric definition that caused this error.

          • DimensionKeys — (map<String>)

            Use this field only if you are sending the metric to CloudWatch.

            This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in CloudWatch. For extended metrics, valid values for the entries in this field are the following:

            • "metadata.pageId": "PageId"

            • "metadata.browserName": "BrowserName"

            • "metadata.deviceType": "DeviceType"

            • "metadata.osName": "OSName"

            • "metadata.countryCode": "CountryCode"

            • "event_details.fileType": "FileType"

            For both extended metrics and custom metrics, all dimensions listed in this field must also be included in EventPattern.

          • EventPattern — (String)

            The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's session against the pattern, and events that match the pattern are sent to the metric destination.

            When you define extended metrics, the metric definition is not valid if EventPattern is omitted.

            Example event patterns:

            • '{ "event_type": ["com.amazon.rum.js_error_event"], "metadata": { "browserName": [ "Chrome", "Safari" ], } }'

            • '{ "event_type": ["com.amazon.rum.performance_navigation_event"], "metadata": { "browserName": [ "Chrome", "Firefox" ] }, "event_details": { "duration": [{ "numeric": [ "<", 2000 ] }] } }'

            • '{ "event_type": ["com.amazon.rum.performance_navigation_event"], "metadata": { "browserName": [ "Chrome", "Safari" ], "countryCode": [ "US" ] }, "event_details": { "duration": [{ "numeric": [ ">=", 2000, "<", 8000 ] }] } }'

            If the metrics destination is CloudWatch and the event also matches a value in DimensionKeys, then the metric is published with the specified dimensions.

          • Namerequired — (String)

            The name for the metric that is defined in this structure. For custom metrics, you can specify any name that you like. For extended metrics, valid values are the following:

            • PerformanceNavigationDuration

            • PerformanceResourceDuration

            • NavigationSatisfiedTransaction

            • NavigationToleratedTransaction

            • NavigationFrustratedTransaction

            • WebVitalsCumulativeLayoutShift

            • WebVitalsFirstInputDelay

            • WebVitalsLargestContentfulPaint

            • JsErrorCount

            • HttpErrorCount

            • SessionCount

          • Namespace — (String)

            If this structure is for a custom metric instead of an extended metrics, use this parameter to define the metric namespace for that custom metric. Do not specify this parameter if this structure is for an extended metric.

            You cannot use any string that starts with AWS/ for your namespace.

          • UnitLabel — (String)

            The CloudWatch metric unit to use for this metric. If you omit this field, the metric is recorded with no unit.

          • ValueKey — (String)

            The field within the event object that the metric value is sourced from.

            If you omit this field, a hardcoded value of 1 is pushed as the metric value. This is useful if you want to count the number of events that the filter catches.

            If this metric is sent to CloudWatch Evidently, this field will be passed to Evidently raw. Evidently will handle data extraction from the event.

      • MetricDefinitions — (Array<map>)

        An array of structures that define the extended metrics.

        • DimensionKeys — (map<String>)

          This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in CloudWatch The value of this field is used only if the metric destination is CloudWatch. If the metric destination is Evidently, the value of DimensionKeys is ignored.

        • EventPattern — (String)

          The pattern that defines the metric. RUM checks events that happen in a user's session against the pattern, and events that match the pattern are sent to the metric destination.

          If the metrics destination is CloudWatch and the event also matches a value in DimensionKeys, then the metric is published with the specified dimensions.

        • MetricDefinitionIdrequired — (String)

          The ID of this metric definition.

        • Namerequired — (String)

          The name of the metric that is defined in this structure.

        • Namespace — (String)

          If this metric definition is for a custom metric instead of an extended metric, this field displays the metric namespace that the custom metric is published to.

        • UnitLabel — (String)

          Use this field only if you are sending this metric to CloudWatch. It defines the CloudWatch metric unit that this metric is measured in.

        • ValueKey — (String)

          The field within the event object that the metric value is sourced from.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

batchDeleteRumMetricDefinitions(params = {}, callback) ⇒ AWS.Request

Removes the specified metrics from being sent to an extended metrics destination.

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

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

Service Reference:

Examples:

Calling the batchDeleteRumMetricDefinitions operation

var params = {
  AppMonitorName: 'STRING_VALUE', /* required */
  Destination: CloudWatch | Evidently, /* required */
  MetricDefinitionIds: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  DestinationArn: 'STRING_VALUE'
};
rum.batchDeleteRumMetricDefinitions(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorName — (String)

      The name of the CloudWatch RUM app monitor that is sending these metrics.

    • Destination — (String)

      Defines the destination where you want to stop sending the specified metrics. Valid values are CloudWatch and Evidently. If you specify Evidently, you must also specify the ARN of the CloudWatchEvidently experiment that is to be the destination and an IAM role that has permission to write to the experiment.

      Possible values include:
      • "CloudWatch"
      • "Evidently"
    • DestinationArn — (String)

      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 was receiving the metrics that are being deleted.

    • MetricDefinitionIds — (Array<String>)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Errors — (Array<map>)

        An array of error objects, if the operation caused any errors.

        • ErrorCoderequired — (String)

          The error code.

        • ErrorMessagerequired — (String)

          The error message for this metric definition.

        • MetricDefinitionIdrequired — (String)

          The ID of the metric definition that caused this error.

      • MetricDefinitionIds — (Array<String>)

        The IDs of the metric definitions that were deleted.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

batchGetRumMetricDefinitions(params = {}, callback) ⇒ AWS.Request

Retrieves the list of metrics and dimensions that a RUM app monitor is sending to a single destination.

Service Reference:

Examples:

Calling the batchGetRumMetricDefinitions operation

var params = {
  AppMonitorName: 'STRING_VALUE', /* required */
  Destination: CloudWatch | Evidently, /* required */
  DestinationArn: 'STRING_VALUE',
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
rum.batchGetRumMetricDefinitions(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorName — (String)

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

    • Destination — (String)

      The type of destination that you want to view metrics for. Valid values are CloudWatch and Evidently.

      Possible values include:
      • "CloudWatch"
      • "Evidently"
    • DestinationArn — (String)

      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 corresponds to the destination.

    • MaxResults — (Integer)

      The maximum number of results to return in one operation. The default is 50. The maximum that you can specify is 100.

      To retrieve the remaining results, make another call with the returned NextToken value.

    • NextToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • MetricDefinitions — (Array<map>)

        An array of structures that display information about the metrics that are sent by the specified app monitor to the specified destination.

        • DimensionKeys — (map<String>)

          This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in CloudWatch The value of this field is used only if the metric destination is CloudWatch. If the metric destination is Evidently, the value of DimensionKeys is ignored.

        • EventPattern — (String)

          The pattern that defines the metric. RUM checks events that happen in a user's session against the pattern, and events that match the pattern are sent to the metric destination.

          If the metrics destination is CloudWatch and the event also matches a value in DimensionKeys, then the metric is published with the specified dimensions.

        • MetricDefinitionIdrequired — (String)

          The ID of this metric definition.

        • Namerequired — (String)

          The name of the metric that is defined in this structure.

        • Namespace — (String)

          If this metric definition is for a custom metric instead of an extended metric, this field displays the metric namespace that the custom metric is published to.

        • UnitLabel — (String)

          Use this field only if you are sending this metric to CloudWatch. It defines the CloudWatch metric unit that this metric is measured in.

        • ValueKey — (String)

          The field within the event object that the metric value is sourced from.

      • NextToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createAppMonitor(params = {}, callback) ⇒ AWS.Request

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?

Service Reference:

Examples:

Calling the createAppMonitor operation

var params = {
  Domain: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE', /* required */
  AppMonitorConfiguration: {
    AllowCookies: true || false,
    EnableXRay: true || false,
    ExcludedPages: [
      'STRING_VALUE',
      /* more items */
    ],
    FavoritePages: [
      'STRING_VALUE',
      /* more items */
    ],
    GuestRoleArn: 'STRING_VALUE',
    IdentityPoolId: 'STRING_VALUE',
    IncludedPages: [
      'STRING_VALUE',
      /* more items */
    ],
    SessionSampleRate: 'NUMBER_VALUE',
    Telemetries: [
      errors | performance | http,
      /* more items */
    ]
  },
  CustomEvents: {
    Status: ENABLED | DISABLED
  },
  CwLogEnabled: true || false,
  Tags: {
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
rum.createAppMonitor(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorConfiguration — (map)

      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 — (Array<String>)

        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.

      • FavoritePages — (Array<String>)

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

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

        Note: It is possible that an app monitor does not have a value for GuestRoleArn. For example, this can happen when you use the console to create an app monitor and you allow CloudWatch RUM to create a new identity pool for Authorization. In this case, GuestRoleArn is not present in the GetAppMonitor response because it is not stored by the service. If this issue affects you, you can take one of the following steps:
        • Use the Cloud Development Kit (CDK) to create an identity pool and the associated IAM role, and use that for your app monitor.
        • Make a separate GetIdentityPoolRoles call to Amazon Cognito to retrieve the GuestRoleArn.
      • IdentityPoolId — (String)

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

      • IncludedPages — (Array<String>)

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

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

      • SessionSampleRate — (Float)

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

        The range for this value is 0 to 1 inclusive. Setting this to 1 means that 100% of user sessions are sampled, and setting it to 0.1 means that 10% of user sessions are sampled.

        If you omit this parameter, the default of 0.1 is used, and 10% of sessions will be sampled.

      • Telemetries — (Array<String>)

        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.

    • CustomEvents — (map)

      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.

      • Status — (String)

        Specifies whether this app monitor allows the web client to define and send custom events. The default is for custom events to be DISABLED.

        Possible values include:
        • "ENABLED"
        • "DISABLED"
    • CwLogEnabled — (Boolean)

      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.

    • Domain — (String)

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

    • Name — (String)

      A name for the app monitor.

    • Tags — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Id — (String)

        The unique ID of the new app monitor.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteAppMonitor(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the deleteAppMonitor operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
rum.deleteAppMonitor(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name of the app monitor to delete.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteRumMetricsDestination(params = {}, callback) ⇒ AWS.Request

Deletes a destination for CloudWatch RUM extended metrics, so that the specified app monitor stops sending extended metrics to that destination.

Service Reference:

Examples:

Calling the deleteRumMetricsDestination operation

var params = {
  AppMonitorName: 'STRING_VALUE', /* required */
  Destination: CloudWatch | Evidently, /* required */
  DestinationArn: 'STRING_VALUE'
};
rum.deleteRumMetricsDestination(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorName — (String)

      The name of the app monitor that is sending metrics to the destination that you want to delete.

    • Destination — (String)

      The type of destination to delete. Valid values are CloudWatch and Evidently.

      Possible values include:
      • "CloudWatch"
      • "Evidently"
    • DestinationArn — (String)

      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 corresponds to the destination to delete.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getAppMonitor(params = {}, callback) ⇒ AWS.Request

Retrieves the complete configuration information for one app monitor.

Service Reference:

Examples:

Calling the getAppMonitor operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
rum.getAppMonitor(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The app monitor to retrieve information for.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • AppMonitor — (map)

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

        • AppMonitorConfiguration — (map)

          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 — (Array<String>)

            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.

          • FavoritePages — (Array<String>)

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

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

            Note: It is possible that an app monitor does not have a value for GuestRoleArn. For example, this can happen when you use the console to create an app monitor and you allow CloudWatch RUM to create a new identity pool for Authorization. In this case, GuestRoleArn is not present in the GetAppMonitor response because it is not stored by the service. If this issue affects you, you can take one of the following steps:
            • Use the Cloud Development Kit (CDK) to create an identity pool and the associated IAM role, and use that for your app monitor.
            • Make a separate GetIdentityPoolRoles call to Amazon Cognito to retrieve the GuestRoleArn.
          • IdentityPoolId — (String)

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

          • IncludedPages — (Array<String>)

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

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

          • SessionSampleRate — (Float)

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

            The range for this value is 0 to 1 inclusive. Setting this to 1 means that 100% of user sessions are sampled, and setting it to 0.1 means that 10% of user sessions are sampled.

            If you omit this parameter, the default of 0.1 is used, and 10% of sessions will be sampled.

          • Telemetries — (Array<String>)

            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.

        • Created — (String)

          The date and time that this app monitor was created.

        • CustomEvents — (map)

          Specifies whether this app monitor allows the web client to define and send custom events.

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

          • Status — (String)

            Specifies whether this app monitor allows the web client to define and send custom events. The default is for custom events to be DISABLED.

            Possible values include:
            • "ENABLED"
            • "DISABLED"
        • DataStorage — (map)

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

          • CwLog — (map)

            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.

          Possible values include:
          • "CREATED"
          • "DELETING"
          • "ACTIVE"
        • Tags — (map<String>)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getAppMonitorData(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the getAppMonitorData operation

var params = {
  Name: 'STRING_VALUE', /* required */
  TimeRange: { /* required */
    After: 'NUMBER_VALUE', /* required */
    Before: 'NUMBER_VALUE'
  },
  Filters: [
    {
      Name: 'STRING_VALUE',
      Values: [
        'STRING_VALUE',
        /* more items */
      ]
    },
    /* more items */
  ],
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
rum.getAppMonitorData(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Filters — (Array<map>)

      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.

      • 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 — (Array<String>)

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

    • MaxResults — (Integer)

      The maximum number of results to return in one operation.

    • Name — (String)

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

    • NextToken — (String)

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

    • TimeRange — (map)

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

      • Afterrequired — (Integer)

        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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Events — (Array<String>)

        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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listAppMonitors(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the listAppMonitors operation

var params = {
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
rum.listAppMonitors(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • MaxResults — (Integer)

      The maximum number of results to return in one operation. The default is 50. The maximum that you can specify is 100.

    • NextToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • AppMonitorSummaries — (Array<map>)

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

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

          Possible values include:
          • "CREATED"
          • "DELETING"
          • "ACTIVE"
      • NextToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listRumMetricsDestinations(params = {}, callback) ⇒ AWS.Request

Returns a list of destinations that you have created to receive RUM extended metrics, for the specified app monitor.

For more information about extended metrics, see AddRumMetrics.

Service Reference:

Examples:

Calling the listRumMetricsDestinations operation

var params = {
  AppMonitorName: 'STRING_VALUE', /* required */
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
rum.listRumMetricsDestinations(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorName — (String)

      The name of the app monitor associated with the destinations that you want to retrieve.

    • MaxResults — (Integer)

      The maximum number of results to return in one operation. The default is 50. The maximum that you can specify is 100.

      To retrieve the remaining results, make another call with the returned NextToken value.

    • NextToken — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Destinations — (Array<map>)

        The list of CloudWatch RUM extended metrics destinations associated with the app monitor that you specified.

        • Destination — (String)

          Specifies whether the destination is CloudWatch or Evidently.

          Possible values include:
          • "CloudWatch"
          • "Evidently"
        • DestinationArn — (String)

          If the destination is Evidently, this specifies the ARN of the Evidently experiment that receives the metrics.

        • IamRoleArn — (String)

          This field appears only when the destination is Evidently. It specifies the ARN of the IAM role that is used to write to the Evidently experiment that receives the metrics.

      • NextToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listTagsForResource(params = {}, callback) ⇒ AWS.Request

Displays the tags associated with a CloudWatch RUM resource.

Service Reference:

Examples:

Calling the listTagsForResource operation

var params = {
  ResourceArn: 'STRING_VALUE' /* required */
};
rum.listTagsForResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ResourceArn — (String)

        The ARN of the resource that you are viewing.

      • Tags — (map<String>)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putRumEvents(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the putRumEvents operation

var params = {
  AppMonitorDetails: { /* required */
    id: 'STRING_VALUE',
    name: 'STRING_VALUE',
    version: 'STRING_VALUE'
  },
  BatchId: 'STRING_VALUE', /* required */
  Id: 'STRING_VALUE', /* required */
  RumEvents: [ /* required */
    {
      details: any /* This value will be JSON encoded on your behalf with JSON.stringify() */, /* required */
      id: 'STRING_VALUE', /* required */
      timestamp: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
      type: 'STRING_VALUE', /* required */
      metadata: any /* This value will be JSON encoded on your behalf with JSON.stringify() */
    },
    /* more items */
  ],
  UserDetails: { /* required */
    sessionId: 'STRING_VALUE',
    userId: 'STRING_VALUE'
  }
};
rum.putRumEvents(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorDetails — (map)

      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.

    • BatchId — (String)

      A unique identifier for this batch of RUM event data.

    • Id — (String)

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

    • RumEvents — (Array<map>)

      An array of structures that contain the telemetry event data.

      • detailsrequired — (String)

        A string containing details about the event.

      • idrequired — (String)

        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.

      • timestamprequired — (Date)

        The exact time that this event occurred.

      • typerequired — (String)

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

    • UserDetails — (map)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putRumMetricsDestination(params = {}, callback) ⇒ AWS.Request

Creates or updates a destination to receive extended metrics from CloudWatch RUM. You can send extended metrics to CloudWatch or to a CloudWatch Evidently experiment.

For more information about extended metrics, see BatchCreateRumMetricDefinitions.

Service Reference:

Examples:

Calling the putRumMetricsDestination operation

var params = {
  AppMonitorName: 'STRING_VALUE', /* required */
  Destination: CloudWatch | Evidently, /* required */
  DestinationArn: 'STRING_VALUE',
  IamRoleArn: 'STRING_VALUE'
};
rum.putRumMetricsDestination(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorName — (String)

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

    • Destination — (String)

      Defines the destination to send the metrics to. Valid values are CloudWatch and Evidently. If you specify Evidently, you must also specify the ARN of the CloudWatchEvidently experiment that is to be the destination and an IAM role that has permission to write to the experiment.

      Possible values include:
      • "CloudWatch"
      • "Evidently"
    • DestinationArn — (String)

      Use this parameter only if Destination is Evidently. This parameter specifies the ARN of the Evidently experiment that will receive the extended metrics.

    • IamRoleArn — (String)

      This parameter is required if Destination is Evidently. If Destination is CloudWatch, don't use this parameter.

      This parameter specifies the ARN of an IAM role that RUM will assume to write to the Evidently experiment that you are sending metrics to. This role must have permission to write to that experiment.

      If you specify this parameter, you must be signed on to a role that has PassRole permissions attached to it, to allow the role to be passed. The CloudWatchAmazonCloudWatchRUMFullAccess policy doesn't include PassRole permissions.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

tagResource(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the tagResource operation

var params = {
  ResourceArn: 'STRING_VALUE', /* required */
  Tags: { /* required */
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
rum.tagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

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

    • Tags — (map<String>)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

untagResource(params = {}, callback) ⇒ AWS.Request

Removes one or more tags from the specified resource.

Service Reference:

Examples:

Calling the untagResource operation

var params = {
  ResourceArn: 'STRING_VALUE', /* required */
  TagKeys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
rum.untagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

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

    • TagKeys — (Array<String>)

      The list of tag keys to remove from the resource.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateAppMonitor(params = {}, callback) ⇒ AWS.Request

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?

Service Reference:

Examples:

Calling the updateAppMonitor operation

var params = {
  Name: 'STRING_VALUE', /* required */
  AppMonitorConfiguration: {
    AllowCookies: true || false,
    EnableXRay: true || false,
    ExcludedPages: [
      'STRING_VALUE',
      /* more items */
    ],
    FavoritePages: [
      'STRING_VALUE',
      /* more items */
    ],
    GuestRoleArn: 'STRING_VALUE',
    IdentityPoolId: 'STRING_VALUE',
    IncludedPages: [
      'STRING_VALUE',
      /* more items */
    ],
    SessionSampleRate: 'NUMBER_VALUE',
    Telemetries: [
      errors | performance | http,
      /* more items */
    ]
  },
  CustomEvents: {
    Status: ENABLED | DISABLED
  },
  CwLogEnabled: true || false,
  Domain: 'STRING_VALUE'
};
rum.updateAppMonitor(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorConfiguration — (map)

      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 — (Array<String>)

        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.

      • FavoritePages — (Array<String>)

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

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

        Note: It is possible that an app monitor does not have a value for GuestRoleArn. For example, this can happen when you use the console to create an app monitor and you allow CloudWatch RUM to create a new identity pool for Authorization. In this case, GuestRoleArn is not present in the GetAppMonitor response because it is not stored by the service. If this issue affects you, you can take one of the following steps:
        • Use the Cloud Development Kit (CDK) to create an identity pool and the associated IAM role, and use that for your app monitor.
        • Make a separate GetIdentityPoolRoles call to Amazon Cognito to retrieve the GuestRoleArn.
      • IdentityPoolId — (String)

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

      • IncludedPages — (Array<String>)

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

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

      • SessionSampleRate — (Float)

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

        The range for this value is 0 to 1 inclusive. Setting this to 1 means that 100% of user sessions are sampled, and setting it to 0.1 means that 10% of user sessions are sampled.

        If you omit this parameter, the default of 0.1 is used, and 10% of sessions will be sampled.

      • Telemetries — (Array<String>)

        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.

    • CustomEvents — (map)

      Specifies whether this app monitor allows the web client to define and send custom events. The default is for custom events to be DISABLED.

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

      • Status — (String)

        Specifies whether this app monitor allows the web client to define and send custom events. The default is for custom events to be DISABLED.

        Possible values include:
        • "ENABLED"
        • "DISABLED"
    • CwLogEnabled — (Boolean)

      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.

    • Domain — (String)

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

    • Name — (String)

      The name of the app monitor to update.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateRumMetricDefinition(params = {}, callback) ⇒ AWS.Request

Modifies one existing metric definition for CloudWatch RUM extended metrics. For more information about extended metrics, see BatchCreateRumMetricsDefinitions.

Service Reference:

Examples:

Calling the updateRumMetricDefinition operation

var params = {
  AppMonitorName: 'STRING_VALUE', /* required */
  Destination: CloudWatch | Evidently, /* required */
  MetricDefinition: { /* required */
    Name: 'STRING_VALUE', /* required */
    DimensionKeys: {
      '<DimensionKey>': 'STRING_VALUE',
      /* '<DimensionKey>': ... */
    },
    EventPattern: 'STRING_VALUE',
    Namespace: 'STRING_VALUE',
    UnitLabel: 'STRING_VALUE',
    ValueKey: 'STRING_VALUE'
  },
  MetricDefinitionId: 'STRING_VALUE', /* required */
  DestinationArn: 'STRING_VALUE'
};
rum.updateRumMetricDefinition(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AppMonitorName — (String)

      The name of the CloudWatch RUM app monitor that sends these metrics.

    • Destination — (String)

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

      Possible values include:
      • "CloudWatch"
      • "Evidently"
    • DestinationArn — (String)

      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.

    • MetricDefinition — (map)

      A structure that contains the new definition that you want to use for this metric.

      • DimensionKeys — (map<String>)

        Use this field only if you are sending the metric to CloudWatch.

        This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in CloudWatch. For extended metrics, valid values for the entries in this field are the following:

        • "metadata.pageId": "PageId"

        • "metadata.browserName": "BrowserName"

        • "metadata.deviceType": "DeviceType"

        • "metadata.osName": "OSName"

        • "metadata.countryCode": "CountryCode"

        • "event_details.fileType": "FileType"

        For both extended metrics and custom metrics, all dimensions listed in this field must also be included in EventPattern.

      • EventPattern — (String)

        The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's session against the pattern, and events that match the pattern are sent to the metric destination.

        When you define extended metrics, the metric definition is not valid if EventPattern is omitted.

        Example event patterns:

        • '{ "event_type": ["com.amazon.rum.js_error_event"], "metadata": { "browserName": [ "Chrome", "Safari" ], } }'

        • '{ "event_type": ["com.amazon.rum.performance_navigation_event"], "metadata": { "browserName": [ "Chrome", "Firefox" ] }, "event_details": { "duration": [{ "numeric": [ "<", 2000 ] }] } }'

        • '{ "event_type": ["com.amazon.rum.performance_navigation_event"], "metadata": { "browserName": [ "Chrome", "Safari" ], "countryCode": [ "US" ] }, "event_details": { "duration": [{ "numeric": [ ">=", 2000, "<", 8000 ] }] } }'

        If the metrics destination is CloudWatch and the event also matches a value in DimensionKeys, then the metric is published with the specified dimensions.

      • Namerequired — (String)

        The name for the metric that is defined in this structure. For custom metrics, you can specify any name that you like. For extended metrics, valid values are the following:

        • PerformanceNavigationDuration

        • PerformanceResourceDuration

        • NavigationSatisfiedTransaction

        • NavigationToleratedTransaction

        • NavigationFrustratedTransaction

        • WebVitalsCumulativeLayoutShift

        • WebVitalsFirstInputDelay

        • WebVitalsLargestContentfulPaint

        • JsErrorCount

        • HttpErrorCount

        • SessionCount

      • Namespace — (String)

        If this structure is for a custom metric instead of an extended metrics, use this parameter to define the metric namespace for that custom metric. Do not specify this parameter if this structure is for an extended metric.

        You cannot use any string that starts with AWS/ for your namespace.

      • UnitLabel — (String)

        The CloudWatch metric unit to use for this metric. If you omit this field, the metric is recorded with no unit.

      • ValueKey — (String)

        The field within the event object that the metric value is sourced from.

        If you omit this field, a hardcoded value of 1 is pushed as the metric value. This is useful if you want to count the number of events that the filter catches.

        If this metric is sent to CloudWatch Evidently, this field will be passed to Evidently raw. Evidently will handle data extraction from the event.

    • MetricDefinitionId — (String)

      The ID of the metric definition to update.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.