Skip to content

Commit

Permalink
Fix psalm and cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevay committed Mar 15, 2024
1 parent db47d77 commit 69cff1c
Show file tree
Hide file tree
Showing 27 changed files with 79 additions and 5 deletions.
4 changes: 2 additions & 2 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
<directory name="./examples"/>
</errorLevel>
</ArgumentTypeCoercion>
<PossiblyUndefinedMethod>
<UndefinedInterfaceMethod>
<errorLevel type="suppress">
<directory name="src/Config/SDK/ComponentProvider"/>
</errorLevel>
</PossiblyUndefinedMethod>
</UndefinedInterfaceMethod>
<PossiblyNullReference>
<errorLevel type="suppress">
<directory name="src/Config/SDK/ComponentProvider"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use OpenTelemetry\SDK\Registry;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<LogRecordExporterInterface>
*/
final class LogRecordExporterConsole implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use OpenTelemetry\SDK\Registry;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<LogRecordExporterInterface>
*/
#[PackageDependency('open-telemetry/exporter-otlp', '^1.0.5')]
final class LogRecordExporterOtlp implements ComponentProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use OpenTelemetry\SDK\Logs\Processor\BatchLogRecordProcessor;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<LogRecordProcessorInterface>
*/
final class LogRecordProcessorBatch implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use OpenTelemetry\SDK\Logs\Processor\SimpleLogRecordProcessor;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<LogRecordProcessorInterface>
*/
final class LogRecordProcessorSimple implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use OpenTelemetry\SDK\Metrics\DefaultAggregationProviderTrait;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<DefaultAggregationProviderInterface>
*/
final class AggregationResolverDefault implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use OpenTelemetry\SDK\Metrics\MetricExporterInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<MetricExporterInterface>
*/
final class MetricExporterConsole implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
use OpenTelemetry\SDK\Registry;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<MetricExporterInterface>
*/
#[PackageDependency('open-telemetry/exporter-otlp', '^1.0.5')]
final class MetricExporterOtlp implements ComponentProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use OpenTelemetry\SDK\Metrics\MetricReaderInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<MetricReaderInterface>
*/
final class MetricReaderPeriodic implements ComponentProvider
{

Expand Down
6 changes: 4 additions & 2 deletions src/Config/SDK/ComponentProvider/OpenTelemetrySdk.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

/**
* @internal
*
* @implements ComponentProvider<SdkBuilder>
*/
final class OpenTelemetrySdk implements ComponentProvider
{
Expand Down Expand Up @@ -82,7 +84,7 @@ final class OpenTelemetrySdk implements ComponentProvider
* },
* selector: array{
* instrument_type: 'counter'|'histogram'|'observable_counter'|'observable_gauge'|'observable_up_down_counter'|'up_down_counter'|null,
* instrument_name: ?string,
* instrument_name: ?non-empty-string,
* unit: ?string,
* meter_name: ?string,
* meter_version: ?string,
Expand Down Expand Up @@ -359,7 +361,7 @@ private function getMeterProviderConfig(ComponentProviderRegistry $registry): Ar
])
->defaultNull()
->end()
->scalarNode('instrument_name')->defaultNull()->validate()->always(Validation::ensureString())->end()->end()
->scalarNode('instrument_name')->defaultNull()->validate()->always(Validation::ensureString())->end()->cannotBeEmpty()->end()
->scalarNode('unit')->defaultNull()->validate()->always(Validation::ensureString())->end()->end()
->scalarNode('meter_name')->defaultNull()->validate()->always(Validation::ensureString())->end()->end()
->scalarNode('meter_version')->defaultNull()->validate()->always(Validation::ensureString())->end()->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use OpenTelemetry\Extension\Propagator\B3\B3Propagator;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<TextMapPropagatorInterface>
*/
#[PackageDependency('open-telemetry/extension-propagator-b3', '^1.0.1')]
final class TextMapPropagatorB3 implements ComponentProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use OpenTelemetry\Extension\Propagator\B3\B3Propagator;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<TextMapPropagatorInterface>
*/
#[PackageDependency('open-telemetry/extension-propagator-b3', '^1.0.1')]
final class TextMapPropagatorB3Multi implements ComponentProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use OpenTelemetry\Context\Propagation\TextMapPropagatorInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<TextMapPropagatorInterface>
*/
final class TextMapPropagatorBaggage implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use OpenTelemetry\Context\Propagation\TextMapPropagatorInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<TextMapPropagatorInterface>
*/
final class TextMapPropagatorComposite implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use OpenTelemetry\Extension\Propagator\Jaeger\JaegerPropagator;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<TextMapPropagatorInterface>
*/
#[PackageDependency('open-telemetry/extension-propagator-jaeger', '^0.0.2')]
final class TextMapPropagatorJaeger implements ComponentProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use OpenTelemetry\Context\Propagation\TextMapPropagatorInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<TextMapPropagatorInterface>
*/
final class TextMapPropagatorTraceContext implements ComponentProvider
{

Expand Down
3 changes: 3 additions & 0 deletions src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOff.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use OpenTelemetry\SDK\Trace\SamplerInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SamplerInterface>
*/
final class SamplerAlwaysOff implements ComponentProvider
{

Expand Down
3 changes: 3 additions & 0 deletions src/Config/SDK/ComponentProvider/Trace/SamplerAlwaysOn.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use OpenTelemetry\SDK\Trace\SamplerInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SamplerInterface>
*/
final class SamplerAlwaysOn implements ComponentProvider
{

Expand Down
3 changes: 3 additions & 0 deletions src/Config/SDK/ComponentProvider/Trace/SamplerParentBased.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use OpenTelemetry\SDK\Trace\SamplerInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SamplerInterface>
*/
final class SamplerParentBased implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use OpenTelemetry\SDK\Trace\SamplerInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SamplerInterface>
*/
final class SamplerTraceIdRatioBased implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use OpenTelemetry\SDK\Trace\SpanExporterInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SpanExporterInterface>
*/
final class SpanExporterConsole implements ComponentProvider
{

Expand Down
3 changes: 3 additions & 0 deletions src/Config/SDK/ComponentProvider/Trace/SpanExporterOtlp.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use OpenTelemetry\SDK\Trace\SpanExporterInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SpanExporterInterface>
*/
#[PackageDependency('open-telemetry/exporter-otlp', '^1.0.5')]
final class SpanExporterOtlp implements ComponentProvider
{
Expand Down
3 changes: 3 additions & 0 deletions src/Config/SDK/ComponentProvider/Trace/SpanExporterZipkin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use OpenTelemetry\SDK\Trace\SpanExporterInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SpanExporterInterface>
*/
#[PackageDependency('open-telemetry/exporter-zipkin', '^1.0')]
final class SpanExporterZipkin implements ComponentProvider
{
Expand Down
3 changes: 3 additions & 0 deletions src/Config/SDK/ComponentProvider/Trace/SpanProcessorBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use OpenTelemetry\SDK\Trace\SpanProcessorInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SpanProcessorInterface>
*/
final class SpanProcessorBatch implements ComponentProvider
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use OpenTelemetry\SDK\Trace\SpanProcessorInterface;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

/**
* @implements ComponentProvider<SpanProcessorInterface>
*/
final class SpanProcessorSimple implements ComponentProvider
{

Expand Down
3 changes: 3 additions & 0 deletions src/Config/SDK/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public function create(Context $context = new Context()): SdkBuilder
return $this->sdkPlugin->create($context);
}

/**
* @param string|list<string> $file
*/
public static function parseFile(
string|array $file,
?string $cacheFile = null,
Expand Down
2 changes: 1 addition & 1 deletion src/Contrib/Otlp/OtlpUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function path(string $signal, string $protocol): string
Signals::TRACE => '/v1/traces',
Signals::METRICS => '/v1/metrics',
Signals::LOGS => '/v1/logs',
}
},
};
}

Expand Down

0 comments on commit 69cff1c

Please sign in to comment.