Skip to content

Latest commit

ย 

History

History
826 lines (445 loc) ยท 35.1 KB

API.md

File metadata and controls

826 lines (445 loc) ยท 35.1 KB

API Reference

Classes

Name Description
WatchApiGateway No description
WatchDynamoTable No description
WatchEcsService No description
WatchLambdaFunction No description
WatchRdsAurora No description
WatchStateMachine No description
Watchful No description
WatchfulAspect A CDK aspect that can automatically watch all resources within a scope.

Structs

Name Description
QuickLink No description
SectionOptions No description
WatchApiGatewayOptions No description
WatchApiGatewayProps No description
WatchDynamoTableOptions No description
WatchDynamoTableProps No description
WatchEcsServiceOptions No description
WatchEcsServiceProps No description
WatchLambdaFunctionOptions No description
WatchLambdaFunctionProps No description
WatchRdsAuroraOptions No description
WatchRdsAuroraProps No description
WatchStateMachineOptions No description
WatchStateMachineProps No description
WatchedOperation An operation (path and method) worth monitoring.
WatchfulAspectProps No description
WatchfulProps No description

Interfaces

Name Description
IWatchful No description

class WatchApiGateway ๐Ÿ”น

Implements: IConstruct, IDependable Extends: Construct

Initializer

new WatchApiGateway(scope: Construct, id: string, props: WatchApiGatewayProps)
  • scope (Construct) No description
  • id (string) No description
  • props (WatchApiGatewayProps) No description
    • cacheGraph (boolean) Include a dashboard graph for caching metrics. Default: false
    • serverErrorThreshold (number) Alarm when 5XX errors reach this threshold over 5 minutes. Default: 1 any 5xx HTTP response will trigger the alarm
    • watchedOperations (Array<WatchedOperation>) A list of operations to monitor separately. Default: only API-level monitoring is added.
    • restApi (aws_apigateway.RestApi) The API Gateway REST API that is being watched.
    • title (string) The title of this section.
    • watchful (IWatchful) The Watchful instance to add widgets into.

class WatchDynamoTable ๐Ÿ”น

Implements: IConstruct, IDependable Extends: Construct

Initializer

new WatchDynamoTable(scope: Construct, id: string, props: WatchDynamoTableProps)
  • scope (Construct) No description
  • id (string) No description
  • props (WatchDynamoTableProps) No description
    • readCapacityThresholdPercent (number) Threshold for read capacity alarm (percentage). Default: 80
    • writeCapacityThresholdPercent (number) Threshold for read capacity alarm (percentage). Default: 80
    • table (aws_dynamodb.Table) No description
    • title (string) No description
    • watchful (IWatchful) No description

class WatchEcsService ๐Ÿ”น

Implements: IConstruct, IDependable Extends: Construct

Initializer

new WatchEcsService(scope: Construct, id: string, props: WatchEcsServiceProps)
  • scope (Construct) No description
  • id (string) No description
  • props (WatchEcsServiceProps) No description
    • cpuMaximumThresholdPercent (number) Threshold for the Cpu Maximum utilization. Default: 80
    • memoryMaximumThresholdPercent (number) Threshold for the Memory Maximum utilization. Default: 0.
    • requestsErrorRateThreshold (number) Threshold for the Number of Request Errors. Default: 0.
    • requestsThreshold (number) Threshold for the Number of Requests. Default: 0.
    • targetResponseTimeThreshold (number) Threshold for the Target Response Time. Default: 0.
    • targetGroup (aws_elasticloadbalancingv2.ApplicationTargetGroup) No description
    • title (string) No description
    • watchful (IWatchful) No description
    • ec2Service (aws_ecs.Ec2Service) No description Optional
    • fargateService (aws_ecs.FargateService) No description Optional

class WatchLambdaFunction ๐Ÿ”น

Implements: IConstruct, IDependable Extends: Construct

Initializer

