---
title: "danog\\BetterPrometheus\\BetterCounter: A better prometheus counter."
description: ""

---
# `danog\BetterPrometheus\BetterCounter`
[Back to index](../../index.md)

> Author: Daniil Gentili <daniil@daniil.it>  
  

A better prometheus counter.  



## Properties
* `$storageAdapter`: `Prometheus\Storage\Adapter` Storage adapter
* `$namespace`: `string` Metric namespace
* `$name`: `string` Metric name
* `$help`: `string` Info about the metric
* `$labels`: `array<string, string>` Default labels, i.e. ['instance' => 'instance_1']

## Method list:
* [`addLabels(array $labels): static`](#addLabels)
* [`inc(array<string, string> $labels = []): void`](#inc)
* [`incBy((int|float) $count, array<string, string> $labels = []): void`](#incBy)
* [`__construct(\Prometheus\Storage\Adapter $storageAdapter, string $namespace, string $name, string $help, array $labels = [])`](#__construct)

## Methods:
### <a name="addLabels"></a> `addLabels(array $labels): static`




Parameters:

* `$labels`: `array`   



### <a name="inc"></a> `inc(array<string, string> $labels = []): void`




Parameters:

* `$labels`: `array<string, string>` e.g. ['status' => '201', 'opcode' => 'SOME_OP']  



### <a name="incBy"></a> `incBy((int|float) $count, array<string, string> $labels = []): void`




Parameters:

* `$count`: `(int|float)` e.g. 2  
* `$labels`: `array<string, string>` e.g. ['status' => '201', 'opcode' => 'SOME_OP']  



### <a name="__construct"></a> `__construct(\Prometheus\Storage\Adapter $storageAdapter, string $namespace, string $name, string $help, array $labels = [])`

Constructor.


Parameters:

* `$storageAdapter`: `\Prometheus\Storage\Adapter`   
* `$namespace`: `string`   
* `$name`: `string`   
* `$help`: `string`   
* `$labels`: `array`   


#### See also: 
* `\Prometheus\Storage\Adapter`




---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
