Repository: open-telemetry/opentelemetry-php (php)

Issue:
Naming Updates
To follow the spec, we should apply naming updates that were added to the specification:

Spec updates to apply for each language:
HTTPText propagator renamed to TextMap propagator (https://github.com/open-telemetry/opentelemetry-specification/pull/793)
ProbabilitySampler renamed to TraceIdRatioBased (https://github.com/open-telemetry/opentelemetry-specification/pull/611)
ParentOrElse renamed to ParentBased (https://github.com/open-telemetry/opentelemetry-specification/pull/610)
OTLP exporter unified configuration for Tracing/Metrics (https://github.com/open-telemetry/opentelemetry-specification/pull/820)
Add Translation of InstrumentationLibraryInfo to Jaeger/Zipkin

Success criteria - renaming these parts of the codebase where applicable

Pull request description:
rename instances of  httptext to textmap
fixes #174
References https://github.com/open-telemetry/opentelemetry-specification/pull/793 

Patch:
diff --git a/api/Trace/HTTPTextFormatPropagator.php b/api/Trace/TextMapFormatPropagator.php
similarity index 96%
rename from api/Trace/HTTPTextFormatPropagator.php
rename to api/Trace/TextMapFormatPropagator.php
index 0f47b544..0f613a3b 100644
--- a/api/Trace/HTTPTextFormatPropagator.php
+++ b/api/Trace/TextMapFormatPropagator.php
@@ -4,7 +4,7 @@ declare(strict_types=1);
 
 namespace OpenTelemetry\Trace;
 
-interface HTTPTextFormatPropagator
+interface TextMapFormatPropagator
 {
     /**
      * Returns list of fields that will be used by this formatter.
diff --git a/sdk/Trace/Sampler.php b/sdk/Trace/Sampler.php
index 5307c05b..cb00afda 100644
--- a/sdk/Trace/Sampler.php
+++ b/sdk/Trace/Sampler.php
@@ -41,7 +41,7 @@ interface Sampler
     /**
      * Returns the sampler name or short description with the configuration.
      * This may be displayed on debug pages or in the logs.
-     * Example: "ProbabilitySampler{0.000100}"
+     * Example: "TraceIdRatioBasedSampler{0.000100}"
      * @return string
      */
     public function getDescription(): string;
diff --git a/sdk/Trace/Sampler/ProbabilitySampler.php b/sdk/Trace/Sampler/TraceIdRatioBasedSampler.php
similarity index 84%
rename from sdk/Trace/Sampler/ProbabilitySampler.php
rename to sdk/Trace/Sampler/TraceIdRatioBasedSampler.php
index 915f3647..5820f9d8 100644
--- a/sdk/Trace/Sampler/ProbabilitySampler.php
+++ b/sdk/Trace/Sampler/TraceIdRatioBasedSampler.php
@@ -12,11 +12,11 @@ use OpenTelemetry\Trace as API;
  * This implementation of the SamplerInterface records with given probability.
  * Example:
  * ```
- * use OpenTelemetry\Trace\ProbabilitySampler;
- * $sampler = new ProbabilitySampler(0.01);
+ * use OpenTelemetry\Trace\TraceIdRatioBasedSampler;
+ * $sampler = new TraceIdRatioBasedSampler(0.01);
  * ```
  */
-class ProbabilitySampler implements Sampler
+class TraceIdRatioBasedSampler implements Sampler
 {
     /**
      * @var float
@@ -24,7 +24,7 @@ class ProbabilitySampler implements Sampler
     private $probability;
 
     /**
-     * ProbabilitySampler constructor.
+     * TraceIdRatioBasedSampler constructor.
      * @param float $probability Probability float value between 0.0 and 1.0.
      */
     public function __construct(float $probability)
@@ -59,6 +59,6 @@ class ProbabilitySampler implements Sampler
 
     public function getDescription(): string
     {
-        return sprintf('%s{%.6f}', 'ProbabilitySampler', $this->probability);
+        return sprintf('%s{%.6f}', 'TraceIdRatioBasedSampler', $this->probability);
     }
 }


Test patch:
diff --git a/tests/Sdk/Integration/ProbabilitySamplerTest.php b/tests/Sdk/Integration/TraceIdRatioBasedSamplerTest.php
similarity index 64%
rename from tests/Sdk/Integration/ProbabilitySamplerTest.php
rename to tests/Sdk/Integration/TraceIdRatioBasedSamplerTest.php
index ba784857..51ce9497 100644
--- a/tests/Sdk/Integration/ProbabilitySamplerTest.php
+++ b/tests/Sdk/Integration/TraceIdRatioBasedSamplerTest.php
@@ -4,16 +4,16 @@ declare(strict_types=1);
 
 namespace OpenTelemetry\Tests\Sdk\Integration;
 
-use OpenTelemetry\Sdk\Trace\Sampler\ProbabilitySampler;
+use OpenTelemetry\Sdk\Trace\Sampler\TraceIdRatioBasedSampler;
 use OpenTelemetry\Sdk\Trace\SamplingResult;
 use OpenTelemetry\Trace as API;
 use PHPUnit\Framework\TestCase;
 
-class ProbabilitySamplerTest extends TestCase
+class TraceIdRatioBasedSamplerTest extends TestCase
 {
-    public function testNeverProbabilitySamplerDecision()
+    public function testNeverTraceIdRatioBasedSamplerDecision()
     {
-        $sampler = new ProbabilitySampler(0.0);
+        $sampler = new TraceIdRatioBasedSampler(0.0);
         $decision = $sampler->shouldSample(
             null,
             '4bf92f3577b34da6a3ce929d0e0e4736',
@@ -24,9 +24,9 @@ class ProbabilitySamplerTest extends TestCase
         $this->assertEquals(SamplingResult::NOT_RECORD, $decision->getDecision());
     }
 
-    public function testAlwaysProbabilitySamplerDecision()
+    public function testAlwaysTraceIdRatioBasedSamplerDecision()
     {
-        $sampler = new ProbabilitySampler(1.0);
+        $sampler = new TraceIdRatioBasedSampler(1.0);
         $decision = $sampler->shouldSample(
             null,
             '4bf92f3577b34da6a3ce929d0e0e4736',
@@ -39,7 +39,7 @@ class ProbabilitySamplerTest extends TestCase
 
     public function testAlwaysOnSamplerDescription()
     {
-        $sampler = new ProbabilitySampler(0.0001);
-        $this->assertEquals('ProbabilitySampler{0.000100}', $sampler->getDescription());
+        $sampler = new TraceIdRatioBasedSampler(0.0001);
+        $this->assertEquals('TraceIdRatioBasedSampler{0.000100}', $sampler->getDescription());
     }
 }