From 00c339615811e3feb4c2291602c61d2bed4e1ca5 Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Mon, 7 Aug 2023 10:24:31 -0400 Subject: [PATCH 01/12] Add a default user for metric creation to fix tests --- app/models/metric.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metric.rb b/app/models/metric.rb index 9022b493b6e..f28623bb62e 100644 --- a/app/models/metric.rb +++ b/app/models/metric.rb @@ -77,7 +77,7 @@ def css_id def self.default_object(klass, params, user) { uuid: params[:uuid], - user: user, + user: user || User.new(full_name: "Stand in user for testing", css_id: SecureRandom.uuid, station_id: 'Metrics'), metric_name: params[:name] || METRIC_TYPES[:log], metric_class: klass&.try(:name) || klass&.class.name || self.name, metric_group: params[:group] || METRIC_GROUPS[:service], From 01141df5d355515f6ca7c6352b3e6619efcf6d84 Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Tue, 29 Aug 2023 12:17:38 -0400 Subject: [PATCH 02/12] Change enabled_metric? to enabled? --- app/controllers/help_controller.rb | 2 +- app/controllers/intakes_controller.rb | 2 +- app/views/certifications/v2.html.erb | 2 +- app/views/decision_reviews/index.html.erb | 2 +- app/views/dispatch/establish_claims/index.html.erb | 2 +- app/views/hearings/index.html.erb | 2 +- app/views/inbox/index.html.erb | 2 +- app/views/intake_manager/index.html.erb | 2 +- app/views/queue/index.html.erb | 2 +- app/views/reader/appeal/index.html.erb | 14 +++++++------- app/views/test/users/index.html.erb | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index bcd4b1f84d8..b03af1f4e3d 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -6,7 +6,7 @@ class HelpController < ApplicationController def feature_toggle_ui_hash(user = current_user) { programOfficeTeamManagement: FeatureToggle.enabled?(:program_office_team_management, user: user), - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) } end diff --git a/app/controllers/intakes_controller.rb b/app/controllers/intakes_controller.rb index d1831b82fbf..4bb2df9afea 100644 --- a/app/controllers/intakes_controller.rb +++ b/app/controllers/intakes_controller.rb @@ -153,7 +153,7 @@ def feature_toggle_ui_hash updatedAppealForm: FeatureToggle.enabled?(:updated_appeal_form, user: current_user), hlrScUnrecognizedClaimants: FeatureToggle.enabled?(:hlr_sc_unrecognized_claimants, user: current_user), vhaClaimReviewEstablishment: FeatureToggle.enabled?(:vha_claim_review_establishment, user: current_user), - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) } end diff --git a/app/views/certifications/v2.html.erb b/app/views/certifications/v2.html.erb index 86abe688bf7..8634f07ea5d 100644 --- a/app/views/certifications/v2.html.erb +++ b/app/views/certifications/v2.html.erb @@ -6,7 +6,7 @@ buildDate: build_date, vacolsId: @certification.vacols_id, featureToggles: { - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) } }) %> <% end %> diff --git a/app/views/decision_reviews/index.html.erb b/app/views/decision_reviews/index.html.erb index 53d2e9ef2ae..e377f8dce05 100644 --- a/app/views/decision_reviews/index.html.erb +++ b/app/views/decision_reviews/index.html.erb @@ -11,7 +11,7 @@ businessLineUrl: business_line.url, featureToggles: { decisionReviewQueueSsnColumn: FeatureToggle.enabled?(:decision_review_queue_ssn_column, user: current_user), - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) }, baseTasksUrl: business_line.tasks_url, taskFilterDetails: task_filter_details diff --git a/app/views/dispatch/establish_claims/index.html.erb b/app/views/dispatch/establish_claims/index.html.erb index 1084ca8126e..3c8c256783a 100644 --- a/app/views/dispatch/establish_claims/index.html.erb +++ b/app/views/dispatch/establish_claims/index.html.erb @@ -10,7 +10,7 @@ userQuota: user_quota && user_quota.to_hash, currentUserHistoricalTasks: current_user_historical_tasks.map(&:to_hash), featureToggles: { - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) } }) %> <% end %> diff --git a/app/views/hearings/index.html.erb b/app/views/hearings/index.html.erb index a86792326ac..55241926043 100644 --- a/app/views/hearings/index.html.erb +++ b/app/views/hearings/index.html.erb @@ -31,7 +31,7 @@ userIsBoardAttorney: current_user.attorney?, userIsHearingAdmin: current_user.in_hearing_admin_team?, featureToggles: { - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) } }) %> <% end %> diff --git a/app/views/inbox/index.html.erb b/app/views/inbox/index.html.erb index 0e551431277..dba5d4f67ae 100644 --- a/app/views/inbox/index.html.erb +++ b/app/views/inbox/index.html.erb @@ -10,7 +10,7 @@ pagination: pagination }, featureToggles: { - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) } }) %> <% end %> diff --git a/app/views/intake_manager/index.html.erb b/app/views/intake_manager/index.html.erb index bb52177d28b..9659d728be5 100644 --- a/app/views/intake_manager/index.html.erb +++ b/app/views/intake_manager/index.html.erb @@ -6,7 +6,7 @@ feedbackUrl: feedback_url, buildDate: build_date featureToggles: { - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) } }) %> <% end %> diff --git a/app/views/queue/index.html.erb b/app/views/queue/index.html.erb index 7e96ef7f0d1..5fa1ce56ec4 100644 --- a/app/views/queue/index.html.erb +++ b/app/views/queue/index.html.erb @@ -53,7 +53,7 @@ cavc_remand_granted_substitute_appellant: FeatureToggle.enabled?(:cavc_remand_granted_substitute_appellant, user: current_user), cavc_dashboard_workflow: FeatureToggle.enabled?(:cavc_dashboard_workflow, user: current_user), cc_appeal_workflow: FeatureToggle.enabled?(:cc_appeal_workflow, user: current_user), - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user), + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user), cc_vacatur_visibility: FeatureToggle.enabled?(:cc_vacatur_visibility, user: current_user) } }) %> diff --git a/app/views/reader/appeal/index.html.erb b/app/views/reader/appeal/index.html.erb index 5605a82840b..c6b410cd365 100644 --- a/app/views/reader/appeal/index.html.erb +++ b/app/views/reader/appeal/index.html.erb @@ -11,13 +11,13 @@ interfaceVersion2: FeatureToggle.enabled?(:interface_version_2, user: current_user), windowSlider: FeatureToggle.enabled?(:window_slider, user: current_user), readerSelectorsMemoized: FeatureToggle.enabled?(:bulk_upload_documents, user: current_user), - metricsLogRestError: FeatureToggle.enabled_metric?(:metrics_log_rest_error, user: current_user), - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user), - metricsLoadScreen: FeatureToggle.enabled_metric?(:metrics_load_screen, user: current_user), - metricsRecordPDFJSGetDocument: FeatureToggle.enabled_metric?(:metrics_get_pdfjs_doc, user: current_user), - metricsReaderRenderText: FeatureToggle.enabled_metric?(:metrics_reader_render_text, user: current_user), - metricsLogRestSuccess: FeatureToggle.enabled_metric?(:metrics_log_rest_success, user: current_user), - metricsPdfStorePages: FeatureToggle.enabled_metric?(:metrics_pdf_store_pages, user: current_user), + metricsLogRestError: FeatureToggle.enabled?(:metrics_log_rest_error, user: current_user), + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user), + metricsLoadScreen: FeatureToggle.enabled?(:metrics_load_screen, user: current_user), + metricsRecordPDFJSGetDocument: FeatureToggle.enabled?(:metrics_get_pdfjs_doc, user: current_user), + metricsReaderRenderText: FeatureToggle.enabled?(:metrics_reader_render_text, user: current_user), + metricsLogRestSuccess: FeatureToggle.enabled?(:metrics_log_rest_success, user: current_user), + metricsPdfStorePages: FeatureToggle.enabled?(:metrics_pdf_store_pages, user: current_user), readerGetDocumentLogging: FeatureToggle.enabled?(:reader_get_document_logging, user: current_user) }, buildDate: build_date diff --git a/app/views/test/users/index.html.erb b/app/views/test/users/index.html.erb index 0ac3fbdee9c..3bb0dff6ff5 100644 --- a/app/views/test/users/index.html.erb +++ b/app/views/test/users/index.html.erb @@ -17,7 +17,7 @@ epTypes: ep_types, featureToggles: { interfaceVersion2: FeatureToggle.enabled?(:interface_version_2, user: current_user), - metricsBrowserError: FeatureToggle.enabled_metric?(:metrics_browser_error, user: current_user) + metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user) } }) %> <% end %> From 0b815d8e1bca3aba24bbcd219c21aa8a061ad3d0 Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Tue, 29 Aug 2023 14:14:08 -0400 Subject: [PATCH 03/12] Refactor PdfFile getDocument --- client/app/reader/PdfFile.jsx | 81 ++++++++++------------------------- 1 file changed, 22 insertions(+), 59 deletions(-) diff --git a/client/app/reader/PdfFile.jsx b/client/app/reader/PdfFile.jsx index 30137804c85..a86dec45874 100644 --- a/client/app/reader/PdfFile.jsx +++ b/client/app/reader/PdfFile.jsx @@ -59,10 +59,6 @@ export class PdfFile extends React.PureComponent { this.props.clearDocumentLoadError(this.props.file); - if (this.props.featureToggles.readerGetDocumentLogging) { - return this.getDocumentWithLogging(requestOptions); - } - return this.getDocument(requestOptions); } @@ -73,6 +69,7 @@ export class PdfFile extends React.PureComponent { getDocument = (requestOptions) => { return ApiUtil.get(this.props.file, requestOptions). then((resp) => { + const metricData = { message: `Getting PDF document id: "${this.props.documentId}"`, type: 'performance', @@ -82,11 +79,29 @@ export class PdfFile extends React.PureComponent { } }; - this.loadingTask = PDFJS.getDocument({ data: resp.body }); - const promise = this.loadingTask.promise; + /* The feature toggle reader_get_document_logging adds the progress of the file being loaded in console */ + if (this.props.featureToggles.readerGetDocumentLogging) { + const logId = uuid.v4(); + const src = { + data: resp.body, + verbosity: 5, + stopAtErrors: false, + pdfBug: true, + }; + + this.loadingTask = PDFJS.getDocument(src); + + this.loadingTask.onProgress = (progress) => { + // eslint-disable-next-line no-console + console.log(`${logId} : Progress of ${this.props.file} reached ${progress.loaded} / ${progress.total}`); + }; + } else { + this.loadingTask = PDFJS.getDocument({ data: resp.body }); + } - return recordAsyncMetrics(promise, metricData, + return recordAsyncMetrics(this.loadingTask.promise, metricData, this.props.featureToggles.metricsRecordPDFJSGetDocument); + }, (reason) => this.onRejected(reason, 'getDocument')). then((pdfDocument) => { this.pdfDocument = pdfDocument; @@ -124,58 +139,6 @@ export class PdfFile extends React.PureComponent { }); } - /** - * This version of the method has additional logging and debugging configuration - * It is behind the feature toggle reader_get_document_logging - * - * We have to set withCredentials to true since we're requesting the file from a - * different domain (eFolder), and still need to pass our credentials to authenticate. - */ - getDocumentWithLogging = (requestOptions) => { - const logId = uuid.v4(); - - return ApiUtil.get(this.props.file, requestOptions). - then((resp) => { - const src = { - data: resp.body, - verbosity: 5, - stopAtErrors: false, - pdfBug: true, - }; - - this.loadingTask = PDFJS.getDocument(src); - - this.loadingTask.onProgress = (progress) => { - // eslint-disable-next-line no-console - console.log(`${logId} : Progress of ${this.props.file} reached ${progress}`); - // eslint-disable-next-line no-console - console.log(`${logId} : Progress of ${this.props.file} reached ${progress.loaded} / ${progress.total}`); - }; - - return this.loadingTask.promise; - }, (reason) => this.onRejected(reason, 'getDocument')). - then((pdfDocument) => { - this.pdfDocument = pdfDocument; - - return this.getPages(pdfDocument); - }, (reason) => this.onRejected(reason, 'getPages')). - then((pages) => this.setPageDimensions(pages) - , (reason) => this.onRejected(reason, 'setPageDimensions')). - then(() => { - if (this.loadingTask.destroyed) { - return this.pdfDocument.destroy(); - } - this.loadingTask = null; - - return this.props.setPdfDocument(this.props.file, this.pdfDocument); - }, (reason) => this.onRejected(reason, 'setPdfDocument')). - catch((error) => { - console.error(`${logId} : GET ${this.props.file} : ${error}`); - this.loadingTask = null; - this.props.setDocumentLoadError(this.props.file); - }); - } - onRejected = (reason, step) => { console.error(`${uuid.v4()} : GET ${this.props.file} : STEP ${step} : ${reason}`); throw reason; From ecead70221ef3bbccf4f97f11558c7a97f4a605c Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Thu, 31 Aug 2023 08:31:57 -0400 Subject: [PATCH 04/12] Edit metrics.rb user creation fallback --- app/models/metric.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metric.rb b/app/models/metric.rb index f28623bb62e..fa25186d7b9 100644 --- a/app/models/metric.rb +++ b/app/models/metric.rb @@ -77,7 +77,7 @@ def css_id def self.default_object(klass, params, user) { uuid: params[:uuid], - user: user || User.new(full_name: "Stand in user for testing", css_id: SecureRandom.uuid, station_id: 'Metrics'), + user: user || RequestStore.store[:current_user] || User.system_user, metric_name: params[:name] || METRIC_TYPES[:log], metric_class: klass&.try(:name) || klass&.class.name || self.name, metric_group: params[:group] || METRIC_GROUPS[:service], From 46289fa970d896b68479e22246174c622e258be8 Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Thu, 31 Aug 2023 13:46:58 -0400 Subject: [PATCH 05/12] Edit metrics dashboard so scroll bar starts at top with most recent metrics --- app/views/metrics/dashboard/show.html.erb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/metrics/dashboard/show.html.erb b/app/views/metrics/dashboard/show.html.erb index b427d5c3290..9321919981b 100644 --- a/app/views/metrics/dashboard/show.html.erb +++ b/app/views/metrics/dashboard/show.html.erb @@ -13,7 +13,6 @@ body { .inner_div { max-height: 2000px; overflow-y: auto; - /* ::-webkit-scrollbar { transform: rotateX(180deg); } */ @@ -22,8 +21,14 @@ body { .metric_table { transform: rotateX(180deg); } - + + +

Metrics Dashboard

Shows metrics created in past hour

From 1ca1914a24fad50ca0ff4d1b8ca9cf0983866958 Mon Sep 17 00:00:00 2001 From: kshiflett88 Date: Thu, 31 Aug 2023 11:04:03 -0700 Subject: [PATCH 06/12] Collect Histogram changed to storeMetric --- client/app/reader/PdfPage.jsx | 46 +++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/client/app/reader/PdfPage.jsx b/client/app/reader/PdfPage.jsx index 599f030d385..021a7d85114 100644 --- a/client/app/reader/PdfPage.jsx +++ b/client/app/reader/PdfPage.jsx @@ -225,16 +225,6 @@ export class PdfPage extends React.PureComponent { }, }; - const textMetricData = { - message: 'Storing PDF page text', - product: 'pdfjs.document.pages', - type: 'performance', - data: { - file: this.props.file, - documentId: this.props.documentId, - }, - }; - const pageAndTextFeatureToggle = this.props.featureToggles.metricsPdfStorePages; const document = this.props.pdfDocument; const pageIndex = pageNumberOfPageIndex(this.props.pageIndex); @@ -243,6 +233,16 @@ export class PdfPage extends React.PureComponent { pageResult.then((page) => { this.page = page; + const textMetricData = { + message: 'Storing PDF page text', + product: 'pdfjs.document.pages', + type: 'performance', + data: { + file: this.props.file, + documentId: this.props.documentId, + }, + }; + const readerRenderText = { uuid: uuidv4(), message: 'Searching within Reader document text', @@ -263,18 +263,22 @@ export class PdfPage extends React.PureComponent { }); this.drawPage(page).then(() => { - collectHistogram({ - group: 'front_end', - name: 'pdf_page_render_time_in_ms', - value: this.measureTimeStartMs ? performance.now() - this.measureTimeStartMs : 0, - appName: 'Reader', - attrs: { - documentId: this.props.documentId, - overscan: this.props.windowingOverscan, - documentType: this.props.documentType, - pageCount: this.props.pdfDocument.numPages + const data = { + overscan: this.props.windowingOverscan, + documentType: this.props.documentType, + pageCount: this.props.pdfDocument.numPages + }; + + storeMetrics( + this.props.documentId, + data, + { + message: 'pdf_page_render_time_in_ms', + type: 'performance', + product: 'reader', + start: this.measureTimeStartMs ? performance.now() - this.measureTimeStartMs : 0 } - }); + ); }); }).catch((error) => { const id = uuid.v4(); From b1031e54fe4574c368463432d89e4687c790d6ce Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Thu, 31 Aug 2023 14:17:57 -0400 Subject: [PATCH 07/12] Restore db/schema to the same as 22218 --- db/schema.rb | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index d6c02a977c8..f815801609f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -597,8 +597,6 @@ t.string "diagnostic_code", comment: "If a decision resulted in a rating, this is the rating issue's diagnostic code." t.string "disposition", comment: "The disposition for a decision issue. Dispositions made in Caseflow and dispositions made in VBMS can have different values." t.date "end_product_last_action_date", comment: "After an end product gets synced with a status of CLR (cleared), the end product's last_action_date is saved on any decision issues that are created as a result. This is used as a proxy for decision date for non-rating issues that are processed in VBMS because they don't have a rating profile date, and the exact decision date is not available." - t.boolean "mst_status", default: false, comment: "Indicates if decision issue is related to Military Sexual Trauma (MST)" - t.boolean "pact_status", default: false, comment: "Indicates if decision issue is related to Promise to Address Comprehensive Toxics (PACT) Act" t.string "participant_id", null: false, comment: "The Veteran's participant id." t.string "percent_number", comment: "percent_number from RatingIssue (prcntNo from Rating Profile)" t.string "rating_issue_reference_id", comment: "Identifies the specific issue on the rating that resulted from the decision issue (a rating issue can be connected to multiple contentions)." @@ -1295,7 +1293,7 @@ t.string "appeals_type", null: false, comment: "Type of Appeal" t.datetime "created_at", comment: "Timestamp of when Noticiation was Created" t.boolean "email_enabled", default: true, null: false - t.text "email_notification_content", comment: "Full Email Text Content of Notification" + t.string "email_notification_content", comment: "Full Email Text Content of Notification" t.string "email_notification_external_id", comment: "VA Notify Notification Id for the email notification send through their API " t.string "email_notification_status", comment: "Status of the Email Notification" t.date "event_date", null: false, comment: "Date of Event" @@ -1306,7 +1304,7 @@ t.string "participant_id", comment: "ID of Participant" t.string "recipient_email", comment: "Participant's Email Address" t.string "recipient_phone_number", comment: "Participants Phone Number" - t.text "sms_notification_content", comment: "Full SMS Text Content of Notification" + t.string "sms_notification_content", comment: "Full SMS Text Content of Notification" t.string "sms_notification_external_id", comment: "VA Notify Notification Id for the sms notification send through their API " t.string "sms_notification_status", comment: "Status of SMS/Text Notification" t.datetime "updated_at", comment: "TImestamp of when Notification was Updated" @@ -1501,13 +1499,9 @@ t.string "ineligible_reason", comment: "The reason for a Request Issue being ineligible. If a Request Issue has an ineligible_reason, it is still captured, but it will not get a contention in VBMS or a decision." t.boolean "is_predocket_needed", comment: "Indicates whether or not an issue has been selected to go to the pre-docket queue opposed to normal docketing." t.boolean "is_unidentified", comment: "Indicates whether a Request Issue is unidentified, meaning it wasn't found in the list of contestable issues, and is not a new nonrating issue. Contentions for unidentified issues are created on a rating End Product if processed in VBMS but without the issue description, and someone is required to edit it in Caseflow before proceeding with the decision." - t.boolean "mst_status", default: false, comment: "Indicates if issue is related to Military Sexual Trauma (MST)" - t.text "mst_status_update_reason_notes", comment: "The reason for why Request Issue is Military Sexual Trauma (MST)" t.string "nonrating_issue_category", comment: "The category selected for nonrating request issues. These vary by business line." t.string "nonrating_issue_description", comment: "The user entered description if the issue is a nonrating issue" t.text "notes", comment: "Notes added by the Claims Assistant when adding request issues. This may be used to capture handwritten notes on the form, or other comments the CA wants to capture." - t.boolean "pact_status", default: false, comment: "Indicates if issue is related to Promise to Address Comprehensive Toxics (PACT) Act" - t.text "pact_status_update_reason_notes", comment: "The reason for why Request Issue is Promise to Address Comprehensive Toxics (PACT) Act" t.string "ramp_claim_id", comment: "If a rating issue was created as a result of an issue intaken for a RAMP Review, it will be connected to the former RAMP issue by its End Product's claim ID." t.datetime "rating_issue_associated_at", comment: "Timestamp when a contention and its contested rating issue are associated in VBMS." t.string "split_issue_status", comment: "If a request issue is part of a split, on_hold status applies to the original request issues while active are request issues on splitted appeals" @@ -1518,8 +1512,6 @@ t.datetime "updated_at", comment: "Automatic timestamp whenever the record changes." t.string "vacols_id", comment: "The vacols_id of the legacy appeal that had an issue found to match the request issue." t.integer "vacols_sequence_id", comment: "The vacols_sequence_id, for the specific issue on the legacy appeal which the Claims Assistant determined to match the request issue on the Decision Review. A combination of the vacols_id (for the legacy appeal), and vacols_sequence_id (for which issue on the legacy appeal), is required to identify the issue being opted-in." - t.boolean "vbms_mst_status", default: false, comment: "Indicates if issue is related to Military Sexual Trauma (MST) and was imported from VBMS" - t.boolean "vbms_pact_status", default: false, comment: "Indicates if issue is related to Promise to Address Comprehensive Toxics (PACT) Act and was imported from VBMS" t.boolean "verified_unidentified_issue", comment: "A verified unidentified issue allows an issue whose rating data is missing to be intaken as a regular rating issue. In order to be marked as verified, a VSR needs to confirm that they were able to find the record of the decision for the issue." t.string "veteran_participant_id", comment: "The veteran participant ID. This should be unique in upstream systems and used in the future to reconcile duplicates." t.index ["closed_at"], name: "index_request_issues_on_closed_at" @@ -1545,8 +1537,6 @@ t.integer "edited_request_issue_ids", comment: "An array of the request issue IDs that were edited during this request issues update", array: true t.string "error", comment: "The error message if the last attempt at processing the request issues update was not successful." t.datetime "last_submitted_at", comment: "Timestamp for when the processing for the request issues update was last submitted. Used to determine how long to continue retrying the processing job. Can be reset to allow for additional retries." - t.integer "mst_edited_request_issue_ids", comment: "An array of the request issue IDs that were updated to be associated with MST in request issues update", array: true - t.integer "pact_edited_request_issue_ids", comment: "An array of the request issue IDs that were updated to be associated with PACT in request issues update", array: true t.datetime "processed_at", comment: "Timestamp for when the request issue update successfully completed processing." t.bigint "review_id", null: false, comment: "The ID of the decision review edited." t.string "review_type", null: false, comment: "The type of the decision review edited." @@ -1595,26 +1585,6 @@ t.index ["sent_by_id"], name: "index_sent_hearing_email_events_on_sent_by_id" end - create_table "special_issue_changes", force: :cascade do |t| - t.bigint "appeal_id", null: false, comment: "AMA or Legacy Appeal ID that the issue is tied to" - t.string "appeal_type", null: false, comment: "Appeal Type (Appeal or LegacyAppeal)" - t.string "change_category", null: false, comment: "Type of change that occured to the issue (Established Issue, Added Issue, Edited Issue, Removed Issue)" - t.datetime "created_at", null: false, comment: "Date the special issue change was made" - t.string "created_by_css_id", null: false, comment: "CSS ID of the user that made the special issue change" - t.bigint "created_by_id", null: false, comment: "User ID of the user that made the special issue change" - t.bigint "decision_issue_id", comment: "ID of the decision issue that had a special issue change from its corresponding request issue" - t.bigint "issue_id", null: false, comment: "ID of the issue that was changed" - t.boolean "mst_from_vbms", comment: "Indication that the MST status originally came from VBMS on intake" - t.string "mst_reason_for_change", comment: "Reason for changing the MST status on an issue" - t.boolean "original_mst_status", null: false, comment: "Original MST special issue status of the issue" - t.boolean "original_pact_status", null: false, comment: "Original PACT special issue status of the issue" - t.boolean "pact_from_vbms" - t.string "pact_reason_for_change", comment: "Reason for changing the PACT status on an issue" - t.bigint "task_id", null: false, comment: "Task ID of the IssueUpdateTask or EstablishmentTask used to log this issue in the case timeline" - t.boolean "updated_mst_status", comment: "Updated MST special issue status of the issue" - t.boolean "updated_pact_status", comment: "Updated PACT special issue status of the issue" - end - create_table "special_issue_lists", comment: "Associates special issues to an AMA or legacy appeal for Caseflow Queue. Caseflow Dispatch uses special issues stored in legacy_appeals. They are intentionally disconnected.", force: :cascade do |t| t.bigint "appeal_id", comment: "The ID of the appeal associated with this record" t.string "appeal_type", comment: "The type of appeal associated with this record" From e838eb4226563c7822970efd633ed816918fbc4e Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Thu, 31 Aug 2023 14:59:37 -0400 Subject: [PATCH 08/12] Edit getDocument to only have one id variable --- client/app/reader/PdfFile.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/app/reader/PdfFile.jsx b/client/app/reader/PdfFile.jsx index a86dec45874..be88d1033cb 100644 --- a/client/app/reader/PdfFile.jsx +++ b/client/app/reader/PdfFile.jsx @@ -67,6 +67,8 @@ export class PdfFile extends React.PureComponent { * different domain (eFolder), and still need to pass our credentials to authenticate. */ getDocument = (requestOptions) => { + const logId = uuid.v4(); + return ApiUtil.get(this.props.file, requestOptions). then((resp) => { @@ -81,7 +83,6 @@ export class PdfFile extends React.PureComponent { /* The feature toggle reader_get_document_logging adds the progress of the file being loaded in console */ if (this.props.featureToggles.readerGetDocumentLogging) { - const logId = uuid.v4(); const src = { data: resp.body, verbosity: 5, @@ -119,15 +120,14 @@ export class PdfFile extends React.PureComponent { return this.props.setPdfDocument(this.props.file, this.pdfDocument); }, (reason) => this.onRejected(reason, 'setPdfDocument')). catch((error) => { - const id = uuid.v4(); const data = { file: this.props.file }; - const message = `${id} : GET ${this.props.file} : ${error}`; + const message = `${logId} : GET ${this.props.file} : ${error}`; console.error(message); storeMetrics( - id, + logId, data, { message, type: 'error', From 3e571ca9603d01c5021c9eb80a60473ba9469eb3 Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Thu, 31 Aug 2023 15:06:00 -0400 Subject: [PATCH 09/12] Remove empty line in getDocument --- client/app/reader/PdfFile.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/app/reader/PdfFile.jsx b/client/app/reader/PdfFile.jsx index be88d1033cb..98cddbac3e0 100644 --- a/client/app/reader/PdfFile.jsx +++ b/client/app/reader/PdfFile.jsx @@ -71,7 +71,6 @@ export class PdfFile extends React.PureComponent { return ApiUtil.get(this.props.file, requestOptions). then((resp) => { - const metricData = { message: `Getting PDF document id: "${this.props.documentId}"`, type: 'performance', From 02b007fdcdb11b9dfe65a654fdf4fd17ab63696b Mon Sep 17 00:00:00 2001 From: Chris-Martine Date: Wed, 6 Sep 2023 12:48:38 -0400 Subject: [PATCH 10/12] Add metric message for errors sent to Sentry --- app/controllers/metrics/v2/logs_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/metrics/v2/logs_controller.rb b/app/controllers/metrics/v2/logs_controller.rb index 7ccdc1ec306..990452a0bb7 100644 --- a/app/controllers/metrics/v2/logs_controller.rb +++ b/app/controllers/metrics/v2/logs_controller.rb @@ -11,6 +11,7 @@ def create if (metric.metric_type === 'error') error_info = { name: metric.metric_name, + message: metric.metric_message, class: metric.metric_class, attrs: metric.metric_attributes, created_at: metric.created_at, From 15cf600979dc4f1a8def9fa78c62b66918024953 Mon Sep 17 00:00:00 2001 From: mikefinneran <110622959+mikefinneran@users.noreply.github.com> Date: Wed, 6 Sep 2023 22:40:26 -0400 Subject: [PATCH 11/12] enforce metric feature toggle on current user --- app/services/metrics_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/metrics_service.rb b/app/services/metrics_service.rb index aa74ab6f7ed..57688984913 100644 --- a/app/services/metrics_service.rb +++ b/app/services/metrics_service.rb @@ -5,7 +5,6 @@ # see https://dropwizard.github.io/metrics/3.1.0/getting-started/ for abstractions on metric types class MetricsService def self.record(description, service: nil, name: "unknown", caller: nil) - return nil unless FeatureToggle.enabled?(:metrics_monitoring, user: current_user) return_value = nil app = RequestStore[:application] || "other" @@ -106,6 +105,7 @@ def self.record(description, service: nil, name: "unknown", caller: nil) private def self.store_record_metric(uuid, params, caller) + return nil unless FeatureToggle.enabled?(:metrics_monitoring, user: RequestStore[:current_user]) name ="caseflow.server.metric.#{params[:name]&.downcase.gsub(/::/, '.')}" params = { From 4c7d7cdcc6adc205dac92402d86b10bdc63b1e3d Mon Sep 17 00:00:00 2001 From: mikefinneran <110622959+mikefinneran@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:20:29 -0400 Subject: [PATCH 12/12] linter updates --- client/app/reader/PdfPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/reader/PdfPage.jsx b/client/app/reader/PdfPage.jsx index 021a7d85114..8349c7352aa 100644 --- a/client/app/reader/PdfPage.jsx +++ b/client/app/reader/PdfPage.jsx @@ -13,7 +13,7 @@ import { bindActionCreators } from 'redux'; import { PDF_PAGE_HEIGHT, PDF_PAGE_WIDTH, SEARCH_BAR_HEIGHT, PAGE_DIMENSION_SCALE, PAGE_MARGIN } from './constants'; import { pageNumberOfPageIndex } from './utils'; import * as PDFJS from 'pdfjs-dist'; -import { collectHistogram, recordMetrics, recordAsyncMetrics, storeMetrics } from '../util/Metrics'; +import { recordMetrics, recordAsyncMetrics, storeMetrics } from '../util/Metrics'; import { css } from 'glamor'; import classNames from 'classnames';