new WatchLambdaFunction(scope: Construct, id: string, props: WatchLambdaFunctionProps)
  • scope (Construct) No description
  • id (string) No description
  • props (WatchLambdaFunctionProps) No description
    • durationThresholdPercent (number) Threshold for the duration alarm as percentage of the function's timeout value. Default: 80
    • errorsPerMinuteThreshold (number) Number of allowed errors per minute. Default: 0
    • throttlesPerMinuteThreshold (number) Number of allowed throttles per minute. Default: 0
    • fn (aws_lambda.Function) No description
    • title (string) No description
    • watchful (IWatchful) No description

class WatchRdsAurora ๐Ÿ”น

Implements: IConstruct, IDependable Extends: Construct

Initializer

new WatchRdsAurora(scope: Construct, id: string, props: WatchRdsAuroraProps)
  • scope (Construct) No description
  • id (string) No description
  • props (WatchRdsAuroraProps) No description
    • cpuMaximumThresholdPercent (number) Threshold for the Cpu Maximum utilization. Default: 80
    • dbBufferCacheMinimumThreshold (number) Threshold for the Minimum Db Buffer Cache. Default: 0.
    • dbConnectionsMaximumThreshold (number) Threshold for the Maximum Db Connections. Default: 0.
    • dbReplicaLagMaximumThreshold (number) Threshold for the Maximum Db ReplicaLag. Default: 0.
    • dbThroughputMaximumThreshold (number) Threshold for the Maximum Db Throughput. Default: 0.
    • cluster (aws_rds.DatabaseCluster) No description
    • title (string) No description
    • watchful (IWatchful) No description

class WatchStateMachine ๐Ÿ”น

Implements: IConstruct, IDependable Extends: Construct

Initializer

new WatchStateMachine(scope: Construct, id: string, props: WatchStateMachineProps)
  • scope (Construct) No description
  • id (string) No description
  • props (WatchStateMachineProps) No description
    • metricFailedThreshold (number) Alarm when execution failures reach this threshold over 1 minute. Default: 1 any execution failure will trigger the alarm
    • stateMachine (aws_stepfunctions.StateMachine) No description
    • title (string) No description
    • watchful (IWatchful) No description

class Watchful ๐Ÿ”น

Implements: IConstruct, IDependable, IWatchful Extends: Construct

Initializer

new Watchful(scope: Construct, id: string, props?: WatchfulProps)
  • scope (Construct) No description
  • id (string) No description
  • props (WatchfulProps) No description
    • alarmActionArns (Array) ARNs of actions to perform when alarms go off. Default: [] You can use alarmActions instead as a strongly-typed alternative.
    • alarmActions (Array<aws_cloudwatch.IAlarmAction>) CloudWatch alarm actions to perform when alarms go off. Optional
    • alarmEmail (string) Email address to send alarms to. Default: alarms are not sent to an email recipient.
    • alarmSns (aws_sns.ITopic) SNS topic to send alarms to. Default: alarms are not sent to an SNS Topic.
    • alarmSqs (aws_sqs.IQueue) SQS queue to send alarms to. Default: alarms are not sent to an SQS queue.
    • dashboard (boolean) Whether to generate CloudWatch dashboards. Default: true
    • dashboardName (string) The name of the CloudWatch dashboard generated by Watchful. Default: auto-generated

Methods

addAlarm(alarm)๐Ÿ”น

addAlarm(alarm: IAlarm): void

addSection(title, options?)๐Ÿ”น

addSection(title: string, options?: SectionOptions): void
  • title (string) No description
  • options (SectionOptions) No description
    • links (Array<QuickLink>) No description Optional

addWidgets(...widgets)๐Ÿ”น

addWidgets(...widgets: IWidget[]): void

watchApiGateway(title, restApi, options?)๐Ÿ”น

watchApiGateway(title: string, restApi: RestApi, options?: WatchApiGatewayOptions): WatchApiGateway
  • title (string) No description
  • restApi (aws_apigateway.RestApi) No description
  • options (WatchApiGatewayOptions) No description
    • cacheGraph (boolean) Include a dashboard graph for caching metrics. Default: false
    • serverErrorThreshold (number) Alarm when 5XX errors reach this threshold over 5 minutes. Default: 1 any 5xx HTTP response will trigger the alarm
    • watchedOperations (Array<WatchedOperation>) A list of operations to monitor separately. Default: only API-level monitoring is added.

Returns:

