Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPEALS-26109: Metric Service Sentry Updates #19316

Merged
merged 12 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/help_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/intakes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion app/jobs/update_appellant_representation_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class UpdateAppellantRepresentationJob < CaseflowJob
include ActionView::Helpers::DateHelper
queue_with_priority :low_priority
application_attr :queue

APP_NAME = "caseflow_job"
METRIC_GROUP_NAME = UpdateAppellantRepresentationJob.name.underscore
TOTAL_NUMBER_OF_APPEALS_TO_UPDATE = 1000
Expand Down
2 changes: 1 addition & 1 deletion app/models/metric.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
17 changes: 16 additions & 1 deletion app/services/metrics_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,22 @@ def self.record(description, service: nil, name: "unknown", caller: nil)

increment_datadog_counter("request_error", service, name, app) if service

metric_params[:type] = Metric::METRIC_TYPES[:error]
metric_params = {
name: "Stand in object if metrics_service.record fails",
message: "Variables not initialized before failure",
type: Metric::METRIC_TYPES[:error],
product: "",
attrs: {
service: "",
endpoint: ""
},
sent_to: [[Metric::LOG_SYSTEMS[:rails_console]]],
sent_to_info: "",
start: 'Time not recorded',
end: 'Time not recorded',
duration: 'Time not recorded'
}

store_record_metric(uuid, metric_params, caller)

# Re-raise the same error. We don't want to interfere at all in normal error handling.
Expand Down
2 changes: 1 addition & 1 deletion app/views/certifications/v2.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
2 changes: 1 addition & 1 deletion app/views/decision_reviews/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/dispatch/establish_claims/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
2 changes: 1 addition & 1 deletion app/views/hearings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
2 changes: 1 addition & 1 deletion app/views/inbox/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
2 changes: 1 addition & 1 deletion app/views/intake_manager/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
2 changes: 1 addition & 1 deletion app/views/queue/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}) %>
Expand Down
14 changes: 7 additions & 7 deletions app/views/reader/appeal/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
windowSlider: FeatureToggle.enabled?(:window_slider, user: current_user),
readerSelectorsMemoized: FeatureToggle.enabled?(:bulk_upload_documents, user: current_user),
readerGetDocumentLogging: FeatureToggle.enabled?(:reader_get_document_logging, 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)
},
buildDate: build_date
}) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/test/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
2 changes: 1 addition & 1 deletion spec/jobs/update_appellant_representation_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
)
expect(DataDogService).to receive(:emit_gauge).with(
app_name: "queue_job",
attrs: { endpoint: "AppellantNotification.appeal_mapper", service: "queue_job" },
attrs: { endpoint: "AppellantNotification.appeal_mapper", service: "queue_job", uuid: anything },
metric_group: "service",
metric_name: "request_latency",
metric_value: anything
Expand Down
Loading