Beberlei\Metrics\Collector\Prometheus::decrement PHP Method

decrement() public method

public decrement ( $variable )
    public function decrement($variable)
    {
        $this->data['counters'][] = array('name' => $variable, 'value' => -1);
    }

Usage Example

Beispiel #1
0
 public function testDecrementWithTags()
 {
     $expectedTagsValues = array('value1', 'value2');
     $gaugeMock = $this->getMockBuilder('\\Prometheus\\Gauge')->disableOriginalConstructor()->getMock();
     $gaugeMock->expects($this->once())->method('dec')->with($expectedTagsValues);
     $this->collectorRegistryMock->expects($this->once())->method('getGauge')->with(self::TEST_NAMESPACE, self::TEST_VARIABLE_NAME)->willReturn($gaugeMock);
     $this->collector->setTags(array('tag1' => 'value1', 'tag2' => 'value2'));
     $this->collector->decrement(self::TEST_VARIABLE_NAME);
     $this->collector->flush();
 }