Metric
extends Message
in package
Defines a Metric which has one or more timeseries. The following is a brief summary of the Metric data model. For more details, see: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md The data model and relation between entities is shown in the diagram below. Here, "DataPoint" is the term used to refer to any one of the specific data point value types, and "points" is the term used to refer to any one of the lists of points contained in the Metric.
- Metric is composed of a metadata and data.
- Metadata part contains a name, description, unit.
- Data is one of the possible types (Sum, Gauge, Histogram, Summary).
- DataPoint contains timestamps, attributes, and one of the possible value type fields. Metric +------------+ |name | |description | |unit | +------------------------------------+ |data |---> |Gauge, Sum, Histogram, Summary, ... | +------------+ +------------------------------------+ Data [One of Gauge, Sum, Histogram, Summary, ...] +-----------+ |... | // Metadata about the Data. |points |--+ +-----------+ | | +---------------------------+ | |DataPoint 1 | v |+------+------+ +------+ | +-----+ ||label |label |...|label | | | 1 |-->||value1|value2|...|valueN| | +-----+ |+------+------+ +------+ | | . | |+-----+ | | . | ||value| | | . | |+-----+ | | . | +---------------------------+ | . | . | . | . | . | . | . | +---------------------------+ | . | |DataPoint M | +-----+ |+------+------+ +------+ | | M |-->||label |label |...|label | | +-----+ ||value1|value2|...|valueN| | |+------+------+ +------+ | |+-----+ | ||value| | |+-----+ | +---------------------------+ Each distinct type of DataPoint represents the output of a specific aggregation function, the result of applying the DataPoint's associated function of to one or more measurements. All DataPoint types have three common fields:
- Attributes includes key-value pairs associated with the data point
- TimeUnixNano is required, set to the end time of the aggregation
- StartTimeUnixNano is optional, but strongly encouraged for DataPoints having an AggregationTemporality field, as discussed below. Both TimeUnixNano and StartTimeUnixNano values are expressed as UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
TimeUnixNano
This field is required, having consistent interpretation across DataPoint types. TimeUnixNano is the moment corresponding to when the data point's aggregate value was captured. Data points with the 0 value for TimeUnixNano SHOULD be rejected by consumers.
StartTimeUnixNano
StartTimeUnixNano in general allows detecting when a sequence of observations is unbroken. This field indicates to consumers the start time for points with cumulative and delta AggregationTemporality, and it should be included whenever possible to support correct rate calculation. Although it may be omitted when the start time is truly unknown, setting StartTimeUnixNano is strongly encouraged.
Generated from protobuf message opentelemetry.proto.metrics.v1.Metric
Table of Contents
Properties
- $data : mixed
- $description : mixed
- description of the metric, which can be used in documentation.
- $name : mixed
- name of the metric.
- $unit : mixed
- unit in which the metric value is reported. Follows the format described by http://unitsofmeasure.org/ucum.html.
- $metadata : mixed
- Additional metadata attributes that describe the metric. [Optional].
Methods
- __construct() : mixed
- Constructor.
- getData() : string
- getDescription() : string
- description of the metric, which can be used in documentation.
- getExponentialHistogram() : ExponentialHistogram|null
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10;</code>
- getGauge() : Gauge|null
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Gauge gauge = 5;</code>
- getHistogram() : Histogram|null
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Histogram histogram = 9;</code>
- getMetadata() : RepeatedField
- Additional metadata attributes that describe the metric. [Optional].
- getName() : string
- name of the metric.
- getSum() : Sum|null
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Sum sum = 7;</code>
- getSummary() : Summary|null
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Summary summary = 11;</code>
- getUnit() : string
- unit in which the metric value is reported. Follows the format described by http://unitsofmeasure.org/ucum.html.
- hasExponentialHistogram() : mixed
- hasGauge() : mixed
- hasHistogram() : mixed
- hasSum() : mixed
- hasSummary() : mixed
- setDescription() : $this
- description of the metric, which can be used in documentation.
- setExponentialHistogram() : $this
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10;</code>
- setGauge() : $this
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Gauge gauge = 5;</code>
- setHistogram() : $this
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Histogram histogram = 9;</code>
- setMetadata() : $this
- Additional metadata attributes that describe the metric. [Optional].
- setName() : $this
- name of the metric.
- setSum() : $this
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Sum sum = 7;</code>
- setSummary() : $this
- Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Summary summary = 11;</code>
- setUnit() : $this
- unit in which the metric value is reported. Follows the format described by http://unitsofmeasure.org/ucum.html.
Properties
$data
protected
mixed
$data
$description
description of the metric, which can be used in documentation.
protected
mixed
$description
= ''
Generated from protobuf field string description = 2;
$name
name of the metric.
protected
mixed
$name
= ''
Generated from protobuf field string name = 1;
$unit
unit in which the metric value is reported. Follows the format described by http://unitsofmeasure.org/ucum.html.
protected
mixed
$unit
= ''
Generated from protobuf field string unit = 3;
$metadata
Additional metadata attributes that describe the metric. [Optional].
private
mixed
$metadata
Attributes are non-identifying. Consumers SHOULD NOT need to be aware of these attributes. These attributes MAY be used to encode information allowing for lossless roundtrip translation to / from another data model. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key).
Generated from protobuf field repeated .opentelemetry.proto.common.v1.KeyValue metadata = 12;
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $data = NULL ]) : mixed
Parameters
- $data : array<string|int, mixed> = NULL
-
{ Optional. Data for populating the Message object.
@type string $name name of the metric. @type string $description description of the metric, which can be used in documentation. @type string $unit unit in which the metric value is reported. Follows the format described by http://unitsofmeasure.org/ucum.html. @type \Opentelemetry\Proto\Metrics\V1\Gauge $gauge @type \Opentelemetry\Proto\Metrics\V1\Sum $sum @type \Opentelemetry\Proto\Metrics\V1\Histogram $histogram @type \Opentelemetry\Proto\Metrics\V1\ExponentialHistogram $exponential_histogram @type \Opentelemetry\Proto\Metrics\V1\Summary $summary @type \Opentelemetry\Proto\Common\V1\KeyValue[]|\Google\Protobuf\Internal\RepeatedField $metadata Additional metadata attributes that describe the metric. [Optional]. Attributes are non-identifying. Consumers SHOULD NOT need to be aware of these attributes. These attributes MAY be used to encode information allowing for lossless roundtrip translation to / from another data model. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key).
}
getData()
public
getData() : string
Return values
stringgetDescription()
description of the metric, which can be used in documentation.
public
getDescription() : string
Generated from protobuf field string description = 2;
Return values
stringgetExponentialHistogram()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10;</code>
public
getExponentialHistogram() : ExponentialHistogram|null
Return values
ExponentialHistogram|nullgetGauge()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Gauge gauge = 5;</code>
public
getGauge() : Gauge|null
Return values
Gauge|nullgetHistogram()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Histogram histogram = 9;</code>
public
getHistogram() : Histogram|null
Return values
Histogram|nullgetMetadata()
Additional metadata attributes that describe the metric. [Optional].
public
getMetadata() : RepeatedField
Attributes are non-identifying. Consumers SHOULD NOT need to be aware of these attributes. These attributes MAY be used to encode information allowing for lossless roundtrip translation to / from another data model. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key).
Generated from protobuf field repeated .opentelemetry.proto.common.v1.KeyValue metadata = 12;
Return values
RepeatedFieldgetName()
name of the metric.
public
getName() : string
Generated from protobuf field string name = 1;
Return values
stringgetSum()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Sum sum = 7;</code>
public
getSum() : Sum|null
Return values
Sum|nullgetSummary()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Summary summary = 11;</code>
public
getSummary() : Summary|null
Return values
Summary|nullgetUnit()
unit in which the metric value is reported. Follows the format described by http://unitsofmeasure.org/ucum.html.
public
getUnit() : string
Generated from protobuf field string unit = 3;
Return values
stringhasExponentialHistogram()
public
hasExponentialHistogram() : mixed
hasGauge()
public
hasGauge() : mixed
hasHistogram()
public
hasHistogram() : mixed
hasSum()
public
hasSum() : mixed
hasSummary()
public
hasSummary() : mixed
setDescription()
description of the metric, which can be used in documentation.
public
setDescription(string $var) : $this
Generated from protobuf field string description = 2;
Parameters
- $var : string
Return values
$thissetExponentialHistogram()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10;</code>
public
setExponentialHistogram(ExponentialHistogram $var) : $this
Parameters
- $var : ExponentialHistogram
Return values
$thissetGauge()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Gauge gauge = 5;</code>
public
setGauge(Gauge $var) : $this
Parameters
- $var : Gauge
Return values
$thissetHistogram()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Histogram histogram = 9;</code>
public
setHistogram(Histogram $var) : $this
Parameters
- $var : Histogram
Return values
$thissetMetadata()
Additional metadata attributes that describe the metric. [Optional].
public
setMetadata(array<string|int, KeyValue>|RepeatedField $var) : $this
Attributes are non-identifying. Consumers SHOULD NOT need to be aware of these attributes. These attributes MAY be used to encode information allowing for lossless roundtrip translation to / from another data model. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key).
Generated from protobuf field repeated .opentelemetry.proto.common.v1.KeyValue metadata = 12;
Parameters
- $var : array<string|int, KeyValue>|RepeatedField
Return values
$thissetName()
name of the metric.
public
setName(string $var) : $this
Generated from protobuf field string name = 1;
Parameters
- $var : string
Return values
$thissetSum()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Sum sum = 7;</code>
public
setSum(Sum $var) : $this
Parameters
- $var : Sum
Return values
$thissetSummary()
Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Summary summary = 11;</code>
public
setSummary(Summary $var) : $this
Parameters
- $var : Summary
Return values
$thissetUnit()
unit in which the metric value is reported. Follows the format described by http://unitsofmeasure.org/ucum.html.
public
setUnit(string $var) : $this
Generated from protobuf field string unit = 3;
Parameters
- $var : string