Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const project = new cdklabs.CdklabsConstructLibrary({
setNodeEngineVersion: false,

cdkVersion: CDK_VERSION,
// TODO: upgrade to 5.x
jsiiVersion: "1.x",

srcdir: "lib",
testdir: "test",
Expand Down Expand Up @@ -104,12 +102,6 @@ _By submitting this pull request, I confirm that my contribution is made under t
);
});

// newer types don't work with our ts and jsii version
project.addDevDeps("@types/node@^16 <= 16.18.78");
project.package.addField("resolutions", {
"@types/babel__traverse": "7.18.2",
});

// Add some other eslint rules followed across this project
project.eslint?.addRules({
"no-case-declarations": "off",
Expand Down
3,666 changes: 1,761 additions & 1,905 deletions API.md

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions lib/common/metric/BaseMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ export interface BaseMetricFactoryProps {
readonly account?: string;
}

export abstract class BaseMetricFactory<
PropsType extends BaseMetricFactoryProps,
> {
export abstract class BaseMetricFactory {
protected readonly metricFactory: MetricFactory;
protected readonly account?: string;
protected readonly region?: string;

constructor(metricFactory: MetricFactory, props: PropsType) {
constructor(metricFactory: MetricFactory, props: BaseMetricFactoryProps) {
this.metricFactory = metricFactory;
this.account = props.account;
this.region = props.region;
Expand Down
33 changes: 2 additions & 31 deletions lib/dashboard/widget/KeyValueTableWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,14 @@ export class KeyValueTableWidget extends TextWidget {
* Creates a key-value table widget.
* @param data An array of key-value pairs as objects
*/
constructor(data: KeyValue[]);

/**
* Creates a key-value table widget.
* @param data An array of key-value pairs as tuples
*
* @deprecated Use the KeyValue[] constructor instead. This tuple format is not compatible with JSII 5.x and will be removed in the next major version.
*/
constructor(data: [string, string][]);

constructor(data: KeyValue[] | [string, string][]) {
const normalizedData = KeyValueTableWidget.normalizeData(data);
constructor(data: KeyValue[]) {
super({
width: FullWidth,
height: 3,
markdown: KeyValueTableWidget.toMarkdown(normalizedData),
markdown: KeyValueTableWidget.toMarkdown(data),
});
}

private static normalizeData(
data: KeyValue[] | [string, string][],
): KeyValue[] {
if (data.length === 0) {
return [];
}

// Check if it's a tuple array by inspecting the first element
if (Array.isArray(data[0])) {
return (data as [string, string][]).map(([key, value]) => ({
key,
value,
}));
}

return data as KeyValue[];
}

private static toMarkdown(data: KeyValue[]) {
let headerRow = "";
let subHeaderRow = "";
Expand Down
8 changes: 0 additions & 8 deletions lib/dashboard/widget/KeyValueTableWidgetV2.ts

This file was deleted.

1 change: 0 additions & 1 deletion lib/dashboard/widget/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export * from "./BitmapWidget";
export * from "./CustomWidget";
export * from "./HeaderWidget";
export * from "./KeyValueTableWidget";
export * from "./KeyValueTableWidgetV2";
export * from "./MonitoringHeaderWidget";
export * from "./StrictGraphWidget";
export * from "./UnofficialWidgets";
9 changes: 0 additions & 9 deletions lib/facade/IMonitoringAspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ import {
WafV2MonitoringOptions,
} from "../monitoring";

/**
* @deprecated Extend {@link BaseMonitoringAspectType} instead.
*
* This type is not compatable with JSII@5.x and will be removed in the next major version.
*/
export type MonitoringAspectType<T> = BaseMonitoringAspectType & {
readonly props?: T;
};

export interface BaseMonitoringAspectType {
/**
* If the monitoring aspect is enabled for this resource.
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-acm/CertificateManagerMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface CertificateManagerMetricFactoryProps
readonly certificate: ICertificate;
}

export class CertificateManagerMetricFactory extends BaseMetricFactory<CertificateManagerMetricFactoryProps> {
export class CertificateManagerMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-apigateway/ApiGatewayMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface ApiGatewayMetricFactoryProps extends BaseMetricFactoryProps {
readonly rateComputationMethod?: RateComputationMethod;
}

export class ApiGatewayMetricFactory extends BaseMetricFactory<ApiGatewayMetricFactoryProps> {
export class ApiGatewayMetricFactory extends BaseMetricFactory {
protected readonly fillTpsWithZeroes: boolean;
protected readonly rateComputationMethod: RateComputationMethod;
protected readonly dimensionsMap: DimensionsMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface ApiGatewayV2HttpApiMetricFactoryProps
readonly rateComputationMethod?: RateComputationMethod;
}

export class ApiGatewayV2HttpApiMetricFactory extends BaseMetricFactory<ApiGatewayV2HttpApiMetricFactoryProps> {
export class ApiGatewayV2HttpApiMetricFactory extends BaseMetricFactory {
protected readonly fillTpsWithZeroes: boolean;
protected readonly rateComputationMethod: RateComputationMethod;
protected readonly dimensionsMap: DimensionsMap;
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-appsync/AppSyncMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface AppSyncMetricFactoryProps extends BaseMetricFactoryProps {
readonly rateComputationMethod?: RateComputationMethod;
}

export class AppSyncMetricFactory extends BaseMetricFactory<AppSyncMetricFactoryProps> {
export class AppSyncMetricFactory extends BaseMetricFactory {
protected readonly fillTpsWithZeroes: boolean;
protected readonly rateComputationMethod: RateComputationMethod;
protected readonly dimensionsMap: DimensionsMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface CloudFrontDistributionMetricFactoryProps
* To get the CloudFront metrics from the CloudWatch API, you must use the US East (N. Virginia) Region (us-east-1).
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/programming-cloudwatch-metrics.html
*/
export class CloudFrontDistributionMetricFactory extends BaseMetricFactory<CloudFrontDistributionMetricFactoryProps> {
export class CloudFrontDistributionMetricFactory extends BaseMetricFactory {
private readonly fillTpsWithZeroes: boolean;
private readonly rateComputationMethod: RateComputationMethod;
private readonly dimensionsMap: DimensionsMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface CloudWatchLogsMetricFactoryProps
readonly logGroupName: string;
}

export class CloudWatchLogsMetricFactory extends BaseMetricFactory<CloudWatchLogsMetricFactoryProps> {
export class CloudWatchLogsMetricFactory extends BaseMetricFactory {
private readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface CodeBuildProjectMetricFactoryProps
readonly project: IProject;
}

export class CodeBuildProjectMetricFactory extends BaseMetricFactory<CodeBuildProjectMetricFactoryProps> {
export class CodeBuildProjectMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;
protected readonly project: IProject;

Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-docdb/DocumentDbMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface DocumentDbMetricFactoryProps extends BaseMetricFactoryProps {
readonly cluster: IDatabaseCluster;
}

export class DocumentDbMetricFactory extends BaseMetricFactory<DocumentDbMetricFactoryProps> {
export class DocumentDbMetricFactory extends BaseMetricFactory {
readonly clusterIdentifier: string;
protected readonly dimensionsMap: DimensionsMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface DynamoTableGlobalSecondaryIndexMetricFactoryProps
readonly globalSecondaryIndexName: string;
}

export class DynamoTableGlobalSecondaryIndexMetricFactory extends BaseMetricFactory<DynamoTableGlobalSecondaryIndexMetricFactoryProps> {
export class DynamoTableGlobalSecondaryIndexMetricFactory extends BaseMetricFactory {
protected readonly table: ITable;
protected readonly dimensionsMap: DimensionsMap;

Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-dynamo/DynamoTableMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface DynamoTableMetricFactoryProps extends BaseMetricFactoryProps {
readonly billingMode?: BillingMode;
}

export class DynamoTableMetricFactory extends BaseMetricFactory<DynamoTableMetricFactoryProps> {
export class DynamoTableMetricFactory extends BaseMetricFactory {
protected readonly table: ITable;

constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-ec2/AutoScalingGroupMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface AutoScalingGroupMetricFactoryProps
readonly autoScalingGroup: IAutoScalingGroup;
}

export class AutoScalingGroupMetricFactory extends BaseMetricFactory<AutoScalingGroupMetricFactoryProps> {
export class AutoScalingGroupMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-ec2/EC2MetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export interface EC2MetricFactoryProps extends BaseMetricFactoryProps {
readonly instanceIds?: string[];
}

export class EC2MetricFactory extends BaseMetricFactory<EC2MetricFactoryProps> {
export class EC2MetricFactory extends BaseMetricFactory {
protected readonly strategy: IEC2MetricFactoryStrategy;

constructor(metricFactory: MetricFactory, props: EC2MetricFactoryProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface BaseServiceMetricFactoryProps extends BaseMetricFactoryProps {
/**
* Metric factory for a base service (parent class for e.g. Fargate and EC2 services).
*/
export class BaseServiceMetricFactory extends BaseMetricFactory<BaseServiceMetricFactoryProps> {
export class BaseServiceMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;
/**
* @deprecated This isn't required by cdk-monitoring-constructs anymore; use your own reference.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface ElastiCacheClusterMetricFactoryProps
/**
* @see https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/CacheMetrics.html
*/
export class ElastiCacheClusterMetricFactory extends BaseMetricFactory<ElastiCacheClusterMetricFactoryProps> {
export class ElastiCacheClusterMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface ElastiCacheServerlessMetricFactoryProps
/**
* @see https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/serverless-metrics-events-redis.html
*/
export class ElastiCacheServerlessMetricFactory extends BaseMetricFactory<ElastiCacheServerlessMetricFactoryProps> {
export class ElastiCacheServerlessMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-glue/GlueJobMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface GlueJobMetricFactoryProps extends BaseMetricFactoryProps {
readonly rateComputationMethod?: RateComputationMethod;
}

export class GlueJobMetricFactory extends BaseMetricFactory<GlueJobMetricFactoryProps> {
export class GlueJobMetricFactory extends BaseMetricFactory {
protected readonly rateComputationMethod: RateComputationMethod;
protected readonly dimensionsMap: DimensionsMap;
protected readonly typeCountDimensionsMap: DimensionsMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface KinesisDataStreamMetricFactoryProps
/**
* @see https://docs.aws.amazon.com/streams/latest/dev/monitoring-with-cloudwatch.html
*/
export class KinesisDataStreamMetricFactory extends BaseMetricFactory<KinesisDataStreamMetricFactoryProps> {
export class KinesisDataStreamMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-kinesis/KinesisFirehoseMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface KinesisFirehoseMetricFactoryProps
/**
* @see https://docs.aws.amazon.com/firehose/latest/dev/monitoring-with-cloudwatch-metrics.html
*/
export class KinesisFirehoseMetricFactory extends BaseMetricFactory<KinesisFirehoseMetricFactoryProps> {
export class KinesisFirehoseMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface MetricsSpec {
/**
* @see https://docs.aws.amazon.com/kinesisanalytics/latest/java/metrics-dimensions.html
*/
export class KinesisDataAnalyticsMetricFactory extends BaseMetricFactory<KinesisDataAnalyticsMetricFactoryProps> {
export class KinesisDataAnalyticsMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface LambdaFunctionEnhancedMetricFactoryProps
readonly lambdaFunction: IFunction;
}

export class LambdaFunctionEnhancedMetricFactory extends BaseMetricFactory<LambdaFunctionEnhancedMetricFactoryProps> {
export class LambdaFunctionEnhancedMetricFactory extends BaseMetricFactory {
protected readonly lambdaFunction: IFunction;

constructor(
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-lambda/LambdaFunctionMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface LambdaFunctionMetricFactoryProps
readonly lambdaInsightsEnabled?: boolean;
}

export class LambdaFunctionMetricFactory extends BaseMetricFactory<LambdaFunctionMetricFactoryProps> {
export class LambdaFunctionMetricFactory extends BaseMetricFactory {
protected readonly lambdaFunction: IFunction;
protected readonly fillTpsWithZeroes: boolean;
protected readonly rateComputationMethod: RateComputationMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface ApplicationLoadBalancerMetricFactoryProps
* Metric factory to create metrics for application load-balanced service.
*/
export class ApplicationLoadBalancerMetricFactory
extends BaseMetricFactory<ApplicationLoadBalancerMetricFactoryProps>
extends BaseMetricFactory
implements ILoadBalancerMetricFactory
{
protected readonly applicationLoadBalancer: IApplicationLoadBalancer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface NetworkLoadBalancerMetricFactoryProps
* Metric factory to create metrics for network load-balanced service.
*/
export class NetworkLoadBalancerMetricFactory
extends BaseMetricFactory<NetworkLoadBalancerMetricFactoryProps>
extends BaseMetricFactory
implements ILoadBalancerMetricFactory
{
protected readonly networkLoadBalancer: INetworkLoadBalancer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface OpenSearchClusterMetricFactoryProps
readonly rateComputationMethod?: RateComputationMethod;
}

export class OpenSearchClusterMetricFactory extends BaseMetricFactory<OpenSearchClusterMetricFactoryProps> {
export class OpenSearchClusterMetricFactory extends BaseMetricFactory {
protected readonly domainMetrics: OpenSearchBackportedMetrics;
protected readonly fillTpsWithZeroes: boolean;
protected readonly rateComputationMethod: RateComputationMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface OpenSearchServerlessIndexMetricFactoryProps
*
* @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/monitoring-cloudwatch.html
*/
export class OpenSearchServerlessIndexMetricFactory extends BaseMetricFactory<OpenSearchServerlessIndexMetricFactoryProps> {
export class OpenSearchServerlessIndexMetricFactory extends BaseMetricFactory {
protected readonly dimensionsMap: DimensionsMap;

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface OpenSearchServerlessMetricFactoryProps
*
* @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/monitoring-cloudwatch.html
*/
export class OpenSearchServerlessMetricFactory extends BaseMetricFactory<OpenSearchServerlessMetricFactoryProps> {
export class OpenSearchServerlessMetricFactory extends BaseMetricFactory {
protected readonly rateComputationMethod: RateComputationMethod;
protected readonly dimensionsMap: DimensionsMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface OpenSearchIngestionPipelineMetricFactoryProps
*
* @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/monitoring-pipeline-metrics.html
*/
export class OpenSearchIngestionPipelineMetricFactory extends BaseMetricFactory<OpenSearchIngestionPipelineMetricFactoryProps> {
export class OpenSearchIngestionPipelineMetricFactory extends BaseMetricFactory {
protected readonly subPipelineName: string;
protected readonly source: string;
protected readonly sink: string;
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-rds/RdsClusterMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface RdsClusterMetricFactoryProps extends BaseMetricFactoryProps {
readonly cluster?: IDatabaseCluster | ServerlessCluster;
}

export class RdsClusterMetricFactory extends BaseMetricFactory<RdsClusterMetricFactoryProps> {
export class RdsClusterMetricFactory extends BaseMetricFactory {
readonly clusterIdentifier: string;
readonly cluster?: IDatabaseCluster | ServerlessCluster;
protected readonly dimensionsMap: DimensionsMap;
Expand Down
2 changes: 1 addition & 1 deletion lib/monitoring/aws-rds/RdsInstanceMetricFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface RdsInstanceMetricFactoryProps extends BaseMetricFactoryProps {
readonly instance: IDatabaseInstance;
}

export class RdsInstanceMetricFactory extends BaseMetricFactory<RdsInstanceMetricFactoryProps> {
export class RdsInstanceMetricFactory extends BaseMetricFactory {
readonly instanceIdentifier: string;
readonly instance: IDatabaseInstance;
protected readonly dimensionsMap: DimensionsMap;
Expand Down
Loading
Loading