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

Provide some business intelligence for token workflows #17385

Merged
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
17 changes: 17 additions & 0 deletions src/api/app/jobs/measurements_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
notifications_measurements
subscription_measurements
beta_features_measurements

RabbitmqBus.send_to_bus('metrics', "token_workflow #{measurement_to_fields(token_workflow_measurements)}")

Check warning on line 13 in src/api/app/jobs/measurements_job.rb

View check run for this annotation

Codecov / codecov/patch

src/api/app/jobs/measurements_job.rb#L13

Added line #L13 was not covered by tests
end

private
Expand Down Expand Up @@ -84,4 +86,19 @@
RabbitmqBus.send_to_bus('metrics', "beta_feature_count,feature=#{feature_name},status=disabled value=#{DisabledBetaFeature.where(name: feature_name).count}")
end
end

def token_workflow_measurements
tokens_with_custom_configuration_path = Token::Workflow.where.not(workflow_configuration_path: [nil, '']).count
tokens_with_custom_configuration_url = Token::Workflow.where.not(workflow_configuration_url: [nil, '']).count

Check warning on line 92 in src/api/app/jobs/measurements_job.rb

View check run for this annotation

Codecov / codecov/patch

src/api/app/jobs/measurements_job.rb#L91-L92

Added lines #L91 - L92 were not covered by tests

{
total_count: Token::Workflow.count,

Check warning on line 95 in src/api/app/jobs/measurements_job.rb

View check run for this annotation

Codecov / codecov/patch

src/api/app/jobs/measurements_job.rb#L95

Added line #L95 was not covered by tests
enabled: Token::Workflow.where(enabled: true).count,
disabled: Token::Workflow.where(enabled: false).count,
custom_configuration_path: tokens_with_custom_configuration_path,
custom_configuration_url: tokens_with_custom_configuration_url,
user_with_tokens: User.joins(:shared_workflow_tokens).distinct.count,
groups_sharing_tokens: Group.joins(:shared_workflow_tokens).distinct.count
}
end
end