watchDynamoTable(title, table, options?)๐Ÿ”น

watchDynamoTable(title: string, table: Table, options?: WatchDynamoTableOptions): WatchDynamoTable
  • title (string) No description
  • table (aws_dynamodb.Table) No description
  • options (WatchDynamoTableOptions) No description
    • readCapacityThresholdPercent (number) Threshold for read capacity alarm (percentage). Default: 80
    • writeCapacityThresholdPercent (number) Threshold for read capacity alarm (percentage). Default: 80

Returns:

watchEc2Ecs(title, ec2Service, targetGroup, options?)๐Ÿ”น

watchEc2Ecs(title: string, ec2Service: Ec2Service, targetGroup: ApplicationTargetGroup, options?: WatchEcsServiceOptions): WatchEcsService
  • title (string) No description
  • ec2Service (aws_ecs.Ec2Service) No description
  • targetGroup (aws_elasticloadbalancingv2.ApplicationTargetGroup) No description
  • options (WatchEcsServiceOptions) No description
    • cpuMaximumThresholdPercent (number) Threshold for the Cpu Maximum utilization. Default: 80
    • memoryMaximumThresholdPercent (number) Threshold for the Memory Maximum utilization. Default: 0.
    • requestsErrorRateThreshold (number) Threshold for the Number of Request Errors. Default: 0.
    • requestsThreshold (number) Threshold for the Number of Requests. Default: 0.
    • targetResponseTimeThreshold (number) Threshold for the Target Response Time. Default: 0.

Returns:

watchFargateEcs(title, fargateService, targetGroup, options?)๐Ÿ”น

watchFargateEcs(title: string, fargateService: FargateService, targetGroup: ApplicationTargetGroup, options?: WatchEcsServiceOptions): WatchEcsService
  • title (string) No description
  • fargateService (aws_ecs.FargateService) No description
  • targetGroup (aws_elasticloadbalancingv2.ApplicationTargetGroup) No description
  • options (WatchEcsServiceOptions) No description
    • cpuMaximumThresholdPercent (number) Threshold for the Cpu Maximum utilization. Default: 80
    • memoryMaximumThresholdPercent (number) Threshold for the Memory Maximum utilization. Default: 0.
    • requestsErrorRateThreshold (number) Threshold for the Number of Request Errors. Default: 0.
    • requestsThreshold (number) Threshold for the Number of Requests. Default: 0.
    • targetResponseTimeThreshold (number) Threshold for the Target Response Time. Default: 0.

Returns:

watchLambdaFunction(title, fn, options?)๐Ÿ”น

watchLambdaFunction(title: string, fn: Function, options?: WatchLambdaFunctionOptions): WatchLambdaFunction
  • title (string) No description
  • fn (aws_lambda.Function) No description
  • options (WatchLambdaFunctionOptions) No description
    • durationThresholdPercent (number) Threshold for the duration alarm as percentage of the function's timeout value. Default: 80
    • errorsPerMinuteThreshold (number) Number of allowed errors per minute. Default: 0
    • throttlesPerMinuteThreshold (number) Number of allowed throttles per minute. Default: 0

Returns:

watchRdsAuroraCluster(title, cluster, options?)๐Ÿ”น

watchRdsAuroraCluster(title: string, cluster: DatabaseCluster, options?: WatchRdsAuroraOptions): WatchRdsAurora
  • title (string) No description
  • cluster (aws_rds.DatabaseCluster) No description
  • options (WatchRdsAuroraOptions) No description
    • cpuMaximumThresholdPercent (number) Threshold for the Cpu Maximum utilization. Default: 80
    • dbBufferCacheMinimumThreshold (number) Threshold for the Minimum Db Buffer Cache. Default: 0.
    • dbConnectionsMaximumThreshold (number) Threshold for the Maximum Db Connections. Default: 0.
    • dbReplicaLagMaximumThreshold (number) Threshold for the Maximum Db ReplicaLag. Default: 0.
    • dbThroughputMaximumThreshold (number) Threshold for the Maximum Db Throughput. Default: 0.

Returns:

watchScope(scope, options?)๐Ÿ”น

