/** * Flushes the buffer by POSTing the stats in JSON format to Stat Hat. */ public function postBatch() { if ($this->hasStats()) { foreach ($this->buffer['counters'] as $params) { $this->client->post('/c', $params); } foreach ($this->buffer['values'] as $params) { $this->client->post('/v', $params); } $this->resetBuffer(); } }
/** * Flushes the buffer by POSTing the stats in JSON format to Stat Hat. */ public function postBatch() { foreach ($this->buffer as $ezKey => $stats) { if (!empty($stats)) { $params = ['ezkey' => $ezKey, 'data' => $stats]; $isPosted = $this->client->post('/ez', $params, 'application/json'); if ($isPosted) { $this->resetBuffer($ezKey); } } } }