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

Revert "Feature/appeals 22218" #19380

Merged
merged 1 commit into from
Sep 7, 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
3 changes: 1 addition & 2 deletions app/controllers/help_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ class HelpController < ApplicationController

def feature_toggle_ui_hash(user = current_user)
{
programOfficeTeamManagement: FeatureToggle.enabled?(:program_office_team_management, user: user),
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
programOfficeTeamManagement: FeatureToggle.enabled?(:program_office_team_management, user: user)
}
end

Expand Down
3 changes: 1 addition & 2 deletions app/controllers/intakes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ def feature_toggle_ui_hash
eduPreDocketAppeals: FeatureToggle.enabled?(:edu_predocket_appeals, user: current_user),
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?(:metrics_browser_error, user: current_user)
vhaClaimReviewEstablishment: FeatureToggle.enabled?(:vha_claim_review_establishment, user: current_user)
}
end

Expand Down
24 changes: 0 additions & 24 deletions app/controllers/metrics/dashboard_controller.rb

This file was deleted.

44 changes: 0 additions & 44 deletions app/controllers/metrics/v2/logs_controller.rb

This file was deleted.

3 changes: 1 addition & 2 deletions app/controllers/test/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ class Test::UsersController < ApplicationController
stats: "/stats",
jobs: "/jobs",
admin: "/admin",
test_veterans: "/test/data",
metrics_dashboard: "/metrics/dashboard"
test_veterans: "/test/data"
}
}
].freeze
Expand Down
1 change: 1 addition & 0 deletions app/jobs/update_appellant_representation_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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
105 changes: 0 additions & 105 deletions app/models/metric.rb

This file was deleted.

86 changes: 6 additions & 80 deletions app/services/metrics_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,35 @@

# 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)

def self.record(description, service: nil, name: "unknown")
return_value = nil
app = RequestStore[:application] || "other"
service ||= app
uuid = SecureRandom.uuid
metric_name= 'request_latency'
sent_to = [[Metric::LOG_SYSTEMS[:rails_console]]]
sent_to_info = nil

start = Time.now
Rails.logger.info("STARTED #{description}")
stopwatch = Benchmark.measure do
return_value = yield
end
stopped = Time.now

if service
latency = stopwatch.real
sent_to_info = {
DataDogService.emit_gauge(
metric_group: "service",
metric_name: metric_name,
metric_name: "request_latency",
metric_value: latency,
app_name: app,
attrs: {
service: service,
endpoint: name,
uuid: uuid
endpoint: name
}
}
DataDogService.emit_gauge(sent_to_info)

sent_to << Metric::LOG_SYSTEMS[:datadog]
)
end

Rails.logger.info("FINISHED #{description}: #{stopwatch}")

metric_params = {
name: metric_name,
message: description,
type: Metric::METRIC_TYPES[:performance],
product: service,
attrs: {
service: service,
endpoint: name
},
sent_to: sent_to,
sent_to_info: sent_to_info,
start: start,
end: stopped,
duration: stopwatch.total * 1000 # values is in seconds and we want milliseconds
}
store_record_metric(uuid, metric_params, caller)

return_value
rescue StandardError => error
Rails.logger.error("#{error.message}\n#{error.backtrace.join("\n")}")
Raven.capture_exception(error, extra: { type: "request_error", service: service, name: name, app: app })

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

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.
# This is just to capture the metric.
raise
Expand All @@ -102,27 +51,4 @@ def self.record(description, service: nil, name: "unknown", caller: nil)
}
)
end

private

def self.store_record_metric(uuid, params, caller)

name ="caseflow.server.metric.#{params[:name]&.downcase.gsub(/::/, '.')}"
params = {
uuid: uuid,
name: name,
message: params[:message],
type: params[:type],
product: params[:product],
metric_attributes: params[:attrs],
sent_to: params[:sent_to],
sent_to_info: params[:sent_to_info],
start: params[:start],
end: params[:end],
duration: params[:duration],
}
metric = Metric.create_metric(caller || self, params, RequestStore[:current_user])
failed_metric_info = metric&.errors.inspect
Rails.logger.info("Failed to create metric #{failed_metric_info}") unless metric&.valid?
end
end
5 changes: 1 addition & 4 deletions app/views/certifications/v2.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
dropdownUrls: dropdown_urls,
feedbackUrl: feedback_url,
buildDate: build_date,
vacolsId: @certification.vacols_id,
featureToggles: {
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
}
vacolsId: @certification.vacols_id
}) %>
<% end %>
3 changes: 1 addition & 2 deletions app/views/decision_reviews/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
businessLine: business_line.name,
businessLineUrl: business_line.url,
featureToggles: {
decisionReviewQueueSsnColumn: FeatureToggle.enabled?(:decision_review_queue_ssn_column, user: current_user),
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
decisionReviewQueueSsnColumn: FeatureToggle.enabled?(:decision_review_queue_ssn_column, user: current_user)
},
baseTasksUrl: business_line.tasks_url,
taskFilterDetails: task_filter_details
Expand Down
7 changes: 2 additions & 5 deletions app/views/dispatch/establish_claims/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
buildDate: build_date,
buttonText: start_text,
userQuota: user_quota && user_quota.to_hash,
currentUserHistoricalTasks: current_user_historical_tasks.map(&:to_hash),
featureToggles: {
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
}
currentUserHistoricalTasks: current_user_historical_tasks.map(&:to_hash)
}) %>
<% end %>
<% end %>
5 changes: 1 addition & 4 deletions app/views/hearings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
userIsDvc: current_user.can_view_judge_team_management?,
userIsHearingManagement: current_user.in_hearing_management_team?,
userIsBoardAttorney: current_user.attorney?,
userIsHearingAdmin: current_user.in_hearing_admin_team?,
featureToggles: {
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
}
userIsHearingAdmin: current_user.in_hearing_admin_team?
}) %>
<% end %>
3 changes: 0 additions & 3 deletions app/views/inbox/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
inbox: {
messages: messages,
pagination: pagination
},
featureToggles: {
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
}
}) %>
<% end %>
3 changes: 0 additions & 3 deletions app/views/intake_manager/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
dropdownUrls: dropdown_urls,
feedbackUrl: feedback_url,
buildDate: build_date
featureToggles: {
metricsBrowserError: FeatureToggle.enabled?(:metrics_browser_error, user: current_user)
}
}) %>
<% end %>
Loading
Loading