Skip to content

Constructs

Multiple constructs are available within the abc-oac-lib package. Below are details on a few of them:

CfnabcDatadogMonitor

This construct helps to build out various Datadog Monitors:

The general constructor looks like:

new CfnabcDatadogMonitor(scope, id, props): CfnabcDatadogMonitorProps

The props that it expects are:

export interface CfnabcDatadogMonitorProps {
  Message?: string
  Name?: String
  Tags?: string[]
  Priority?: number
  Options?: CfnMonitorOptions
  Query: string
  Type: string
  Multi?: boolean
  RestrictedRoles?: string[]
}

Options provides some very interesting settings that can be set:

export interface CfnMonitorOptions {
  EnableLogsSample?: boolean
  EscalationMessage?: string
  EvaluationDelay?: number
  IncludeTags?: boolean
  Locked?: boolean
  MinLocationFailed?: number
  NewHostDelay?: number
  NoDataTimeframe?: number
  NotifyAudit?: boolean
  NotifyNoData?: boolean
  RenotifyInterval?: number
  RequireFullWindow?: boolean
  SyntheticsCheckID?: number
  Thresholds?: CfnMonitorThresholds
  ThresholdWindows?: CfnMonitorThresholdWindows
  TimeoutH?: number
  RenotifyOccurrences?: number
  RenotifyStatuses?: CfnRenotifyStatuses[]
  MinFailureDuration?: number
  NewGroupDelay?: number
  Variables?: CfnMonitorFormulaAndFunctionEventQueryDefinition[]
  NotificationPresetName?: CfnNotificationPresetName
  OnMissingData?: CfnOnMissingData
}

This allows you to handle whether the monitor will alert if there is no data or if there is missing data. For example setting NotifyNoData to false will prevent being notified in the case that the monitor has no data coming in.

CfnabcDatadogDashboard

This construct creates a Datadog Dashboard via CDK. The constructor takes two parameters

export interface CfnabcDatadogDashboardProps {
  DashboardDefinition: string
  forceDeploy?: boolean
}

The DashboardDefinition is the exported json of a Datadog Dashboard. forceDeploy is an optional parameter that changes the id of the construct, forcing a deployment. This can be used in cases where drift has occurred between the version checked into source code and the dashboard as it appears in Datadog.

abcEndpointDatadogMonitorsPerEnvironment

This construct helps to build out endpoint monitors with different values for different environments.

The general constructor looks like:

new abcEndpointDatadogMonitorsPerEnvironment(scope, id, props): abcEndpointDatadogMonitorsPerEnvironment

The props that it expects are:

interface abcEnvironmentEndpointDatadogMonitorsProps {
    dev?: abcEndpointDatadogMonitorsProps;
    prod?: abcEndpointDatadogMonitorsProps;
    test?: abcEndpointDatadogMonitorsProps;
}

Each of the environments takes the same setup as a single monitor to help provide the granularity expected:

interface abcEndpointDatadogMonitorsProps {
    app: abcDatadogMonitorAppProps;
    endpoints: abcSingleEndpointDatadogMonitorsProps[];
    notifyNoDataTimeframe?: number;
    priorities?: abcDatadogMonitorPrioritiesProps;
    regions?: string[];
    responders: abcDatadogMonitorResponderProps;
    runbookUrl?: string;
    tags?: Record<string, string>;
}

This construct is helpful whenever you want to monitor similar endpoints across environments, but you don't necessarily need to alert as much on a lower lifecycle.