abstract class Measure

Measure represents a single numeric value to be tracked and recorded.

For example, latency, request bytes, and response bytes could be measures to collect from a server.

Measures by themselves have no outside effects. In order to be exported, the measure needs to be used in a View. If no Views are defined over a measure, there is very little cost in recording it.

Traits

Internal utility methods for working with tag keys, tag values, and metric names.

Constants

DIMENSIONLESS

measurement is dimensionless

BYTES

measurement in bytes

MILLISECONDS

measurement in milliseconds

NAME_MAX_LENGTH

EX_NAME_EXISTS

EX_INVALID_NAME

Properties

static protected array $map Contains our initialized Measure's
protected string $name Holds our Measure's name.
protected string $description Holds our measure's human readable description.
protected string $unit Holds the unit type of the value this measure takes on.

Methods

string
getName()

Name returns the name of this measure.

string
getDescription()

Discription returns the human-readable description of this measure.

string
getUnit()

Unit returns the units for the values this measure takes on.

static IntMeasure
newIntMeasure(string $name, string $description, string $unit)

Constructs a new IntMeasure.

static FloatMeasure
newFloatMeasure(string $name, string $description, string $unit)

Constructs a new FloatMeasure.

Details

at line 94
string getName()

Name returns the name of this measure.

Measure names are globally unique (among all libraries linked into your program). We recommend prefixing the measure name with a domain name relevant to your project or application.

Measure names are never exported to backends. They are only used to create Views.

Return Value

string

at line 104
string getDescription()

Discription returns the human-readable description of this measure.

Return Value

string

at line 117
string getUnit()

Unit returns the units for the values this measure takes on.

Units are encoded according to the case-sensitive abbreviations from the Unified Code for Units of Measure.

Return Value

string

at line 132
static IntMeasure newIntMeasure(string $name, string $description, string $unit)

Constructs a new IntMeasure.

Parameters

string $name Unique name of the Measure.
string $description Human readable discription of the Measure.
string $unit Unit of the Measure. See Unified Code for Units of Measure

Return Value

IntMeasure

Exceptions

Exception Throws on invalid measure name.

at line 147
static FloatMeasure newFloatMeasure(string $name, string $description, string $unit)

Constructs a new FloatMeasure.

Parameters

string $name Unique name of the Measure.
string $description Human readable discription of the Measure.
string $unit Unit of the Measure. See Unified Code for Units of Measure

Return Value

FloatMeasure

Exceptions

Exception Throws on invalid measure name.