-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-http-headers-attributes
- Loading branch information
Showing
71 changed files
with
591 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,31 +2,36 @@ | |
"name": "worldia/instrumentation-bundle", | ||
"type": "symfony-bundle", | ||
"license": "MIT", | ||
"keywords": ["instrumentation", "tracing", "metrics", "open-telemetry", "prometheus"], | ||
"authors": [{ | ||
"name": "Worldia developers", | ||
"email": "[email protected]" | ||
}], | ||
"keywords": [ | ||
"instrumentation", | ||
"tracing", | ||
"metrics", | ||
"open-telemetry", | ||
"prometheus" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Worldia developers", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"monolog/monolog": "^2.0", | ||
"nyholm/dsn": "^2.0", | ||
"nyholm/psr7": "^1.5", | ||
"open-telemetry/sdk": "^1.0@dev", | ||
"open-telemetry/api": "^1.0@dev", | ||
"open-telemetry/context": "^1.0@dev", | ||
"open-telemetry/sem-conv": "^1.0@dev", | ||
"open-telemetry/api": ">=1.0.2", | ||
"open-telemetry/sdk": "^1.0", | ||
"promphp/prometheus_client_php": "^2.4", | ||
"psr/http-client": "^1.0", | ||
"symfony/dependency-injection": "*" | ||
}, | ||
"require-dev": { | ||
"doctrine/dbal": "^3.0", | ||
"friends-of-phpspec/phpspec-expect": "^4.0", | ||
"open-telemetry/sdk-contrib": "^1.0@dev", | ||
"open-telemetry/transport-grpc": "^1.0@dev", | ||
"open-telemetry/gen-otlp-protobuf": "^1.0@dev", | ||
"open-telemetry/transport-grpc": "^1.0", | ||
"open-telemetry/gen-otlp-protobuf": "^1.0", | ||
"php-http/httplug": "^2.3", | ||
"phpspec/phpspec": "^7.2", | ||
"phpspec/phpspec": "^7.5", | ||
"phpstan/phpstan": "^1.4", | ||
"symfony/framework-bundle": "*", | ||
"symfony/http-client": "*", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
spec/Tracing/Instrumentation/LogHandler/TracingHandlerSpec.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the worldia/instrumentation-bundle package. | ||
* (c) Worldia <[email protected]> | ||
*/ | ||
|
||
namespace spec\Instrumentation\Tracing\Instrumentation\LogHandler; | ||
|
||
use Instrumentation\Tracing\Instrumentation\MainSpanContextInterface; | ||
use Monolog\Logger; | ||
use OpenTelemetry\API\Trace\SpanInterface; | ||
use OpenTelemetry\API\Trace\TracerProviderInterface; | ||
use PhpSpec\ObjectBehavior; | ||
use Prophecy\Argument; | ||
|
||
class TracingHandlerSpec extends ObjectBehavior | ||
{ | ||
public function it_adds_event_from_all_channels( | ||
TracerProviderInterface $tracerProvider, | ||
MainSpanContextInterface $mainSpanContext, | ||
SpanInterface $span | ||
): void { | ||
$this->beConstructedWith($tracerProvider, $mainSpanContext, Logger::INFO, []); | ||
|
||
$mainSpanContext->getMainSpan()->willReturn($span); | ||
$span->addEvent(Argument::any())->willReturn($span); | ||
|
||
$this->handle(['message' => 'Error from channel "foo"', 'channel' => 'foo', 'level' => Logger::ERROR, 'extra' => [], 'context' => []]); | ||
$this->handle(['message' => 'Error from channel "bar"', 'channel' => 'bar', 'level' => Logger::ERROR, 'extra' => [], 'context' => []]); | ||
|
||
$span->addEvent('Error from channel "foo"')->shouldHaveBeenCalled(); | ||
$span->addEvent('Error from channel "bar"')->shouldHaveBeenCalled(); | ||
} | ||
|
||
public function it_adds_event_from_specific_channel_only( | ||
TracerProviderInterface $tracerProvider, | ||
MainSpanContextInterface $mainSpanContext, | ||
SpanInterface $span | ||
): void { | ||
$this->beConstructedWith($tracerProvider, $mainSpanContext, Logger::INFO, ['foo']); | ||
|
||
$mainSpanContext->getMainSpan()->willReturn($span); | ||
$span->addEvent(Argument::any())->willReturn($span); | ||
|
||
$this->handle(['message' => 'Error from channel "foo"', 'channel' => 'foo', 'level' => Logger::ERROR, 'extra' => [], 'context' => []]); | ||
$this->handle(['message' => 'Error from channel "bar"', 'channel' => 'bar', 'level' => Logger::ERROR, 'extra' => [], 'context' => []]); | ||
|
||
$span->addEvent('Error from channel "foo"')->shouldHaveBeenCalled(); | ||
$span->addEvent('Error from channel "bar"')->shouldNotHaveBeenCalled(); | ||
} | ||
|
||
public function it_ignores_event_from_specific_channel( | ||
TracerProviderInterface $tracerProvider, | ||
MainSpanContextInterface $mainSpanContext, | ||
SpanInterface $span | ||
): void { | ||
$this->beConstructedWith($tracerProvider, $mainSpanContext, Logger::INFO, ['!foo']); | ||
|
||
$mainSpanContext->getMainSpan()->willReturn($span); | ||
$span->addEvent(Argument::any())->willReturn($span); | ||
|
||
$this->handle(['message' => 'Error from channel "foo"', 'channel' => 'foo', 'level' => Logger::ERROR, 'extra' => [], 'context' => []]); | ||
$this->handle(['message' => 'Error from channel "bar"', 'channel' => 'bar', 'level' => Logger::ERROR, 'extra' => [], 'context' => []]); | ||
|
||
$span->addEvent('Error from channel "foo"')->shouldNotHaveBeenCalled(); | ||
$span->addEvent('Error from channel "bar"')->shouldHaveBeenCalled(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.