Skip to content

Commit

Permalink
Rename host to address
Browse files Browse the repository at this point in the history
  • Loading branch information
bracki committed Sep 21, 2016
1 parent 6fd50fc commit 1cf9107
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Prometheus/PushGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

class PushGateway
{
private $host;
private $address;

/**
* PushGateway constructor.
* @param $host string host name of the push gateway
* @param $address string host:port of the push gateway
*/
public function __construct($host)
public function __construct($address)
{
$this->host = $host;
$this->address = $address;
}

/**
Expand All @@ -27,7 +27,7 @@ public function __construct($host)
*/
public function push(CollectorRegistry $collectorRegistry, $job, $groupingKey = null)
{
$url = "http://" . $this->host . "/metrics/job/" . $job;
$url = "http://" . $this->address . "/metrics/job/" . $job;
if (!empty($groupingKey)) {
foreach ($groupingKey as $label => $value) {
$url .= "/" . $label . "/" . $value;
Expand All @@ -46,7 +46,7 @@ public function push(CollectorRegistry $collectorRegistry, $job, $groupingKey =
));
$statusCode = $response->getStatusCode();
if ($statusCode != 202) {
$msg = "Unexpected status code " . $statusCode . " received from pushgateway " . $this->host . ": " . $response->getBody();
$msg = "Unexpected status code " . $statusCode . " received from pushgateway " . $this->address . ": " . $response->getBody();
throw new \RuntimeException($msg);
}
}
Expand Down

0 comments on commit 1cf9107

Please sign in to comment.