pet the cyber canine 9000

This commit is contained in:
Georg Gadinger 2023-03-29 08:03:13 +02:00
parent a9cf00f75e
commit 3508f846e7
2 changed files with 16 additions and 16 deletions

View File

@ -24,65 +24,65 @@ module Retrospring
labels: [:version], labels: [:version],
preset_labels: { preset_labels: {
version: Retrospring::Version.to_s, version: Retrospring::Version.to_s,
} },
).tap { _1.set 1 } ).tap { _1.set 1 }
QUESTIONS_ASKED = counter( QUESTIONS_ASKED = counter(
:retrospring_questions_asked_total, :retrospring_questions_asked_total,
docstring: "How many questions got asked", docstring: "How many questions got asked",
labels: %i[anonymous followers generated] labels: %i[anonymous followers generated],
) )
QUESTIONS_ANSWERED = counter( QUESTIONS_ANSWERED = counter(
:retrospring_questions_answered_total, :retrospring_questions_answered_total,
docstring: "How many questions got answered" docstring: "How many questions got answered",
) )
COMMENTS_CREATED = counter( COMMENTS_CREATED = counter(
:retrospring_comments_created_total, :retrospring_comments_created_total,
docstring: "How many comments got created" docstring: "How many comments got created",
) )
USERS_CREATED = counter( USERS_CREATED = counter(
:retrospring_users_created_total, :retrospring_users_created_total,
docstring: "How many users got created" docstring: "How many users got created",
) )
USERS_DESTROYED = counter( USERS_DESTROYED = counter(
:retrospring_users_destroyed_total, :retrospring_users_destroyed_total,
docstring: "How many users deleted their accounts" docstring: "How many users deleted their accounts",
) )
# metrics from Sidekiq::Stats.new # metrics from Sidekiq::Stats.new
SIDEKIQ = { SIDEKIQ = {
processed: gauge( processed: gauge(
:sidekiq_processed, :sidekiq_processed,
docstring: "Number of jobs processed by Sidekiq" docstring: "Number of jobs processed by Sidekiq",
), ),
failed: gauge( failed: gauge(
:sidekiq_failed, :sidekiq_failed,
docstring: "Number of jobs that failed" docstring: "Number of jobs that failed",
), ),
scheduled_size: gauge( scheduled_size: gauge(
:sidekiq_scheduled_jobs, :sidekiq_scheduled_jobs,
docstring: "Number of jobs that are enqueued" docstring: "Number of jobs that are enqueued",
), ),
retry_size: gauge( retry_size: gauge(
:sidekiq_retried_jobs, :sidekiq_retried_jobs,
docstring: "Number of jobs that are being retried" docstring: "Number of jobs that are being retried",
), ),
dead_size: gauge( dead_size: gauge(
:sidekiq_dead_jobs, :sidekiq_dead_jobs,
docstring: "Number of jobs that are dead" docstring: "Number of jobs that are dead",
), ),
processes_size: gauge( processes_size: gauge(
:sidekiq_processes, :sidekiq_processes,
docstring: "Number of active Sidekiq processes" docstring: "Number of active Sidekiq processes",
), ),
queue_enqueued: gauge( queue_enqueued: gauge(
:sidekiq_queues_enqueued, :sidekiq_queues_enqueued,
docstring: "Number of enqueued jobs per queue", docstring: "Number of enqueued jobs per queue",
labels: %i[queue] labels: %i[queue],
), ),
}.freeze }.freeze
end end

View File

@ -10,7 +10,7 @@ RSpec.describe User, type: :model do
@user = User.new( @user = User.new(
screen_name: "FunnyMeme2004", screen_name: "FunnyMeme2004",
password: "y_u_no_secure_password?", password: "y_u_no_secure_password?",
email: "nice.meme@nsa.gov" email: "nice.meme@nsa.gov",
) )
Profile.new(user: @user) Profile.new(user: @user)
end end
@ -108,7 +108,7 @@ RSpec.describe User, type: :model do
describe "email validation" do describe "email validation" do
subject do subject do
FactoryBot.build(:user, email: email).tap(&:validate).errors[:email] FactoryBot.build(:user, email:).tap(&:validate).errors[:email]
end end
shared_examples_for "valid email" do |example_email| shared_examples_for "valid email" do |example_email|
@ -255,7 +255,7 @@ RSpec.describe User, type: :model do
describe "#cursored_timeline" do describe "#cursored_timeline" do
let(:last_id) { nil } let(:last_id) { nil }
subject { me.cursored_timeline(last_id: last_id, size: 3) } subject { me.cursored_timeline(last_id:, size: 3) }
context "user answered nothing and is not following anyone" do context "user answered nothing and is not following anyone" do
include_examples "result is blank" include_examples "result is blank"