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

Remove metrics definition from services #126

Merged
merged 7 commits into from
Apr 20, 2020

Conversation

hvilloria
Copy link
Contributor

@hvilloria hvilloria commented Apr 16, 2020

What does this PR do?

since the new idea is to generate metrics each day, some models and services like time intervals and metrics definitions were removed. Review turnaround flow has changed so the test use cases were changed too.

The main purpose is to process metrics at the end of every day, in what way we will be able to process week metrics, monthly metrics, etc. from these daily metrics.

issue: #120

@@ -7,6 +7,6 @@ class ProcessMetricsJob < ApplicationJob
##
# Delegates the processing to the MetricsDefinitionProcessor service.
def perform
Processors::MetricsDefinition.call
Processors::ReviewTurnaround.call
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we change the file name also? For example process_review_turnaround_job

BATCH_SIZE = 500

def call
process
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we have process body here?

ENTITIES = ['UserProject'].freeze

def call
process
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment posted in app/services/metrics/review_turnaround/per_user_project.rb. Is this some convention agreed upon?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a way to encapsulate the process method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly @horacio, others processors and have it like that so i wanted to keep the consistency about how are made the services. as you commented it is like a convention

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

Copy link
Contributor

@hdamico hdamico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me!

@horacio
Copy link
Contributor

horacio commented Apr 17, 2020

:shipit:

end

def create_metric(entity, turnaround)
Metric.create!(ownable: entity, value: turnaround, name: :review_turnaround)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this have the timestamp?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what if that record exists already? Is it possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • what would be the timestamp for?

  • i think it is not possible because we pretend to process every events at some point during the day

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This metrics tells me which entity it applies to, the value, the name of the metric, but I have no idea what time period it applies to.

@hvilloria hvilloria merged commit 2dcc027 into develop Apr 20, 2020
@hvilloria hvilloria deleted the remove_metrics_from_services branch April 20, 2020 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants