Skip to content

Commit

Permalink
Merge branch 'main' into new-grant-details
Browse files Browse the repository at this point in the history
  • Loading branch information
adele-usdr authored Dec 13, 2023
2 parents f4712ce + 17db4ea commit ca3f27f
Show file tree
Hide file tree
Showing 13 changed files with 166 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"dependencies": {
"@braid/vue-formulate": "^2.5.3",
"@datadog/browser-rum": "^5.5.0",
"bootstrap": "^4.6.1",
"bootstrap-vue": "^2.19.0",
"core-js": "^3.21.1",
Expand Down
7 changes: 7 additions & 0 deletions packages/client/src/arpa_reporter/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/* eslint-disable import/first */
import { datadogRum } from '@datadog/browser-rum';

if (window.APP_CONFIG?.DD_RUM_ENABLED === true) {
datadogRum.init(window.APP_CONFIG.DD_RUM_CONFIG);
}

import Vue from 'vue';
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue';
import App from './App.vue';
Expand Down
7 changes: 7 additions & 0 deletions packages/client/src/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/* eslint-disable import/first */
import { datadogRum } from '@datadog/browser-rum';

if (window.APP_CONFIG?.DD_RUM_ENABLED === true) {
datadogRum.init(window.APP_CONFIG.DD_RUM_CONFIG);
}

import Vue from 'vue';
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue';
import vSelect from 'vue-select';
Expand Down
35 changes: 35 additions & 0 deletions service.datadog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/DataDog/schema/main/service-catalog/v2.1/schema.json
schema-version: v2.1
application: GOST
description: >
GOST is a platform that hosts tools to enable state and local government officials to
more easily apply for and report on their federal grants.
dd-service: gost
team: usdr-grants
contacts:
- type: slack
contact: https://usdigitalresponse.slack.com/archives/C0324KDQSCR
links:
- name: Source
type: repo
provider: github
url: https://github.com/usdigitalresponse/usdr-gost
- name: Service Monitoring Dashboard
type: dashboard
url: https://app.datadoghq.com/dashboard/kdw-rtz-5pb/
- name: ARPA Audit Report Dashboard
type: dashboard
url: https://app.datadoghq.com/dashboard/5gk-g5h-p7t
- name: Project Development Board
type: other
url: https://github.com/orgs/usdigitalresponse/projects/5/views/1
- name: Grants Program Wiki
type: doc
url: https://www.notion.so/usdr/Grants-Program-Wiki-44d6252c85344eb3b0077a9eb4f0fc5c
- name: Federal Grant Finder product documentation
type: doc
url: https://www.notion.so/usdr/Federal-Grant-Finder-54ffac3935ec478aa3c78c31e98a81ed
- name: ARPA Quarterly Reporter product documentation
type: doc
url: https://www.notion.so/usdr/ARPA-Quarterly-P-E-Reporter-ebd0a1ac2a7f4653b35517819befa9ea
12 changes: 12 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ module "website" {
origin_artifacts_dist_path = coalesce(
var.website_origin_artifacts_dist_path, "${path.root}/../packages/client/dist"
)

datadog_rum_enabled = var.website_datadog_rum_enabled
datadog_rum_config = merge(var.website_datadog_rum_options, {
applicationId = "15db471e-2ccb-4d3c-a6bf-99b750d748f5"
clientToken = "pub50834fcc1999d53e546519b1a0f03934"
site = "datadoghq.com"
service = local.unified_service_tags.service
env = local.unified_service_tags.env
version = local.unified_service_tags.version
defaultPrivacyLevel = "mask"
allowedTracingUrls = ["https://${local.api_domain_name}"]
})
}

module "api_to_postgres_security_group" {
Expand Down
5 changes: 5 additions & 0 deletions terraform/modules/gost_api/gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ module "api_gateway" {
allow_headers = [
"authorization",
"content-type",
"traceparent",
"x-amz-date",
"x-amz-security-token",
"x-amz-user-agent",
"x-api-key",
"x-datadog-trace-id",
"x-datadog-parent-id",
"x-datadog-origin",
"x-datadog-sampling-priority",
]
max_age = 86400 // 24 hours, in seconds
}
Expand Down
6 changes: 4 additions & 2 deletions terraform/modules/gost_website/runtime_config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ locals {
deployConfigContents = templatefile(
"${path.module}/tpl/deploy-config.js",
{
gost_api_domain = var.gost_api_domain,
feature_flags = jsonencode(var.feature_flags),
gost_api_domain = var.gost_api_domain
feature_flags = jsonencode(var.feature_flags)
dd_rum_enabled = var.datadog_rum_enabled
dd_rum_config = jsonencode(var.datadog_rum_config)
}
)
}
Expand Down
4 changes: 4 additions & 0 deletions terraform/modules/gost_website/tpl/deploy-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
window.APP_CONFIG = window.APP_CONFIG || {};
window.APP_CONFIG.apiURLForGOST = 'https://${gost_api_domain}/';
window.apiURLForGOST = window.APP_CONFIG.apiURLForGOST; // Legacy

window.APP_CONFIG.DD_RUM_ENABLED = ${dd_rum_enabled};
window.APP_CONFIG.DD_RUM_CONFIG = JSON.parse(${dd_rum_config});

window.APP_CONFIG.featureFlags = ${feature_flags};

window.APP_CONFIG.overrideFeatureFlag = (flagName, overrideValue) => {
Expand Down
31 changes: 31 additions & 0 deletions terraform/modules/gost_website/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,37 @@ variable "gost_api_domain" {
type = string
}

variable "datadog_rum_enabled" {
description = "Whether to enable Datadog RUM."
type = bool
default = false
}

variable "datadog_rum_config" {
description = "Runtime configuration options for Datadog RUM."
type = object({
applicationId = string
clientToken = string
site = string
service = string
env = string
version = string
sessionSampleRate = number
sessionReplaySampleRate = number
trackUserInteractions = bool
trackResources = bool
trackLongTasks = bool
defaultPrivacyLevel = string
allowedTracingUrls = list(string)
})
default = null

validation {
condition = can(jsonencode(var.datadog_rum_config))
error_message = "Value must be JSON-serializable."
}
}

variable "feature_flags" {
description = "Feature flags for configuring the website runtime"
type = any
Expand Down
8 changes: 8 additions & 0 deletions terraform/prod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ website_managed_waf_rules = {
metric_visibility = true
}
}
website_datadog_rum_enabled = true
website_datadog_rum_options = {
sessionSampleRate = 80
sessionReplaySampleRate = 20
trackUserInteractions = true
trackResources = true
trackLongTasks = true
}
website_feature_flags = {
myProfileEnabled = false,
newTerminologyEnabled = false,
Expand Down
8 changes: 8 additions & 0 deletions terraform/staging.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ website_managed_waf_rules = {
metric_visibility = true
}
}
website_datadog_rum_enabled = true
website_datadog_rum_options = {
sessionSampleRate = 10
sessionReplaySampleRate = 1
trackUserInteractions = true
trackResources = true
trackLongTasks = true
}
website_feature_flags = {
myProfileEnabled = true,
newTerminologyEnabled = true,
Expand Down
24 changes: 24 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,30 @@ variable "website_origin_artifacts_dist_path" {
default = ""
}

variable "website_datadog_rum_enabled" {
description = "Whether to enable Datadog RUM on the website."
type = bool
default = false
}

variable "website_datadog_rum_options" {
description = "Configuration options for Datadog RUM data collection (if var.website_datadog_rum_enabled is true)."
type = object({
sessionSampleRate = number
sessionReplaySampleRate = number
trackUserInteractions = bool
trackResources = bool
trackLongTasks = bool
})
default = {
sessionSampleRate = 100
sessionReplaySampleRate = 20
trackUserInteractions = true
trackResources = true
trackLongTasks = true
}
}

variable "website_feature_flags" {
description = "Map of website feature flag names and their values."
type = any
Expand Down
20 changes: 20 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,26 @@
debug "^3.1.0"
lodash.once "^4.1.1"

"@datadog/[email protected]":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@datadog/browser-core/-/browser-core-5.5.0.tgz#9de07fd46fbabbce0a30368394f612512869053c"
integrity sha512-orkbetqiXBrF3r9/WImwJG32tEtNjx2hfP7cyBvPw5qhdjOHkl87IdrKqELaadIAc7Tjgmn38TWccSmcRa1rVw==

"@datadog/[email protected]":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@datadog/browser-rum-core/-/browser-rum-core-5.5.0.tgz#fffb23643cd8be62f12e9781024a3f3fda09e1f9"
integrity sha512-VWI91gwKYTGMycpN5a8kgJ/YCdcnvYAhU2uk6HbTLNg2xj4368FyOdSFOQgQzBvmM323AFS+G0v5u+eQgtNgfQ==
dependencies:
"@datadog/browser-core" "5.5.0"

"@datadog/browser-rum@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@datadog/browser-rum/-/browser-rum-5.5.0.tgz#b677b5684773db11a24c8b8dec3b0674416f625a"
integrity sha512-nsK9hrD4yuyiSJ2B+R0KVeb61Xj4rwVIIF6mGsNYIaX4sN51Qw/lz5GkOca3YwskS0zMoyicjEWKFZnzq5Q7ew==
dependencies:
"@datadog/browser-core" "5.5.0"
"@datadog/browser-rum-core" "5.5.0"

"@datadog/[email protected]":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@datadog/native-appsec/-/native-appsec-4.0.0.tgz#ee08138b987dec557eac3650a43a972dac85b6a6"
Expand Down

0 comments on commit ca3f27f

Please sign in to comment.