Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.2 KB
Raw Blame
import * as datadog from '@pulumi/datadog';
import { goalertWebhooks } from './goalert';
import { RENOTIFY_MINUTES } from './notify';

/**
 * A monitor that already exists in Datadog and was adopted into this stack by
 * `pulumi import` (see README). `protect` is the point: these monitors predate
 * the stack, several of them page on-call, and a program that no longer declares
 * one would otherwise delete it on the next deploy. Protected resources fail the
 * deploy instead.
 *
 * To retire a monitor, drop `protect` in its own commit, then delete it.
 */
export function adopted(
  name: string,
  args: datadog.MonitorArgs
): datadog.Monitor {
  // All imported monitors allow partial evaluation windows. The provider
  // defaults to true when omitted, which would change their alert behavior.
  // Datadog omits host delay when group delay applies. Keep the provider's
  // default explicit after normalizing imported state; group delay wins.
  return new datadog.Monitor(
    name,
    {
      requireFullWindow: false,
      newHostDelay: 300,
      renotifyInterval: RENOTIFY_MINUTES,
      ...args,
    },
    // Messages mention the GoAlert webhooks, which must exist first.
    { protect: true, dependsOn: goalertWebhooks }
  );
}