Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Metric.php

class Metric

Same name in this branch
  1. 11.1.x vendor/open-telemetry/sdk/Metrics/Stream/Metric.php \OpenTelemetry\SDK\Metrics\Stream\Metric
  2. 11.1.x vendor/open-telemetry/sdk/Metrics/Data/Metric.php \OpenTelemetry\SDK\Metrics\Data\Metric

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… 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 <code>opentelemetry.proto.metrics.v1.Metric</code>

Hierarchy

  • class \Google\Protobuf\Internal\Message
    • class \Opentelemetry\Proto\Metrics\V1\Metric extends \Google\Protobuf\Internal\Message

Expanded class hierarchy of Metric

1 file declares its use of Metric
MetricConverter.php in vendor/open-telemetry/exporter-otlp/MetricConverter.php

File

vendor/open-telemetry/gen-otlp-protobuf/Opentelemetry/Proto/Metrics/V1/Metric.php, line 86

Namespace

Opentelemetry\Proto\Metrics\V1
View source
class Metric extends \Google\Protobuf\Internal\Message {
    
    /**
     * name of the metric.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    protected $name = '';
    
    /**
     * description of the metric, which can be used in documentation.
     *
     * Generated from protobuf field <code>string description = 2;</code>
     */
    protected $description = '';
    
    /**
     * unit in which the metric value is reported. Follows the format
     * described by http://unitsofmeasure.org/ucum.html.
     *
     * Generated from protobuf field <code>string unit = 3;</code>
     */
    protected $unit = '';
    
    /**
     * 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).
     *
     * Generated from protobuf field <code>repeated .opentelemetry.proto.common.v1.KeyValue metadata = 12;</code>
     */
    private $metadata;
    protected $data;
    
    /**
     * Constructor.
     *
     * @param array $data {
     *     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).
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Opentelemetry\Proto\Metrics\V1\Metrics::initOnce();
        parent::__construct($data);
    }
    
    /**
     * name of the metric.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName() {
        return $this->name;
    }
    
    /**
     * name of the metric.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var) {
        GPBUtil::checkString($var, True);
        $this->name = $var;
        return $this;
    }
    
    /**
     * description of the metric, which can be used in documentation.
     *
     * Generated from protobuf field <code>string description = 2;</code>
     * @return string
     */
    public function getDescription() {
        return $this->description;
    }
    
    /**
     * description of the metric, which can be used in documentation.
     *
     * Generated from protobuf field <code>string description = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setDescription($var) {
        GPBUtil::checkString($var, True);
        $this->description = $var;
        return $this;
    }
    
    /**
     * unit in which the metric value is reported. Follows the format
     * described by http://unitsofmeasure.org/ucum.html.
     *
     * Generated from protobuf field <code>string unit = 3;</code>
     * @return string
     */
    public function getUnit() {
        return $this->unit;
    }
    
