resource "datadog_dashboard" "snowflake_ar_to_neo_sync" {
  title       = "Prod Art Relations to Neo4j Sync"
  description = "Dashboard for Snowflake ar-to-neo-sync metrics in ${var.environment} environment"
  layout_type = "free"

  # --- Art Relations column ---

  widget {
    note_definition {
      content          = "Art Relations"
      font_size        = 24
      text_align       = "center"
      background_color = "white"
    }
    widget_layout {
      x      = 0
      y      = 0
      width  = 16
      height = 5
    }
  }

  widget {
    query_value_definition {
      title = "Projects AR only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.project_art_relations_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 5
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Products AR only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.product_art_relations_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 19
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Release Artists AR Only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.release_artist_art_relations_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 33
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Release Artist Missing Participation"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.release_artist_without_label_participation{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 47
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Tracks AR only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_art_relations_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 61
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "ISRC AR only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.isrc_art_relations_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 75
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Artists AR Only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_artist_art_relations_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 89
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Artist Missing Participation"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_artist_without_label_participation{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 103
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Writer AR only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_writer_art_relations_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 117
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Writer Missing Participation"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_writer_without_label_participation{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 131
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "product on two or more projects"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.product_on_two_projects{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 0
      y      = 145
      width  = 16
      height = 14
    }
  }

  # --- Neo4j column ---

  widget {
    note_definition {
      content          = "Neo4j"
      font_size        = 24
      text_align       = "center"
      background_color = "white"
    }
    widget_layout {
      x      = 16
      y      = 0
      width  = 16
      height = 5
    }
  }

  widget {
    query_value_definition {
      title = "Projects Neo4j Only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.project_neo4j_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 5
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Products Neo4j Only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.product_neo4j_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 19
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Release Artists Neo4j Only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.release_artist_neo4j_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 33
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Release Artist Incorrect Participation"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.label_participation_without_release_artist{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 47
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Tracks Neo4j only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_neo4j_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 61
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "ISRC Neo4j only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.isrc_neo4j_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 75
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Artists Neo4j only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_artist_neo4j_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 89
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Artist Incorrect Participation"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.label_participation_without_track_artist{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 103
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Writer Neo4j only"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_writer_neo4j_only{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 117
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Writer Incorrect Participation"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.label_participation_without_track_writer{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 131
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "product on no projects"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.product_on_no_projects{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 16
      y      = 145
      width  = 16
      height = 14
    }
  }

  # --- Metadata column ---

  widget {
    note_definition {
      content          = "Metadata"
      font_size        = 24
      text_align       = "center"
      background_color = "white"
    }
    widget_layout {
      x      = 32
      y      = 0
      width  = 16
      height = 5
    }
  }

  widget {
    query_value_definition {
      title = "Projects different metadata"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.project_different_metadata{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 32
      y      = 5
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Products different metadata"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.product_different_metadata{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 32
      y      = 19
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Release Artists different metadata"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.release_artist_different_metadata{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 32
      y      = 33
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Tracks different metadata"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_different_metadata{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 32
      y      = 61
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Artists different metadata"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_artist_different_metadata{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 32
      y      = 89
      width  = 16
      height = 14
    }
  }

  widget {
    query_value_definition {
      title = "Track Writers different metadata"
      request {
        q          = "avg:snowflake.custom.ar_to_neo_sync.track_writer_different_metadata{*}"
        aggregator = "last"
      }
      precision = "0"
    }
    widget_layout {
      x      = 32
      y      = 117
      width  = 16
      height = 14
    }
  }

  # --- Difference History ---

  widget {
    note_definition {
      content          = "Difference History"
      font_size        = 24
      text_align       = "center"
      background_color = "white"
    }
    widget_layout {
      x      = 48
      y      = 0
      width  = 55
      height = 5
    }
  }

  widget {
    timeseries_definition {
      title         = "Projects"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "AR Only"
          formula_expression = "project_art_relations_only"
        }
        formula {
          alias              = "Neo4J Only"
          formula_expression = "project_neo4j_only"
        }
        formula {
          alias              = "Different Metadata"
          formula_expression = "project_different_metadata"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.project_art_relations_only{*}"
            name  = "project_art_relations_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.project_neo4j_only{*}"
            name  = "project_neo4j_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.project_different_metadata{*}"
            name  = "project_different_metadata"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 5
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Products"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "AR Only"
          formula_expression = "product_art_relations_only"
        }
        formula {
          alias              = "Neo4J Only"
          formula_expression = "product_neo4j_only"
        }
        formula {
          alias              = "Different Metadata"
          formula_expression = "product_different_metadata"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.product_art_relations_only{*}"
            name  = "product_art_relations_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.product_neo4j_only{*}"
            name  = "product_neo4j_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.product_different_metadata{*}"
            name  = "product_different_metadata"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 19
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Release Artists"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "AR Only"
          formula_expression = "release_artist_art_relations_only"
        }
        formula {
          alias              = "Neo4J Only"
          formula_expression = "release_artist_neo4j_only"
        }
        formula {
          alias              = "Different Metadata"
          formula_expression = "release_artist_different_metadata"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.release_artist_art_relations_only{*}"
            name  = "release_artist_art_relations_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.release_artist_neo4j_only{*}"
            name  = "release_artist_neo4j_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.release_artist_different_metadata{*}"
            name  = "release_artist_different_metadata"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 33
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Release Artist Participations"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "Missing Participations"
          formula_expression = "release_artist_without_label_participation"
        }
        formula {
          alias              = "Incorrect Participations"
          formula_expression = "label_participation_without_release_artist"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.release_artist_without_label_participation{*}"
            name  = "release_artist_without_label_participation"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.label_participation_without_release_artist{*}"
            name  = "label_participation_without_release_artist"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 47
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Unmatched Tracks (log scale)"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "AR Only"
          formula_expression = "track_art_relations_only"
        }
        formula {
          alias              = "Neo4J Only"
          formula_expression = "track_neo4j_only"
        }
        formula {
          alias              = "Different Metadata"
          formula_expression = "track_different_metadata"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_art_relations_only{*}"
            name  = "track_art_relations_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_neo4j_only{*}"
            name  = "track_neo4j_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_different_metadata{*}"
            name  = "track_different_metadata"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 61
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "ISRC"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "AR Only"
          formula_expression = "isrc_art_relations_only"
        }
        formula {
          alias              = "Neo4J Only"
          formula_expression = "isrc_neo4j_only"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.isrc_art_relations_only{*}"
            name  = "isrc_art_relations_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.isrc_neo4j_only{*}"
            name  = "isrc_neo4j_only"
          }
        }
      }
    }
    widget_layout {
      x      = 48
      y      = 75
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Track Artists"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "AR Only"
          formula_expression = "track_artist_art_relations_only"
        }
        formula {
          alias              = "Neo4J Only"
          formula_expression = "track_artist_neo4j_only"
        }
        formula {
          alias              = "Different Metadata"
          formula_expression = "track_artist_different_metadata"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_artist_art_relations_only{*}"
            name  = "track_artist_art_relations_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_artist_neo4j_only{*}"
            name  = "track_artist_neo4j_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_artist_different_metadata{*}"
            name  = "track_artist_different_metadata"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 89
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Track Artist Participations"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "Missing Participations"
          formula_expression = "track_artist_without_label_participation"
        }
        formula {
          alias              = "Incorrect Participations"
          formula_expression = "label_participation_without_track_artist"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_artist_without_label_participation{*}"
            name  = "track_artist_without_label_participation"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.label_participation_without_track_artist{*}"
            name  = "label_participation_without_track_artist"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 103
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Unmatched Track Writers (log scale)"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "AR Only"
          formula_expression = "track_writer_art_relations_only"
        }
        formula {
          alias              = "Neo4J Only"
          formula_expression = "track_writer_neo4j_only"
        }
        formula {
          alias              = "Different Metadata"
          formula_expression = "track_writer_different_metadata"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_writer_art_relations_only{*}"
            name  = "track_writer_art_relations_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_writer_neo4j_only{*}"
            name  = "track_writer_neo4j_only"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_writer_different_metadata{*}"
            name  = "track_writer_different_metadata"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 117
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Track Writer Participations"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "Missing Participations"
          formula_expression = "track_writer_without_label_participation"
        }
        formula {
          alias              = "Incorrect Participations"
          formula_expression = "label_participation_without_track_writer"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.track_writer_without_label_participation{*}"
            name  = "track_writer_without_label_participation"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.label_participation_without_track_writer{*}"
            name  = "label_participation_without_track_writer"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 131
      width  = 55
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title         = "Product Project Relationships"
      show_legend   = true
      legend_layout = "horizontal"

      request {
        formula {
          alias              = "product on no projects"
          formula_expression = "product_on_no_projects"
        }
        formula {
          alias              = "product on two or more projects"
          formula_expression = "product_on_two_projects"
        }

        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.product_on_no_projects{*}"
            name  = "product_on_no_projects"
          }
        }
        query {
          metric_query {
            query = "avg:snowflake.custom.ar_to_neo_sync.product_on_two_projects{*}"
            name  = "product_on_two_projects"
          }
        }
      }

      yaxis {
        scale = "log"
      }
    }
    widget_layout {
      x      = 48
      y      = 145
      width  = 55
      height = 14
    }
  }


  # --- Infrastructure ---

  widget {
    note_definition {
      content          = "Infrastructure"
      font_size        = 24
      text_align       = "center"
      background_color = "white"
    }
    widget_layout {
      x      = 103
      y      = 0
      width  = 55
      height = 5
    }
  }

  widget {
    timeseries_definition {
      title = "Sync lambda errors"

      request {
        formula {
          alias              = "Lambda errors"
          formula_expression = "lambda_errors"
        }

        query {
          metric_query {
            query = "avg:aws.lambda.errors{functionname:prod-lambda-kinesis-to-neo4j}"
            name  = "lambda_errors"
          }
        }
      }
    }
    widget_layout {
      x      = 103
      y      = 5
      width  = 47
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title = "Sync lambda throttles"

      request {
        formula {
          alias              = "Lambda throttles"
          formula_expression = "lambda_throttles"
        }

        query {
          metric_query {
            query = "avg:aws.lambda.throttles{functionname:prod-lambda-kinesis-to-neo4j}"
            name  = "lambda_throttles"
          }
        }
      }
    }
    widget_layout {
      x      = 103
      y      = 19
      width  = 47
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title = "Sync lambda iterator age"

      request {
        formula {
          alias              = "Lambda iterator age"
          formula_expression = "lambda_iterator_age"
        }

        query {
          metric_query {
            query = "avg:aws.lambda.iterator_age{functionname:prod-lambda-kinesis-to-neo4j}"
            name  = "lambda_iterator_age"
          }
        }
      }
    }
    widget_layout {
      x      = 103
      y      = 33
      width  = 47
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title = "Kinesis records"

      request {
        formula {
          alias              = "Kinesis records put"
          formula_expression = "records_put"
        }

        query {
          metric_query {
            query = "avg:kinesisproducerlibrary.KinesisRecordsPut{streamname:prod-neo4j-stream}"
            name  = "records_put"
          }
        }
      }
    }
    widget_layout {
      x      = 103
      y      = 47
      width  = 47
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title = "Kinesis iterator age"

      request {
        formula {
          alias              = "Kinesis iterator age (ms)"
          formula_expression = "iterator_age_milliseconds"
        }

        query {
          metric_query {
            query = "avg:aws.kinesis.iterator_age_milliseconds{name:prod-neo4j-stream}"
            name  = "iterator_age_milliseconds"
          }
        }
      }
    }
    widget_layout {
      x      = 103
      y      = 61
      width  = 47
      height = 14
    }
  }

  widget {
    timeseries_definition {
      title = "Kinesis Errors"

      request {
        formula {
          alias              = "Kinesis errors"
          formula_expression = "errors"
        }

        query {
          metric_query {
            query = "avg:kinesisproducerlibrary.AllErrors{streamname:prod-neo4j-stream}"
            name  = "errors"
          }
        }
      }
    }
    widget_layout {
      x      = 103
      y      = 75
      width  = 47
      height = 14
    }
  }

  # -- assert_data_quality failures.
  widget {
    query_table_definition {
      title = "Assert Data quality Failures"

      request {
        formula {
          alias              = "failures"
          formula_expression = "failures"
        }

        query {
          metric_query {
            query = "sum:neo4j_cypher_scheduler.assert_data_quality.failure{*} by {query_file}.as_count()"
            name  = "failures"
          }
        }
      }
    }
    widget_layout {
      x      = 0
      y      = 159
      width  = 48
      height = 27
    }

  }
  # -- assert_data_quality success.
  widget {
    query_table_definition {
      title = "Assert Data quality Success"

      request {
        formula {
          alias              = "success"
          formula_expression = "success"
        }

        query {
          metric_query {
            query = "sum:neo4j_cypher_scheduler.assert_data_quality.success{*} by {query_file}.as_count()"
            name  = "success"
          }
        }
      }
    }
    widget_layout {
      x      = 48
      y      = 159
      width  = 55
      height = 27
    }

  }

}
