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

Change metric and label names to get rid of worker term if possible #19

Open
Envek opened this issue Apr 30, 2021 · 0 comments
Open

Change metric and label names to get rid of worker term if possible #19

Envek opened this issue Apr 30, 2021 · 0 comments

Comments

@Envek
Copy link
Member

Envek commented Apr 30, 2021

It seems that by mistake I chose the ambigous name worker for use in metric or label names. It led to my confusion several times (e.g. in #11 (comment) or #13 (comment))

Even @mperham recommends against using it in https://www.mikeperham.com/2021/04/20/a-tour-of-the-sidekiq-api/:

…it helps to understand the basic entities in Sidekiq’s universe:

  • A job is a unit of work in your Ruby application
  • A queue is a list of jobs which are ready to execute right now
  • A process is a Sidekiq process with one or more threads for executing jobs.

NB: I never use the term worker as it is nebulous and confusing. Use process, thread or job class so your meaning is clear.

However, this is apparently a breaking change, so we probably should find a trade-off between the passion to name things right and not breaking things too much.


Code of interest is here:

counter :jobs_enqueued_total, tags: %i[queue worker], comment: "A counter of the total number of jobs sidekiq enqueued."
next unless ::Sidekiq.server?
counter :jobs_executed_total, tags: %i[queue worker], comment: "A counter of the total number of jobs sidekiq executed."
counter :jobs_success_total, tags: %i[queue worker], comment: "A counter of the total number of jobs successfully processed by sidekiq."
counter :jobs_failed_total, tags: %i[queue worker], comment: "A counter of the total number of jobs failed in sidekiq."
gauge :jobs_waiting_count, tags: %i[queue], comment: "The number of jobs waiting to process in sidekiq."
gauge :active_workers_count, tags: [], comment: "The number of currently running machines with sidekiq workers."
gauge :jobs_scheduled_count, tags: [], comment: "The number of jobs scheduled for later execution."
gauge :jobs_retry_count, tags: [], comment: "The number of failed jobs waiting to be retried"
gauge :jobs_dead_count, tags: [], comment: "The number of jobs exceeded their retry count."
gauge :active_processes, tags: [], comment: "The number of active Sidekiq worker processes."
gauge :queue_latency, tags: %i[queue], comment: "The queue latency, the difference in seconds since the oldest job in the queue was enqueued"
gauge :running_job_runtime, tags: %i[queue worker], aggregation: :max, unit: :seconds,
comment: "How long currently running jobs are running (useful for detection of hung jobs)"
histogram :job_latency, comment: "The job latency, the difference in seconds between enqueued and running time",
unit: :seconds, per: :job,
tags: %i[queue worker],
buckets: LONG_RUNNING_JOB_RUNTIME_BUCKETS
histogram :job_runtime, comment: "A histogram of the job execution time.",
unit: :seconds, per: :job,
tags: %i[queue worker],
buckets: LONG_RUNNING_JOB_RUNTIME_BUCKETS

README lists metrics here: https://github.com/yabeda-rb/yabeda-sidekiq/blob/91c8f4ed23a2687b396ac64add8236f3ed16f0cc/README.md#metrics

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

No branches or pull requests

1 participant