예제 #1
0
 /**
  * @inheritdoc
  */
 public function testType()
 {
     $metric = new TimerMetric('name', 1);
     $this->assertEquals('timer', $metric->getType());
 }
 /**
  * Tests memory formatter
  */
 public function testTimerMetric()
 {
     $metric1 = new TimerMetric('metric_name1', 10);
     $expected1 = 'metric_name1:10|ms';
     $this->assertEquals($expected1, $this->formatter->format($metric1));
     $metric2 = new TimerMetric('metric_name2', 40, ['env' => 'dev']);
     $expected2 = 'env.dev.metric_name2:40|ms';
     $this->assertEquals($expected2, $this->formatter->format($metric2));
     $metric3 = new TimerMetric('metric_name3', 40, ['env' => 'dev']);
     $metric3->setSampleRate(0.5);
     $expected3 = 'env.dev.metric_name3:40|ms|@0.5';
     $this->assertEquals($expected3, $this->formatter->format($metric3));
     $metric4 = new TimerMetric('metric_name4', ['internal' => 10]);
     $this->assertFalse($this->formatter->format($metric4));
 }