Skip to content

Commit

Permalink
Merge pull request #50 from jcchavezs/adds_usability_tweaks
Browse files Browse the repository at this point in the history
Adds some usability tweaks.
  • Loading branch information
jcchavezs authored Jan 18, 2018
2 parents a5918d7 + 4f29bcd commit 18c1826
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/Zipkin/Reporters/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public function report(array $spans)
$client = $this->clientFactory->build($this->options);
$client($payload);
} catch (Exception $e) {
$this->logger->info($e->getMessage());
$this->logger->error(
sprintf('Failed to report spans: %s', $e->getMessage())
);
}
}
}
12 changes: 10 additions & 2 deletions src/Zipkin/TracingBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,23 @@ public function havingTraceId128bits($usesTraceId128bits)
return $this;
}

/**
* @param CurrentTraceContext $currentTraceContext
* @return $this
*/
public function havingCurrentTraceContext(CurrentTraceContext $currentTraceContext)
{
$this->currentTraceContext = $currentTraceContext;
return $this;
}

public function beingNoop()
/**
* @param bool $isNoop
* @return $this
*/
public function beingNoop($isNoop = true)
{
$this->isNoop = true;
$this->isNoop = $isNoop;
return $this;
}

Expand Down
17 changes: 14 additions & 3 deletions tests/Unit/TracingBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public function testCreatingTracingWithDefaultValuesSuccess()
$this->assertEquals(false, $tracing->isNoop());
}

public function testCreatingTracingIncludesExpectedValues()
/**
* @dataProvider boolProvider
*/
public function testCreatingTracingIncludesExpectedValues($isNoop)
{
$endpoint = Endpoint::createAsEmpty();
$reporter = new Noop();
Expand All @@ -36,11 +39,19 @@ public function testCreatingTracingIncludesExpectedValues()
->havingSampler($sampler)
->havingTraceId128bits($usesTraceId128bits)
->havingCurrentTraceContext($currentTraceContext)
->beingNoop()
->beingNoop($isNoop)
->build();

$this->assertInstanceOf(Tracing::class, $tracing);
$this->assertEquals(true, $tracing->isNoop());
$this->assertEquals($isNoop, $tracing->isNoop());
}

public function boolProvider()
{
return [
[true],
[false]
];
}

private function randomBool()
Expand Down

0 comments on commit 18c1826

Please sign in to comment.