<commit_before>variable "datadog_api_key" {}
variable "datadog_app_key" {}
variable "env" {}

provider "datadog" {
    api_key = "${var.datadog_api_key}"
    app_key = "${var.datadog_app_key}"
}

resource "datadog_monitor" "router" {
  name = "${format("%s router hosts", var.env)}"
  type = "service check"
  message = "Missing router hosts in environment {{host.environment}}. Notify: <EMAIL>"
  escalation_message = "Missing router hosts! Check VM state."
  no_data_timeframe = "2"
  query = "${format("'datadog.agent.up'.over('environment:%s','job:router').by('*').last(1).pct_by_status()", var.env)}"

  thresholds {
    ok = 0
    warning = 0
    critical = 10
  }

  require_full_window = true
  tags {
    "environment" = "${var.env}"
    "job" = "router"
  }
}
<commit_msg>Create a new dashboard with some custom graphs<commit_after>variable "datadog_api_key" {}
variable "datadog_app_key" {}
variable "env" {}

provider "datadog" {
    api_key = "${var.datadog_api_key}"
    app_key = "${var.datadog_app_key}"
}

resource "datadog_monitor" "router" {
  name = "${format("%s router hosts", var.env)}"
  type = "service check"
  message = "Missing router hosts in environment {{host.environment}}. Notify: <EMAIL>"
  escalation_message = "Missing router hosts! Check VM state."
  no_data_timeframe = "2"
  query = "${format("'datadog.agent.up'.over('environment:%s','job:router').by('*').last(1).pct_by_status()", var.env)}"

  thresholds {
    ok = 0
    warning = 0
    critical = 10
  }

  require_full_window = true
  tags {
    "environment" = "${var.env}"
    "job" = "router"
  }
}

resource "datadog_timeboard" "gorouter" {
  title = "${format("%s gorouter", var.env)}"
  description = "Monitoring GoRouter"
  read_only = true

  graph {
    title = "Total Routes"
    viz = "timeseries"
    request {
      q = "${format("avg:cf.gorouter.total_routes{deployment:%s,job:router}", var.env)}"
    }
  }

  graph {
    title = "Running GoRoutines"
    viz = "timeseries"
    request {
      q = "${format("avg:cf.MetronAgent.numGoRoutines{deployment:%s,job:router}", var.env)}"
    }
  }

  graph {
    title = "Requests vs. Responses"
    viz = "timeseries"
    request {
      q = "${format("avg:cf.gorouter.total_requests{deployment:%s,job:router}", var.env)}"
    }

    request {
      q = "${format("avg:cf.gorouter.responses{deployment:%s,job:router}", var.env)}"
    }
  }

  graph {
    title = "Last registry update"
    viz = "timeseries"
    request {
      q = "${format("avg:cf.gorouter.ms_since_last_registry_update{deployment:%s,job:router}", var.env)}"
    }
  }
}
{'fraction_non_alphanumeric': 0.1707787201233616, 'fraction_numerical': 0.004626060138781804, 'mean_word_length': 3.7181818181818183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6585861', 'n_tokens_mistral': 947, 'n_tokens_neox': 924, 'n_words': 181}