import { Construct } from 'constructs'; import { INotification } from '../datadogv2'; import { AbstractWatchful, MetricAlarmProps, MonitorType } from '../watchful'; import { LogAlarmProps } from './datadog-log-alarm'; /** * Log error monitor props */ export interface LogErrorMonitorProps { /** * Configure if monitor needs to be resolved manually every time. This option also sets the renotify interval to 2 hours * @defaultValue false */ readonly disableAutoClose?: boolean; /** * Set the priority of the log error monitor * @defaultValue 3 */ readonly priority?: number; /** * Enable error log monitors creating cases in Datadog. * This property has been deprecated. The propery has been instead nested into logErrorMonitorConfig. * The functionality remains unchanged * * @defaultValue false */ readonly createCasesFromErrorLogMonitors?: boolean; /** * Renotification interval for log error monitor in minutes */ readonly renotifyInterval?: number; } /** * Query error monitor props */ export interface QueryErrorMonitorProps { /** * Set the priority of the log error monitor * @defaultValue 3 */ readonly priority?: number; } /** * Properties for defining Watchful */ export interface WatchfulProps { /** * The service name. * * @defaultValue The stack name. */ readonly serviceName?: string; /** * Set the way how monitors should notify in case of an alert. * * @defaultValue {@link DefaultSlackNotification} */ readonly notification?: INotification; /** * Enable error log monitors creating cases in Datadog. * * @deprecated This property has been deprecated. The propery has been instead nested into logErrorMonitorConfig. The functionality remains unchanged. * @defaultValue false */ readonly createCasesFromErrorLogMonitors?: boolean; /** * Configure log error monitor properties */ readonly logErrorMonitorConfig?: LogErrorMonitorProps; /** * Configure query alert monitors. All monitors created by watchful except for Log error monitor. * Configure property *logErrorMonitor* for Log error monitor. */ readonly queryErrorMonitorConfig?: QueryErrorMonitorProps; } /** * A construct to watch given scope or resources. Opinionated DataDog alarms are automatically created for watched resources. * * Usage with non-default notification: * ```ts * const dw = new watchfulv2.Watchful(this, 'Watchful', { * serviceName: props.serviceName, * notification: new datadogv2.SlackNotification({channel: 'team-alert-channel'}) * }); * dw.watchScope(this); *``` */ export declare class Watchful extends AbstractWatchful { private readonly notification; private readonly createCasesFromErrorLogMonitors; private readonly serviceName; private readonly logErrorMonitorConfig?; private readonly queryErrorMonitorConfig?; constructor(scope: Construct, id: string, props?: WatchfulProps); /** * Adds the alarmTopic as alarm action to the given alarm. * * @param scope - The construct to add the alarm to * @param id - The id of the alarm * @param alarm - The watchful to add those resources to */ createAlarm(scope: Construct, id: MonitorType, alarm: MetricAlarmProps): void; /** * Adds an alert for error logs * @param scope - The construct to add the alarm to * @param id - The id of the alarm * @param alarm - The alarm properties see {@link LogAlarmProps} */ createLogAlarm(scope: Construct, id: MonitorType, alarm: LogAlarmProps): void; /** * Watches the given scope and adds alarms for known resources. */ watchScope(scope: Construct): void; }