From fd35893fa55fe69cbcd447d2f54179b6d45fd235 Mon Sep 17 00:00:00 2001 From: Carol Abadeer Date: Fri, 15 Jul 2022 13:57:34 -0700 Subject: [PATCH 1/5] added instrumentation directory structure and AWS instrumentation class --- .../src/AwsSdkInstrumentation.php | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 instrumentation/opentelemetry-instrumentation-aws-sdk/src/AwsSdkInstrumentation.php diff --git a/instrumentation/opentelemetry-instrumentation-aws-sdk/src/AwsSdkInstrumentation.php b/instrumentation/opentelemetry-instrumentation-aws-sdk/src/AwsSdkInstrumentation.php new file mode 100644 index 00000000..94d10713 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-aws-sdk/src/AwsSdkInstrumentation.php @@ -0,0 +1,43 @@ +instrumented = false; + } + + function activate() + { + echo "activating"; + } +} From fcae268085d5a2b355a79e48dad13667801b799d Mon Sep 17 00:00:00 2001 From: Carol Abadeer Date: Fri, 22 Jul 2022 13:29:01 -0700 Subject: [PATCH 2/5] fixed instrumentation class and added unit tests --- .../AwsSdk/AwsSdkInstrumentation.php | 42 +++++++++++++++++++ .../AwsSdk/AwsSdkInstrumentationTest.php | 32 ++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php create mode 100644 tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php diff --git a/src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php b/src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php new file mode 100644 index 00000000..55056ae8 --- /dev/null +++ b/src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php @@ -0,0 +1,42 @@ +assertEquals( + 'AWS SDK Instrumentation', + $awsSdkInstrumentation->getName() + ); + } + + public function testInstrumentationActivated() + { + $awsSdkInstrumentation = new AwsSdkInstrumentation(); + + $this->assertTrue( + $awsSdkInstrumentation->activate() + ); + } +} From e7336ad9e2905d46d3653ab2bd084d639e210726 Mon Sep 17 00:00:00 2001 From: Carol Abadeer Date: Fri, 22 Jul 2022 13:30:33 -0700 Subject: [PATCH 3/5] updated directory structure --- .../src/AwsSdkInstrumentation.php | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 instrumentation/opentelemetry-instrumentation-aws-sdk/src/AwsSdkInstrumentation.php diff --git a/instrumentation/opentelemetry-instrumentation-aws-sdk/src/AwsSdkInstrumentation.php b/instrumentation/opentelemetry-instrumentation-aws-sdk/src/AwsSdkInstrumentation.php deleted file mode 100644 index 94d10713..00000000 --- a/instrumentation/opentelemetry-instrumentation-aws-sdk/src/AwsSdkInstrumentation.php +++ /dev/null @@ -1,43 +0,0 @@ -instrumented = false; - } - - function activate() - { - echo "activating"; - } -} From 5f119f94a4f9342223d8534559999d6e6781da4b Mon Sep 17 00:00:00 2001 From: Carol Abadeer Date: Mon, 25 Jul 2022 11:27:51 -0700 Subject: [PATCH 4/5] remove unused imports --- tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php b/tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php index 9e1f1d56..3ec3a3c4 100644 --- a/tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php +++ b/tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php @@ -4,8 +4,6 @@ namespace OpenTelemetry\Test\Unit\Instrumentation\AwsSdk; -use Opentelemetry\API\Common\Instrumentation\InstrumentationInterface; -use Opentelemetry\API\Common\Instrumentation\InstrumentationTrait; use OpenTelemetry\Instrumentation\AwsSdk\AwsSdkInstrumentation; use PHPUnit\Framework\TestCase; From ced61fb532ff4f0a169e717443f6ebea7baf350f Mon Sep 17 00:00:00 2001 From: Carol Abadeer Date: Fri, 29 Jul 2022 14:28:30 -0700 Subject: [PATCH 5/5] Added unit tests, experimental tag, and constant class variables --- .../AwsSdk/AwsSdkInstrumentation.php | 12 ++++---- .../AwsSdk/AwsSdkInstrumentationTest.php | 28 +++++++++++++++---- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php b/src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php index 55056ae8..75b79a9d 100644 --- a/src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php +++ b/src/Instrumentation/AwsSdk/AwsSdkInstrumentation.php @@ -7,22 +7,24 @@ use OpenTelemetry\API\Common\Instrumentation\InstrumentationInterface; use OpenTelemetry\API\Common\Instrumentation\InstrumentationTrait; +/** + * @experimental + */ class AwsSdkInstrumentation implements InstrumentationInterface { use InstrumentationTrait; - public function __construct() - { - } + public const NAME = 'AWS SDK Instrumentation'; + public const VERSION = '0.0.1'; public function getName(): string { - return 'AWS SDK Instrumentation'; + return self::NAME; } public function getVersion(): ?string { - return '0.0.1'; + return self::VERSION; } public function getSchemaUrl(): ?string diff --git a/tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php b/tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php index 3ec3a3c4..4958d520 100644 --- a/tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php +++ b/tests/Unit/Instrumentation/AwsSdk/AwsSdkInstrumentationTest.php @@ -11,20 +11,36 @@ class AwsSdkInstrumentationTest extends TestCase { public function testInstrumentationClassName() { - $awsSdkInstrumentation = new AwsSdkInstrumentation(); - $this->assertEquals( 'AWS SDK Instrumentation', - $awsSdkInstrumentation->getName() + (new AwsSdkInstrumentation())->getName() ); } - public function testInstrumentationActivated() + public function testInstrumentationVersion() + { + $this->assertEquals( + '0.0.1', + (new AwsSdkInstrumentation())->getVersion() + ); + } + + public function testInstrumentationSchemaUrl() { - $awsSdkInstrumentation = new AwsSdkInstrumentation(); + $this->assertNull((new AwsSdkInstrumentation())->getSchemaUrl()); + } + public function testInstrumentationInit() + { + $this->assertTrue( + (new AwsSdkInstrumentation())->init() + ); + } + + public function testInstrumentationActivated() + { $this->assertTrue( - $awsSdkInstrumentation->activate() + (new AwsSdkInstrumentation())->activate() ); } }