class CriteriaViewRegistry
Hierarchy
- class \OpenTelemetry\SDK\Metrics\View\CriteriaViewRegistry implements \OpenTelemetry\SDK\Metrics\ViewRegistryInterface
Expanded class hierarchy of CriteriaViewRegistry
1 file declares its use of CriteriaViewRegistry
- MeterProviderBuilder.php in vendor/
open-telemetry/ sdk/ Metrics/ MeterProviderBuilder.php
File
-
vendor/
open-telemetry/ sdk/ Metrics/ View/ CriteriaViewRegistry.php, line 12
Namespace
OpenTelemetry\SDK\Metrics\ViewView source
final class CriteriaViewRegistry implements ViewRegistryInterface {
/** @var list<SelectionCriteriaInterface> */
private array $criteria = [];
/** @var list<ViewTemplate> */
private array $views = [];
public function register(SelectionCriteriaInterface $criteria, ViewTemplate $view) : void {
$this->criteria[] = $criteria;
$this->views[] = $view;
}
/**
* @todo is null the best return type here? what about empty array or exception?
*/
public function find(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope) : ?iterable {
$views = $this->generateViews($instrument, $instrumentationScope);
return $views->valid() ? $views : null;
}
private function generateViews(Instrument $instrument, InstrumentationScopeInterface $instrumentationScope) : Generator {
foreach ($this->criteria as $i => $criteria) {
if ($criteria->accepts($instrument, $instrumentationScope)) {
(yield $this->views[$i]
->project($instrument));
}
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
CriteriaViewRegistry::$criteria | private | property | @var list<SelectionCriteriaInterface> | |
CriteriaViewRegistry::$views | private | property | @var list<ViewTemplate> | |
CriteriaViewRegistry::find | public | function | @todo is null the best return type here? what about empty array or exception? | Overrides ViewRegistryInterface::find |
CriteriaViewRegistry::generateViews | private | function | ||
CriteriaViewRegistry::register | public | function |