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