diff --git a/docs/examples/spans.md b/docs/examples/spans.md index f3f05c0..a64c3cb 100644 --- a/docs/examples/spans.md +++ b/docs/examples/spans.md @@ -2,8 +2,14 @@ Please consult the documentation for your exact needs. Below is an example to add spans for MySQL, Redis and generic request wraped by a parent span. -![Dashboard](https://github.com/philkra/elastic-apm-php-agent/blob/master/docs/examples/blob/span_dashboard.png "Spans Dashboard") ![Stacktrace](https://github.com/philkra/elastic-apm-php-agent/blob/master/docs/examples/blob/span_stacktrace.png "Span Stacktrace") +## Screenshots +**Transactions Dashboard showing the Spans** +![Dashboard](https://github.com/philkra/elastic-apm-php-agent/blob/master/docs/examples/blob/span_overview.png "Spans Dashboard") +**Stacktrace of a Span** +![Stacktrace](https://github.com/philkra/elastic-apm-php-agent/blob/master/docs/examples/blob/span_stacktrace.png "Span Stacktrace") + +## Example Code ```php // create the agent $agent = new \PhilKra\Agent(['appName' => 'examples']); diff --git a/src/Events/DefaultEventFactory.php b/src/Events/DefaultEventFactory.php index 811aa3f..b7ca7b7 100644 --- a/src/Events/DefaultEventFactory.php +++ b/src/Events/DefaultEventFactory.php @@ -31,7 +31,7 @@ public function newSpan(string $name, EventBean $parent): Span /** * {@inheritdoc} */ - public function newMetricset($set, $tags): Metricset + public function newMetricset(array $set, array $tags = []): Metricset { return new Metricset($set, $tags); } diff --git a/src/Events/EventBean.php b/src/Events/EventBean.php index 3dd348a..560cc0b 100644 --- a/src/Events/EventBean.php +++ b/src/Events/EventBean.php @@ -40,13 +40,6 @@ class EventBean */ private $parentId = null; - /** - * Offset between the current Event and the parent Event's - * - * @var number - */ - private $parentTimestampOffset = null; - /** * Error occurred on Timestamp * @@ -188,7 +181,6 @@ public function setParent(EventBean $parent) { $this->setParentId($parent->getId()); $this->setTraceId($parent->getTraceId()); - $this->parentTimestampOffset = ($this->getTimestamp() - $parent->getTimestamp()); } /** diff --git a/src/Events/EventFactoryInterface.php b/src/Events/EventFactoryInterface.php index d7db1cd..068f488 100644 --- a/src/Events/EventFactoryInterface.php +++ b/src/Events/EventFactoryInterface.php @@ -45,6 +45,6 @@ public function newSpan(string $name, EventBean $parent): Span; * * @return Metricset */ - public function newMetricset($set, $tags): Metricset; + public function newMetricset(array $set, array $tags = []): Metricset; } diff --git a/src/Events/Metricset.php b/src/Events/Metricset.php index f64edf2..c839990 100644 --- a/src/Events/Metricset.php +++ b/src/Events/Metricset.php @@ -26,7 +26,7 @@ class Metricset extends EventBean implements \JsonSerializable * @param array $set * @param array $tags */ - public function __construct(array $set, array $tags) + public function __construct(array $set, array $tags = []) { parent::__construct([]); foreach($set as $k => $v) { @@ -47,6 +47,7 @@ public function jsonSerialize() : array return [ 'metricset' => [ 'samples' => $this->samples, +// 'tags' => $this->tags, 'timestamp' => $this->getTimestamp(), ] ];