Skip to content

Commit

Permalink
chore: improves reporter logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcchavezs committed Mar 11, 2019
1 parent a1e4da1 commit 37c3548
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Zipkin/Reporters/Http.php
Expand Up @@ -29,6 +29,10 @@ final class Http implements Reporter
private $options;

/**
* logger is only meant to be used for development purposes. Enabling
* an actual logger in production could cause a massive amount of data
* that will flood the logs.
*
* @var LoggerInterface
*/
private $logger;
Expand Down Expand Up @@ -63,7 +67,7 @@ public function report(array $spans): void
try {
$client($payload);
} catch (RuntimeException $e) {
$this->logger->error($e->getMessage());
$this->logger->error(sprintf('failed to report spans: %s', $e->getMessage()));
}
}
}
5 changes: 3 additions & 2 deletions src/Zipkin/Reporters/Http/CurlFactory.php
Expand Up @@ -39,8 +39,9 @@ public function build(?array $options = []): callable
return static function ($payload) use ($options) {
$handle = curl_init($options['endpoint_url']);
if ($handle === false) {
return static function () {
};
throw new RuntimeException(
sprintf('failed to create the handle for url "%s"', $options['endpoint_url'])
);
}

curl_setopt($handle, CURLOPT_POST, 1);
Expand Down

0 comments on commit 37c3548

Please sign in to comment.