-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from carolabadeer/aws-instrumentation-setup
Instrumentation directory structure and AWS instrumentation class
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Instrumentation\AwsSdk; | ||
|
||
use OpenTelemetry\API\Common\Instrumentation\InstrumentationInterface; | ||
use OpenTelemetry\API\Common\Instrumentation\InstrumentationTrait; | ||
|
||
/** | ||
* @experimental | ||
*/ | ||
class AwsSdkInstrumentation implements InstrumentationInterface | ||
{ | ||
use InstrumentationTrait; | ||
|
||
public const NAME = 'AWS SDK Instrumentation'; | ||
public const VERSION = '0.0.1'; | ||
|
||
public function getName(): string | ||
{ | ||
return self::NAME; | ||
} | ||
|
||
public function getVersion(): ?string | ||
{ | ||
return self::VERSION; | ||
} | ||
|
||
public function getSchemaUrl(): ?string | ||
{ | ||
return null; | ||
} | ||
|
||
public function init(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function activate(): bool | ||
{ | ||
return true; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Test\Unit\Instrumentation\AwsSdk; | ||
|
||
use OpenTelemetry\Instrumentation\AwsSdk\AwsSdkInstrumentation; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class AwsSdkInstrumentationTest extends TestCase | ||
{ | ||
public function testInstrumentationClassName() | ||
{ | ||
$this->assertEquals( | ||
'AWS SDK Instrumentation', | ||
(new AwsSdkInstrumentation())->getName() | ||
); | ||
} | ||
|
||
public function testInstrumentationVersion() | ||
{ | ||
$this->assertEquals( | ||
'0.0.1', | ||
(new AwsSdkInstrumentation())->getVersion() | ||
); | ||
} | ||
|
||
public function testInstrumentationSchemaUrl() | ||
{ | ||
$this->assertNull((new AwsSdkInstrumentation())->getSchemaUrl()); | ||
} | ||
|
||
public function testInstrumentationInit() | ||
{ | ||
$this->assertTrue( | ||
(new AwsSdkInstrumentation())->init() | ||
); | ||
} | ||
|
||
public function testInstrumentationActivated() | ||
{ | ||
$this->assertTrue( | ||
(new AwsSdkInstrumentation())->activate() | ||
); | ||
} | ||
} |