Skip to content

Commit

Permalink
feat(client-rum): CloudWatch RUM now supports custom events. To use c…
Browse files Browse the repository at this point in the history
…ustom events, create an app monitor or update an app monitor with CustomEvent Status as ENABLED.
  • Loading branch information
awstools committed Nov 17, 2022
1 parent e477f4a commit 55ce77a
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 97 deletions.
1 change: 0 additions & 1 deletion clients/client-rum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ AWS SDK for JavaScript RUM Client for Node.js, Browser and React Native.
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>

<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
Expand Down
2 changes: 0 additions & 2 deletions clients/client-rum/src/RUM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ import { RUMClient } from "./RUMClient";
* 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>
*
* <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
Expand All @@ -111,7 +110,6 @@ export class RUM extends RUMClient {
* Extended metrics that you can send to CloudWatch and CloudWatch Evidently</a>.</p>
* <p>The maximum number of metric definitions that you can specify in one
* <code>BatchCreateRumMetricDefinitions</code> operation is 200.</p>
*
* <p>The maximum number of metric definitions that one destination can contain is 2000.</p>
* <p>Extended metrics sent are charged as CloudWatch custom metrics. Each combination of additional dimension name and dimension
* value counts as a custom metric. For more information, see
Expand Down
1 change: 0 additions & 1 deletion clients/client-rum/src/RUMClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ export interface RUMClientResolvedConfig extends RUMClientResolvedConfigType {}
* 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>
*
* <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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export interface BatchCreateRumMetricDefinitionsCommandOutput
* Extended metrics that you can send to CloudWatch and CloudWatch Evidently</a>.</p>
* <p>The maximum number of metric definitions that you can specify in one
* <code>BatchCreateRumMetricDefinitions</code> operation is 200.</p>
*
* <p>The maximum number of metric definitions that one destination can contain is 2000.</p>
* <p>Extended metrics sent are charged as CloudWatch custom metrics. Each combination of additional dimension name and dimension
* value counts as a custom metric. For more information, see
Expand Down
50 changes: 47 additions & 3 deletions clients/client-rum/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export interface AppMonitorConfiguration {

/**
* <p>If this app monitor is to collect data from only certain pages in your application, this structure lists those pages. </p>
*
* <p>You can't include both <code>ExcludedPages</code> and <code>IncludedPages</code> in the same operation.</p>
*/
IncludedPages?: string[];
Expand Down Expand Up @@ -124,6 +123,22 @@ export interface AppMonitorConfiguration {
EnableXRay?: boolean;
}

export enum CustomEventsStatus {
DISABLED = "DISABLED",
ENABLED = "ENABLED",
}

/**
* <p>A structure that contains information about custom events for this app monitor.</p>
*/
export interface CustomEvents {
/**
* <p>Specifies whether this app monitor allows the web client to define and send
* custom events. The default is for custom events to be <code>DISABLED</code>.</p>
*/
Status?: CustomEventsStatus | string;
}

/**
* <p>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.</p>
Expand Down Expand Up @@ -210,6 +225,14 @@ export interface AppMonitor {
* the telemetry data that RUM collects using CloudWatch Logs.</p>
*/
DataStorage?: DataStorage;

/**
* <p>Specifies whether this app monitor allows the web client to define and send
* custom events.</p>
* <p>For more information about custom events, see
* <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-custom-events.html">Send custom events</a>.</p>
*/
CustomEvents?: CustomEvents;
}

/**
Expand Down Expand Up @@ -450,7 +473,6 @@ export interface MetricDefinitionRequest {
* </p>
* </li>
* </ul>
*
* <p> All dimensions listed in this field
* must also be included in <code>EventPattern</code>.</p>
*/
Expand Down Expand Up @@ -910,7 +932,6 @@ export interface CreateAppMonitorRequest {
* permissions by granting a user
* permission to access or change only resources with certain tag values.</p>
* <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p>
*
* <p>You can associate as many as 50 tags with an app monitor.</p>
* <p>For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a>.</p>
*/
Expand All @@ -935,6 +956,14 @@ export interface CreateAppMonitorRequest {
* <p>If you omit this parameter, the default is <code>false</code>.</p>
*/
CwLogEnabled?: boolean;

/**
* <p>Specifies whether this app monitor allows the web client to define and send
* custom events. If you omit this parameter, custom events are <code>DISABLED</code>.</p>
* <p>For more information about custom events, see
* <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-custom-events.html">Send custom events</a>.</p>
*/
CustomEvents?: CustomEvents;
}

export interface CreateAppMonitorResponse {
Expand Down Expand Up @@ -1248,6 +1277,14 @@ export interface UpdateAppMonitorRequest {
* Amazon CloudWatch Logs charges.</p>
*/
CwLogEnabled?: boolean;

/**
* <p>Specifies whether this app monitor allows the web client to define and send
* custom events. The default is for custom events to be <code>DISABLED</code>.</p>
* <p>For more information about custom events, see
* <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-custom-events.html">Send custom events</a>.</p>
*/
CustomEvents?: CustomEvents;
}

export interface UpdateAppMonitorResponse {}
Expand Down Expand Up @@ -1419,6 +1456,13 @@ export const AppMonitorConfigurationFilterSensitiveLog = (obj: AppMonitorConfigu
...obj,
});

/**
* @internal
*/
export const CustomEventsFilterSensitiveLog = (obj: CustomEvents): any => ({
...obj,
});

/**
* @internal
*/
Expand Down
21 changes: 21 additions & 0 deletions clients/client-rum/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
BatchCreateRumMetricDefinitionsError,
BatchDeleteRumMetricDefinitionsError,
ConflictException,
CustomEvents,
CwLog,
DataStorage,
InternalServerException,
Expand Down Expand Up @@ -216,6 +217,9 @@ export const serializeAws_restJson1CreateAppMonitorCommand = async (
...(input.AppMonitorConfiguration != null && {
AppMonitorConfiguration: serializeAws_restJson1AppMonitorConfiguration(input.AppMonitorConfiguration, context),
}),
...(input.CustomEvents != null && {
CustomEvents: serializeAws_restJson1CustomEvents(input.CustomEvents, context),
}),
...(input.CwLogEnabled != null && { CwLogEnabled: input.CwLogEnabled }),
...(input.Domain != null && { Domain: input.Domain }),
...(input.Name != null && { Name: input.Name }),
Expand Down Expand Up @@ -549,6 +553,9 @@ export const serializeAws_restJson1UpdateAppMonitorCommand = async (
...(input.AppMonitorConfiguration != null && {
AppMonitorConfiguration: serializeAws_restJson1AppMonitorConfiguration(input.AppMonitorConfiguration, context),
}),
...(input.CustomEvents != null && {
CustomEvents: serializeAws_restJson1CustomEvents(input.CustomEvents, context),
}),
...(input.CwLogEnabled != null && { CwLogEnabled: input.CwLogEnabled }),
...(input.Domain != null && { Domain: input.Domain }),
});
Expand Down Expand Up @@ -1673,6 +1680,12 @@ const serializeAws_restJson1AppMonitorDetails = (input: AppMonitorDetails, conte
};
};

const serializeAws_restJson1CustomEvents = (input: CustomEvents, context: __SerdeContext): any => {
return {
...(input.Status != null && { Status: input.Status }),
};
};

const serializeAws_restJson1DimensionKeysMap = (input: Record<string, string>, context: __SerdeContext): any => {
return Object.entries(input).reduce((acc: Record<string, any>, [key, value]: [string, any]) => {
if (value === null) {
Expand Down Expand Up @@ -1805,6 +1818,8 @@ const deserializeAws_restJson1AppMonitor = (output: any, context: __SerdeContext
? deserializeAws_restJson1AppMonitorConfiguration(output.AppMonitorConfiguration, context)
: undefined,
Created: __expectString(output.Created),
CustomEvents:
output.CustomEvents != null ? deserializeAws_restJson1CustomEvents(output.CustomEvents, context) : undefined,
DataStorage:
output.DataStorage != null ? deserializeAws_restJson1DataStorage(output.DataStorage, context) : undefined,
Domain: __expectString(output.Domain),
Expand Down Expand Up @@ -1914,6 +1929,12 @@ const deserializeAws_restJson1BatchDeleteRumMetricDefinitionsErrors = (
return retVal;
};

const deserializeAws_restJson1CustomEvents = (output: any, context: __SerdeContext): CustomEvents => {
return {
Status: __expectString(output.Status),
} as any;
};

const deserializeAws_restJson1CwLog = (output: any, context: __SerdeContext): CwLog => {
return {
CwLogEnabled: __expectBoolean(output.CwLogEnabled),
Expand Down
Loading

0 comments on commit 55ce77a

Please sign in to comment.