Skip to content

Commit

Permalink
Remove ref to getStoreStatPath (#132)
Browse files Browse the repository at this point in the history
* Remove ref to getStoreStatPath

* Remove test refs

* Updated syntax
  • Loading branch information
Richard Gubby authored Sep 20, 2019
1 parent d7a586d commit beb7f95
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
19 changes: 1 addition & 18 deletions src/classes/StatsD.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,24 +251,7 @@ public function setPivotValue($pivotValue)
*/
protected function getStatsPaths()
{
return(array_values(array_filter(array($this->getStoreStatPath(), $this->getAggregateStatPath()))));
}

/**
* @return null|string
*/
protected function getStoreStatPath()
{
$path = null;
if(isset($this->pivotValue))
{
if(!empty($this->prefix))
{
$path = $this->prefix . '.';
}
$path .= STAT_CLASS . '.' . STAT_PIVOT_FIELD . '.' . $this->pivotValue;
}
return $path;
return array_values(array_filter([$this->getAggregateStatPath()]));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions test/unit/mongo/MongoTripodDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2048,8 +2048,7 @@ public function testStatsD() {
->method("send")
->with(
array(
"myapp.tripod.MONGO_GET_ETAG"=>"1|c",
"myapp.tripod.group_by_db.tripod_php_testing.MONGO_GET_ETAG"=>"1|c"
"myapp.tripod.MONGO_GET_ETAG"=>"1|c"
)
);

Expand Down
8 changes: 1 addition & 7 deletions test/unit/mongo/MongoTripodStatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public function testStatsDIncrementWithPivotValueNoPrefix()
->method('send')
->with(
array(
STAT_CLASS.'.'.STAT_PIVOT_FIELD.'.wibble.FOO.BAR'=>'1|c',
STAT_CLASS.'.FOO.BAR'=>"1|c"
),
1
Expand Down Expand Up @@ -112,7 +111,6 @@ public function testStatsDIncrementWithPivotValueAndPrefix()
->method('send')
->with(
array(
'somePrefix.' . STAT_CLASS . '.' . STAT_PIVOT_FIELD . '.wibble.FOO.BAR'=>"5|c",
'somePrefix.' . STAT_CLASS.'.FOO.BAR'=>"5|c"
),
1
Expand Down Expand Up @@ -147,7 +145,6 @@ public function testStatsDTimerWithPivotValueNoPrefix()
->method('send')
->with(
array(
STAT_CLASS . '.' . STAT_PIVOT_FIELD . '.wibble.FOO.BAR'=>array("1|c","1234|ms"),
STAT_CLASS . '.FOO.BAR'=>array("1|c","1234|ms")
),
1
Expand Down Expand Up @@ -181,7 +178,6 @@ public function testStatsDTimerWithPrefixAndPivotValue()
->method('send')
->with(
array(
'somePrefix.' . STAT_CLASS . '.' . STAT_PIVOT_FIELD . '.wibble.FOO.BAR'=>array("1|c","4567|ms"),
'somePrefix.' . STAT_CLASS . '.FOO.BAR'=>array("1|c","4567|ms")
),
1
Expand Down Expand Up @@ -216,7 +212,6 @@ public function testStatsDGaugeWithPivotValueNoPrefix()
->method('send')
->with(
array(
STAT_CLASS. '.' . STAT_PIVOT_FIELD .'.wibble.FOO.BAR'=>"xyz|g",
STAT_CLASS.'.FOO.BAR'=>"xyz|g"
),
1
Expand Down Expand Up @@ -251,7 +246,6 @@ public function testStatsDGaugeWithPrefixAndPivotValue()
->method('send')
->with(
array(
'somePrefix.' . STAT_CLASS . '.' . STAT_PIVOT_FIELD . '.wibble.FOO.BAR'=>"abc|g",
'somePrefix.' . STAT_CLASS . '.FOO.BAR'=>"abc|g"
),
1
Expand Down Expand Up @@ -305,4 +299,4 @@ public function testPivotValueCannotContainConsecutiveDot()
$stat = new \Tripod\StatsD('foo.bar', 4567);
$stat->setPivotValue('some..value');
}
}
}

0 comments on commit beb7f95

Please sign in to comment.