Skip to content

Commit

Permalink
Merge pull request #72 from carolabadeer/aws-instrumentation-setup
Browse files Browse the repository at this point in the history
Instrumentation directory structure and AWS instrumentation class
  • Loading branch information
brettmc authored Aug 4, 2022
2 parents dd99a20 + ced61fb commit 7b5c466
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php
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 tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php
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()
);
}
}

0 comments on commit 7b5c466

Please sign in to comment.