rcrowe / laravel-statsd

Send to Statsd from Laravel
22 stars 2 forks source link

Add updateCount and clear data after send #2

Closed yuripave closed 9 years ago

yuripave commented 9 years ago

Nice package and upon using the package I would like to make 2 updates:

  1. Implement StatsdDataFactoryInterface::updateCount liuggio/statsd-php-client from v1.0.12 (latest stable).
  2. Clear data after current data being sent (flush and clear buffer), so clients can call send on-demand in additional to app shutdown, useful for long running background process.
rcrowe commented 9 years ago

Perfect, thanks @yuripave . Though liuggio/statsd-php-client#31 shouldn't have pushed this under 1.0.x

Does send not clear the buffer for you?

I've actually re-written this library at work and will be open-sourcing it shortly, so I'm probably not going to support this any more. But I'll happily except pull-requests.

yuripave commented 9 years ago

Thanks @rcrowe. Would be great if you can tag the release so users won't get interface not fully implemented error on fresh install or composer update.

For the reason of adding clear $this->data on send, it was okay if send was called one time (app shutdown as on StatsdServiceProvider). But if user would like to call send multiple times it will send duplicated data since $this->data was not cleared on each send. An example use case is queue listeners. For daemon like process app shutdown callback might be hours away unlike normal HTTP requests so user might want to manually call send to send current buffered metrics say every 10 seconds repeatedly.

Looking forward to your rewritten release!