watchScope(scope: Construct, options?: WatchfulAspectProps): void
  • scope (Construct) No description
  • options (WatchfulAspectProps) No description
    • apiGateway (boolean) Automatically watch API Gateway APIs in the scope. Default: true
    • dynamodb (boolean) Automatically watch all Amazon DynamoDB tables in the scope. Default: true
    • ec2ecs (boolean) Automatically watch ApplicationLoadBalanced EC2 Ecs Services in the scope (using ECS Pattern). Default: true
    • fargateecs (boolean) Automatically watch ApplicationLoadBalanced Fargate Ecs Services in the scope (using ECS Pattern). Default: true
    • lambda (boolean) Automatically watch AWS Lambda functions in the scope. Default: true
    • rdsaurora (boolean) Automatically watch RDS Aurora clusters in the scope. Default: true
    • stateMachine (boolean) Automatically watch AWS state machines in the scope. Default: true

watchStateMachine(title, stateMachine, options?)๐Ÿ”น

watchStateMachine(title: string, stateMachine: StateMachine, options?: WatchStateMachineOptions): WatchStateMachine
  • title (string) No description
  • stateMachine (aws_stepfunctions.StateMachine) No description
  • options (WatchStateMachineOptions) No description
    • metricFailedThreshold (number) Alarm when execution failures reach this threshold over 1 minute. Default: 1 any execution failure will trigger the alarm

Returns:

class WatchfulAspect ๐Ÿ”น

A CDK aspect that can automatically watch all resources within a scope.

Implements: IAspect

Initializer

Defines a watchful aspect.

new WatchfulAspect(watchful: Watchful, props?: WatchfulAspectProps)
  • watchful (Watchful) The watchful to add those resources to.
  • props (WatchfulAspectProps) Options.
    • apiGateway (boolean) Automatically watch API Gateway APIs in the scope. Default: true
    • dynamodb (boolean) Automatically watch all Amazon DynamoDB tables in the scope. Default: true
    • ec2ecs (boolean) Automatically watch ApplicationLoadBalanced EC2 Ecs Services in the scope (using ECS Pattern). Default: true
    • fargateecs (boolean) Automatically watch ApplicationLoadBalanced Fargate Ecs Services in the scope (using ECS Pattern). Default: true
    • lambda (boolean) Automatically watch AWS Lambda functions in the scope. Default: true
    • rdsaurora (boolean) Automatically watch RDS Aurora clusters in the scope. Default: true
    • stateMachine (boolean) Automatically watch AWS state machines in the scope. Default: true

Methods

visit(node)๐Ÿ”น

All aspects can visit an IConstruct.

visit(node: IConstruct): void

interface IWatchful ๐Ÿ”น

Implemented by: Watchful

Methods

addAlarm(alarm)๐Ÿ”น

addAlarm(alarm: IAlarm): void

addSection(title, options?)๐Ÿ”น

addSection(title: string, options?: SectionOptions): void
  • title (string) No description
  • options (SectionOptions) No description
    • links (Array<QuickLink>) No description Optional

addWidgets(...widgets)๐Ÿ”น

addWidgets(...widgets: IWidget[]): void

struct QuickLink ๐Ÿ”น

Name Type Description
title๐Ÿ”น string
url๐Ÿ”น string

struct SectionOptions ๐Ÿ”น

Name Type Description
links?๐Ÿ”น Array<QuickLink> Optional

struct WatchApiGatewayOptions ๐Ÿ”น

Name Type Description
cacheGraph?๐Ÿ”น boolean Include a dashboard graph for caching metrics.
Default: false
serverErrorThreshold?๐Ÿ”น number Alarm when 5XX errors reach this threshold over 5 minutes.
Default: 1 any 5xx HTTP response will trigger the alarm
watchedOperations?๐Ÿ”น Array<WatchedOperation> A list of operations to monitor separately.
Default: only API-level monitoring is added.

struct WatchApiGatewayProps ๐Ÿ”น