    /**
     * unit in which the metric value is reported. Follows the format
     * described by http://unitsofmeasure.org/ucum.html.
     *
     * Generated from protobuf field <code>string unit = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setUnit($var) {
        GPBUtil::checkString($var, True);
        $this->unit = $var;
        return $this;
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Gauge gauge = 5;</code>
     * @return \Opentelemetry\Proto\Metrics\V1\Gauge|null
     */
    public function getGauge() {
        return $this->readOneof(5);
    }
    public function hasGauge() {
        return $this->hasOneof(5);
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Gauge gauge = 5;</code>
     * @param \Opentelemetry\Proto\Metrics\V1\Gauge $var
     * @return $this
     */
    public function setGauge($var) {
        GPBUtil::checkMessage($var, \Opentelemetry\Proto\Metrics\V1\Gauge::class);
        $this->writeOneof(5, $var);
        return $this;
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Sum sum = 7;</code>
     * @return \Opentelemetry\Proto\Metrics\V1\Sum|null
     */
    public function getSum() {
        return $this->readOneof(7);
    }
    public function hasSum() {
        return $this->hasOneof(7);
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Sum sum = 7;</code>
     * @param \Opentelemetry\Proto\Metrics\V1\Sum $var
     * @return $this
     */
    public function setSum($var) {
        GPBUtil::checkMessage($var, \Opentelemetry\Proto\Metrics\V1\Sum::class);
        $this->writeOneof(7, $var);
        return $this;
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Histogram histogram = 9;</code>
     * @return \Opentelemetry\Proto\Metrics\V1\Histogram|null
     */
    public function getHistogram() {
        return $this->readOneof(9);
    }
    public function hasHistogram() {
        return $this->hasOneof(9);
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Histogram histogram = 9;</code>
     * @param \Opentelemetry\Proto\Metrics\V1\Histogram $var
     * @return $this
     */
    public function setHistogram($var) {
        GPBUtil::checkMessage($var, \Opentelemetry\Proto\Metrics\V1\Histogram::class);
        $this->writeOneof(9, $var);
        return $this;
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10;</code>
     * @return \Opentelemetry\Proto\Metrics\V1\ExponentialHistogram|null
     */
    public function getExponentialHistogram() {
        return $this->readOneof(10);
    }
    public function hasExponentialHistogram() {
        return $this->hasOneof(10);
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10;</code>
     * @param \Opentelemetry\Proto\Metrics\V1\ExponentialHistogram $var
     * @return $this
     */
    public function setExponentialHistogram($var) {
        GPBUtil::checkMessage($var, \Opentelemetry\Proto\Metrics\V1\ExponentialHistogram::class);
        $this->writeOneof(10, $var);
        return $this;
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Summary summary = 11;</code>
     * @return \Opentelemetry\Proto\Metrics\V1\Summary|null
     */
    public function getSummary() {
        return $this->readOneof(11);
    }
    public function hasSummary() {
        return $this->hasOneof(11);
    }
    
    /**
     * Generated from protobuf field <code>.opentelemetry.proto.metrics.v1.Summary summary = 11;</code>
     * @param \Opentelemetry\Proto\Metrics\V1\Summary $var
     * @return $this
     */
    public function setSummary($var) {
        GPBUtil::checkMessage($var, \Opentelemetry\Proto\Metrics\V1\Summary::class);
        $this->writeOneof(11, $var);
        return $this;
    }
    
    /**
     * 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).
     *
     * Generated from protobuf field <code>repeated .opentelemetry.proto.common.v1.KeyValue metadata = 12;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getMetadata() {
        return $this->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).
     *
     * Generated from protobuf field <code>repeated .opentelemetry.proto.common.v1.KeyValue metadata = 12;</code>
     * @param \Opentelemetry\Proto\Common\V1\KeyValue[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setMetadata($var) {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Opentelemetry\Proto\Common\V1\KeyValue::class);
        $this->metadata = $arr;
        return $this;
    }
    
    /**
     * @return string
     */
    public function getData() {
        return $this->whichOneof("data");
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
Message::$desc private property @ignore
Message::$unknown private property
Message::appendHelper private function
Message::byteSize public function @ignore
Message::clear public function Clear all containing fields.
Message::convertJsonValueToProtoValue private function
Message::defaultValue private function @ignore
Message::discardUnknownFields public function Clear all unknown fields previously parsed.
Message::existField private function @ignore
Message::fieldByteSize private function @ignore
Message::fieldDataOnlyByteSize private function @ignore
Message::fieldDataOnlyJsonByteSize private function @ignore
Message::fieldJsonByteSize private function @ignore
Message::hasOneof protected function
Message::initWithDescriptor private function @ignore
Message::initWithGeneratedPool private function @ignore
Message::jsonByteSize public function @ignore
Message::kvUpdateHelper private function
Message::mergeFrom public function Merges the contents of the specified message into current message.
Message::mergeFromArray protected function Populates the message from a user-supplied PHP array. Array keys
correspond to Message properties and nested message properties.
Message::mergeFromArrayJsonImpl private function
Message::mergeFromJsonArray protected function
Message::mergeFromJsonString public function Parses a json string to protobuf message.
Message::mergeFromString public function Parses a protocol buffer contained in a string.
Message::normalizeArrayElementsToMessageType private static function Tries to normalize the elements in $value into a provided protobuf
wrapper type $class. If $value is any type other than array, we do
not do any conversion, and instead rely on the existing protobuf
type checking. If $value is an array, we process…
Message::normalizeToMessageType private static function Tries to normalize $value into a provided protobuf wrapper type $class.
If $value is any type other than an object, we attempt to construct an
instance of $class and assign $value to it using the setValue method
shared by all wrapper types.
Message::parseFieldFromStream private function @ignore
Message::parseFieldFromStreamNoTag private static function @ignore
Message::parseFromJsonStream public function @ignore
Message::parseFromStream public function @ignore
Message::readOneof protected function
Message::readWrapperValue protected function
Message::repeatedFieldDataOnlyByteSize private function @ignore
Message::serializeFieldToJsonStream private function @ignore
Message::serializeFieldToStream private function @ignore
Message::serializeMapFieldToStream private function @ignore
Message::serializeRepeatedFieldToStream private function @ignore
Message::serializeSingularFieldToStream private function @ignore
Message::serializeToJsonStream public function @ignore
Message::serializeToJsonString public function Serialize the message to json string.
Message::serializeToStream public function @ignore
Message::serializeToString public function Serialize the message to string.
Message::skipField private function @ignore
Message::whichOneof protected function
Message::writeOneof protected function
Message::writeWrapperValue protected function
Message::__debugInfo public function
Metric::$data protected property
Metric::$description protected property description of the metric, which can be used in documentation.
Metric::$metadata private property 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…
Metric::$name protected property name of the metric.
Metric::$unit protected property unit in which the metric value is reported. Follows the format
described by http://unitsofmeasure.org/ucum.html.
Metric::getData public function
Metric::getDescription public function description of the metric, which can be used in documentation.
Metric::getExponentialHistogram public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10;&lt;/code&gt;
Metric::getGauge public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.Gauge gauge = 5;&lt;/code&gt;
Metric::getHistogram public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.Histogram histogram = 9;&lt;/code&gt;
Metric::getMetadata public function 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…
Metric::getName public function name of the metric.
Metric::getSum public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.Sum sum = 7;&lt;/code&gt;
Metric::getSummary public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.Summary summary = 11;&lt;/code&gt;
Metric::getUnit public function unit in which the metric value is reported. Follows the format
described by http://unitsofmeasure.org/ucum.html.
Metric::hasExponentialHistogram public function
Metric::hasGauge public function
Metric::hasHistogram public function
Metric::hasSum public function
Metric::hasSummary public function
Metric::setDescription public function description of the metric, which can be used in documentation.
Metric::setExponentialHistogram public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.ExponentialHistogram exponential_histogram = 10;&lt;/code&gt;
Metric::setGauge public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.Gauge gauge = 5;&lt;/code&gt;
Metric::setHistogram public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.Histogram histogram = 9;&lt;/code&gt;
Metric::setMetadata public function 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…
Metric::setName public function name of the metric.
Metric::setSum public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.Sum sum = 7;&lt;/code&gt;
Metric::setSummary public function Generated from protobuf field &lt;code&gt;.opentelemetry.proto.metrics.v1.Summary summary = 11;&lt;/code&gt;
Metric::setUnit public function unit in which the metric value is reported. Follows the format
described by http://unitsofmeasure.org/ucum.html.
Metric::__construct public function Constructor. Overrides Message::__construct
RSS feed
Powered by Drupal