forked from open-telemetry/opentelemetry-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
490 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Config/SDK/ComponentProvider/Metrics/MetricReaderPull.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Config\SDK\ComponentProvider\Metrics; | ||
|
||
use OpenTelemetry\Config\SDK\Configuration\ComponentPlugin; | ||
use OpenTelemetry\Config\SDK\Configuration\ComponentProvider; | ||
use OpenTelemetry\Config\SDK\Configuration\ComponentProviderRegistry; | ||
use OpenTelemetry\Config\SDK\Configuration\Context; | ||
use OpenTelemetry\SDK\Metrics\MetricExporterInterface; | ||
use OpenTelemetry\SDK\Metrics\MetricReader\NoopReader; | ||
use OpenTelemetry\SDK\Metrics\MetricReaderInterface; | ||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; | ||
|
||
/** | ||
* @implements ComponentProvider<MetricReaderInterface> | ||
*/ | ||
final class MetricReaderPull implements ComponentProvider | ||
{ | ||
|
||
/** | ||
* @param array{ | ||
* exporter: ComponentPlugin<MetricExporterInterface>, | ||
* producers: array, | ||
* } $properties | ||
*/ | ||
public function createPlugin(array $properties, Context $context): MetricReaderInterface | ||
{ | ||
return new NoopReader(); | ||
} | ||
|
||
public function getConfig(ComponentProviderRegistry $registry): ArrayNodeDefinition | ||
{ | ||
$node = new ArrayNodeDefinition('pull'); | ||
$node | ||
->children() | ||
->append($registry->component('exporter', MetricExporterInterface::class)->isRequired()) | ||
->arrayNode('producers') //@todo | ||
->variablePrototype()->end() | ||
->end() | ||
; | ||
|
||
return $node; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\SDK\Metrics\MetricReader; | ||
|
||
use OpenTelemetry\SDK\Metrics\MetricReaderInterface; | ||
|
||
class NoopReader implements MetricReaderInterface | ||
{ | ||
|
||
public function collect(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function shutdown(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function forceFlush(): bool | ||
{ | ||
return true; | ||
} | ||
} |
Oops, something went wrong.