Name Type Description
restApi๐Ÿ”น aws_apigateway.RestApi The API Gateway REST API that is being watched.
title๐Ÿ”น string The title of this section.
watchful๐Ÿ”น IWatchful The Watchful instance to add widgets into.
cacheGraph?๐Ÿ”น boolean Include a dashboard graph for caching metrics.
Default: false
serverErrorThreshold?๐Ÿ”น number Alarm when 5XX errors reach this threshold over 5 minutes.
Default: 1 any 5xx HTTP response will trigger the alarm
watchedOperations?๐Ÿ”น Array<WatchedOperation> A list of operations to monitor separately.
Default: only API-level monitoring is added.

struct WatchDynamoTableOptions ๐Ÿ”น

Name Type Description
readCapacityThresholdPercent?๐Ÿ”น number Threshold for read capacity alarm (percentage).
Default: 80
writeCapacityThresholdPercent?๐Ÿ”น number Threshold for read capacity alarm (percentage).
Default: 80

struct WatchDynamoTableProps ๐Ÿ”น

Name Type Description
table๐Ÿ”น aws_dynamodb.Table
title๐Ÿ”น string
watchful๐Ÿ”น IWatchful
readCapacityThresholdPercent?๐Ÿ”น number Threshold for read capacity alarm (percentage).
Default: 80
writeCapacityThresholdPercent?๐Ÿ”น number Threshold for read capacity alarm (percentage).
Default: 80

struct WatchEcsServiceOptions ๐Ÿ”น

Name Type Description
cpuMaximumThresholdPercent?๐Ÿ”น number Threshold for the Cpu Maximum utilization.
Default: 80
memoryMaximumThresholdPercent?๐Ÿ”น number Threshold for the Memory Maximum utilization.
Default: 0.
requestsErrorRateThreshold?๐Ÿ”น number Threshold for the Number of Request Errors.
Default: 0.
requestsThreshold?๐Ÿ”น number Threshold for the Number of Requests.
Default: 0.
targetResponseTimeThreshold?๐Ÿ”น number Threshold for the Target Response Time.
Default: 0.

struct WatchEcsServiceProps ๐Ÿ”น

Name Type Description
targetGroup๐Ÿ”น aws_elasticloadbalancingv2.ApplicationTargetGroup
title๐Ÿ”น string
watchful๐Ÿ”น IWatchful
cpuMaximumThresholdPercent?๐Ÿ”น number Threshold for the Cpu Maximum utilization.
Default: 80
ec2Service?๐Ÿ”น aws_ecs.Ec2Service Optional
fargateService?๐Ÿ”น aws_ecs.FargateService Optional
memoryMaximumThresholdPercent?๐Ÿ”น number Threshold for the Memory Maximum utilization.
Default: 0.
requestsErrorRateThreshold?๐Ÿ”น number Threshold for the Number of Request Errors.
Default: 0.
requestsThreshold?๐Ÿ”น number Threshold for the Number of Requests.
Default: 0.
targetResponseTimeThreshold?๐Ÿ”น number Threshold for the Target Response Time.
Default: 0.

struct WatchLambdaFunctionOptions ๐Ÿ”น

Name Type Description
durationThresholdPercent?๐Ÿ”น number Threshold for the duration alarm as percentage of the function's timeout value.
Default: 80
errorsPerMinuteThreshold?๐Ÿ”น number Number of allowed errors per minute.
Default: 0
throttlesPerMinuteThreshold?๐Ÿ”น number Number of allowed throttles per minute.
Default: 0

struct WatchLambdaFunctionProps ๐Ÿ”น

Name Type Description
fn๐Ÿ”น aws_lambda.Function
title๐Ÿ”น string
watchful๐Ÿ”น IWatchful
durationThresholdPercent?๐Ÿ”น number Threshold for the duration alarm as percentage of the function's timeout value.
Default: 80
errorsPerMinuteThreshold?๐Ÿ”น number Number of allowed errors per minute.
Default: 0
throttlesPerMinuteThreshold?๐Ÿ”น number Number of allowed throttles per minute.
Default: 0

struct WatchRdsAuroraOptions ๐Ÿ”น

