Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Modify #time to support a "count" option.

Open
#48 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
ruby

Research direction

Start by locating the time entry point and its time_since call, then inspect the existing timing tests if present. Done means time accepts a count option, preserves the default behavior, and reports the elapsed duration divided by the count for bulk operations.

Written by the indexing model from the issue text.

Description

I have to time some bulk operations and it's not viable to push to statsd every iteration of the loop. However, what would be nice is something like the following:

$statsd.time('accounts.activate', { count: accounts.length } ) { process_accounts(accounts) }

Internally this would change time to something similar to the following:

def time(stat, opts={})
  count = [opts.fetch(:count, 1), 1].max
  start = Time.now
  return yield
ensure
  time_since(stat / count, start, opts)
end

I can open a PR if this sounds like a good idea :)

Dominant language
Ruby
Stars
208
Forks
138
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/dogstatsd-ruby

All issues in DataDog/dogstatsd-ruby

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.