Skip to content

Commit

Permalink
Fix: Conditional Datadog configurations (#32)
Browse files Browse the repository at this point in the history
* Add var.datadog_dashboards_enabled to toggle dashboard provisioning

* Fix case when var.additional_environment_variables.DD_TAGS is empty

* Add diagrams to "Architecture" section in README
TylerHendrickson authored Apr 7, 2023
1 parent 3f7a3ba commit 9919c19
Showing 8 changed files with 25 additions and 5 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -15,7 +15,18 @@ per-grant data records that can be consumed whenever updates to the underlying d

This service consists of an event-driven pipeline that uses AWS Lambda for running various
compute tasks. Additionally, Amazon S3 is used for archival storage of raw source data, while
DynamoDB provides an active index of processed grant opportunity records.
DynamoDB provides an active index of processed grant opportunity records. At the end of the ingestion
pipeline, newly-created/-updated grant opportunity records are sent to an event bus that delivers
the updates to subscribers.

<details>
<summary>High-level architecture</summary>
<img src="docs/high-level-architecture.png"/>
</details>
<details>
<summary>Component-level architecture</summary>
<img src="docs/component-level-architecture.png"/>
</details>


## Code Organization
Binary file added docs/component-level-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/high-level-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions terraform/datadog_dashboard.tf
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ locals {
}

resource "datadog_dashboard" "service_dashboard" {
count = var.datadog_dashboards_enabled ? 1 : 0

title = trimspace("Grants Ingest Service Dashboard ${local.datadog_draft_label}")
description = "Dashboard for monitoring the Grants Ingest pipeline service."
layout_type = "ordered"
1 change: 1 addition & 0 deletions terraform/local.tfvars
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ namespace = "grants-ingest"
environment = "sandbox"
version_identifier = "dev"
datadog_enabled = false
datadog_dashboards_enabled = false
datadog_lambda_extension_version = "38"
lambda_default_log_retention_in_days = 7
lambda_default_log_level = "DEBUG"
4 changes: 2 additions & 2 deletions terraform/modules/DownloadGrantsGovDB/main.tf
Original file line number Diff line number Diff line change
@@ -19,8 +19,8 @@ locals {
lambda_trigger = var.eventbridge_scheduler_enabled ? local.eventbridge_scheduler_trigger : local.cloudwatch_events_trigger
dd_tags = merge(
{
for item in split(",", try(var.additional_environment_variables.DD_TAGS, "")) :
split(":", trimspace(item))[0] => split(":", trimspace(item))[1]
for item in compact(split(",", try(var.additional_environment_variables.DD_TAGS, ""))) :
split(":", trimspace(item))[0] => try(split(":", trimspace(item))[1], "")
},
var.datadog_custom_tags,
{ handlername = lower(var.function_name), },
4 changes: 2 additions & 2 deletions terraform/modules/SplitGrantsGovXMLDB/main.tf
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@ terraform {
locals {
dd_tags = merge(
{
for item in split(",", try(var.additional_environment_variables.DD_TAGS, "")) :
trimspace(split(":", item)[0]) => trimspace(split(":", item)[1])
for item in compact(split(",", try(var.additional_environment_variables.DD_TAGS, ""))) :
split(":", trimspace(item))[0] => try(split(":", trimspace(item))[1], "")
},
var.datadog_custom_tags,
{ handlername = lower(var.function_name), },
6 changes: 6 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -84,6 +84,12 @@ variable "datadog_enabled" {
default = false
}

variable "datadog_dashboards_enabled" {
description = "Whether to provision Datadog dashboards."
type = bool
default = true
}

variable "datadog_api_key" {
description = "API key to use when provisioning Datadog resources."
type = string

0 comments on commit 9919c19

Please sign in to comment.