Name Type Description
cpuMaximumThresholdPercent?๐Ÿ”น number Threshold for the Cpu Maximum utilization.
Default: 80
dbBufferCacheMinimumThreshold?๐Ÿ”น number Threshold for the Minimum Db Buffer Cache.
Default: 0.
dbConnectionsMaximumThreshold?๐Ÿ”น number Threshold for the Maximum Db Connections.
Default: 0.
dbReplicaLagMaximumThreshold?๐Ÿ”น number Threshold for the Maximum Db ReplicaLag.
Default: 0.
dbThroughputMaximumThreshold?๐Ÿ”น number Threshold for the Maximum Db Throughput.
Default: 0.

struct WatchRdsAuroraProps ๐Ÿ”น

Name Type Description
cluster๐Ÿ”น aws_rds.DatabaseCluster
title๐Ÿ”น string
watchful๐Ÿ”น IWatchful
cpuMaximumThresholdPercent?๐Ÿ”น number Threshold for the Cpu Maximum utilization.
Default: 80
dbBufferCacheMinimumThreshold?๐Ÿ”น number Threshold for the Minimum Db Buffer Cache.
Default: 0.
dbConnectionsMaximumThreshold?๐Ÿ”น number Threshold for the Maximum Db Connections.
Default: 0.
dbReplicaLagMaximumThreshold?๐Ÿ”น number Threshold for the Maximum Db ReplicaLag.
Default: 0.
dbThroughputMaximumThreshold?๐Ÿ”น number Threshold for the Maximum Db Throughput.
Default: 0.

struct WatchStateMachineOptions ๐Ÿ”น

Name Type Description
metricFailedThreshold?๐Ÿ”น number Alarm when execution failures reach this threshold over 1 minute.
Default: 1 any execution failure will trigger the alarm

struct WatchStateMachineProps ๐Ÿ”น

Name Type Description
stateMachine๐Ÿ”น aws_stepfunctions.StateMachine
title๐Ÿ”น string
watchful๐Ÿ”น IWatchful
metricFailedThreshold?๐Ÿ”น number Alarm when execution failures reach this threshold over 1 minute.
Default: 1 any execution failure will trigger the alarm

struct WatchedOperation ๐Ÿ”น

An operation (path and method) worth monitoring.

Name Type Description
httpMethod๐Ÿ”น string The HTTP method for the operation (GET, POST, ...).
resourcePath๐Ÿ”น string The REST API path for this operation (/, /resource/{id}, ...).

struct WatchfulAspectProps ๐Ÿ”น

Name Type Description
apiGateway?๐Ÿ”น boolean Automatically watch API Gateway APIs in the scope.
Default: true
dynamodb?๐Ÿ”น boolean Automatically watch all Amazon DynamoDB tables in the scope.
Default: true
ec2ecs?๐Ÿ”น boolean Automatically watch ApplicationLoadBalanced EC2 Ecs Services in the scope (using ECS Pattern).
Default: true
fargateecs?๐Ÿ”น boolean Automatically watch ApplicationLoadBalanced Fargate Ecs Services in the scope (using ECS Pattern).
Default: true
lambda?๐Ÿ”น boolean Automatically watch AWS Lambda functions in the scope.
Default: true
rdsaurora?๐Ÿ”น boolean Automatically watch RDS Aurora clusters in the scope.
Default: true
stateMachine?๐Ÿ”น boolean Automatically watch AWS state machines in the scope.
Default: true

struct WatchfulProps ๐Ÿ”น

Name Type Description
alarmActionArns?๐Ÿ”น Array ARNs of actions to perform when alarms go off.
Default: [] You can use alarmActions instead as a strongly-typed alternative.
alarmActions?๐Ÿ”น Array<aws_cloudwatch.IAlarmAction> CloudWatch alarm actions to perform when alarms go off.
Optional
alarmEmail?๐Ÿ”น string Email address to send alarms to.
Default: alarms are not sent to an email recipient.
alarmSns?๐Ÿ”น aws_sns.ITopic SNS topic to send alarms to.
Default: alarms are not sent to an SNS Topic.
alarmSqs?๐Ÿ”น aws_sqs.IQueue SQS queue to send alarms to.
Default: alarms are not sent to an SQS queue.
dashboard?๐Ÿ”น boolean Whether to generate CloudWatch dashboards.
Default: true
dashboardName?๐Ÿ”น string The name of the CloudWatch dashboard generated by Watchful.
Default: auto-generated