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

Breadcrumb

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

function MetricConverter::convertNumberDataPoint

2 calls to MetricConverter::convertNumberDataPoint()
MetricConverter::convertGauge in vendor/open-telemetry/exporter-otlp/MetricConverter.php
MetricConverter::convertSum in vendor/open-telemetry/exporter-otlp/MetricConverter.php

File

vendor/open-telemetry/exporter-otlp/MetricConverter.php, line 179

Class

MetricConverter

Namespace

OpenTelemetry\Contrib\Otlp

Code

private function convertNumberDataPoint(SDK\Metrics\Data\NumberDataPoint $dataPoint) : NumberDataPoint {
    $pNumberDataPoint = new NumberDataPoint();
    $this->setAttributes($pNumberDataPoint, $dataPoint->attributes);
    $pNumberDataPoint->setStartTimeUnixNano($dataPoint->startTimestamp);
    $pNumberDataPoint->setTimeUnixNano($dataPoint->timestamp);
    if (is_int($dataPoint->value)) {
        $pNumberDataPoint->setAsInt($dataPoint->value);
    }
    if (is_float($dataPoint->value)) {
        $pNumberDataPoint->setAsDouble($dataPoint->value);
    }
    foreach ($dataPoint->exemplars as $exemplar) {
        
        /** @psalm-suppress InvalidArgument */
        $pNumberDataPoint->getExemplars()[] = $this->convertExemplar($exemplar);
    }
    return $pNumberDataPoint;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal