Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing tests #189

Merged
merged 10 commits into from
Aug 28, 2023
9 changes: 5 additions & 4 deletions src/Aws/tests/Unit/Xray/PropagatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use OpenTelemetry\API\Trace\SpanContext;
use OpenTelemetry\API\Trace\SpanContextInterface;
use OpenTelemetry\API\Trace\SpanContextValidator;
use OpenTelemetry\API\Trace\TraceFlags;
use OpenTelemetry\API\Trace\TraceState;
use OpenTelemetry\Aws\Xray\Propagator;
use OpenTelemetry\Context\Context;
Expand Down Expand Up @@ -45,7 +46,7 @@ public function InjectValidSampledTraceId()
$carrier,
null,
$this->withSpanContext(
SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_SAMPLED),
SpanContext::create(self::TRACE_ID, self::SPAN_ID, TraceFlags::SAMPLED),
Context::getCurrent()
)
);
Expand All @@ -67,7 +68,7 @@ public function InjectValidNotSampledTraceId()
$carrier,
null,
$this->withSpanContext(
SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_DEFAULT),
SpanContext::create(self::TRACE_ID, self::SPAN_ID),
Context::getCurrent()
)
);
Expand All @@ -89,7 +90,7 @@ public function InjectTraceIdWithTraceState()
$carrier,
null,
$this->withSpanContext(
SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_SAMPLED, new TraceState('vendor1=opaqueValue1')),
SpanContext::create(self::TRACE_ID, self::SPAN_ID, TraceFlags::SAMPLED, new TraceState('vendor1=opaqueValue1')),
Context::getCurrent()
)
);
Expand All @@ -111,7 +112,7 @@ public function InjectTraceIdWithInvalidSpanContext()
$carrier,
null,
$this->withSpanContext(
SpanContext::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, SpanContextInterface::TRACE_FLAG_SAMPLED, new TraceState('vendor1=opaqueValue1')),
SpanContext::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, TraceFlags::SAMPLED, new TraceState('vendor1=opaqueValue1')),
Context::getCurrent()
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function test_send_async_requests(): void
$this->client->sendAsyncRequest($request);
$this->client->sendAsyncRequest($request);
$this->assertCount(0, $this->storage, 'no spans exporter since promises are not resolved yet');

//resolve promises
try {
$p2->wait();
Expand Down
1 change: 1 addition & 0 deletions src/Instrumentation/Laravel/src/HeadersPropagator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static function instance(): self
public function keys($carrier): array
{
assert($carrier instanceof Request);

/** @psalm-suppress InvalidReturnStatement */
return $carrier->headers->keys();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Instrumentation/MongoDB/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"ext-mongodb": "*",
"ext-json": "*",
"mongodb/mongodb": "^1.15",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/api": "^1.0.0beta12",
"open-telemetry/sem-conv": "^1"
},
"require-dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace OpenTelemetry\Contrib\Instrumentation\MongoDB;

use function MongoDB\Driver\Monitoring\addSubscriber;
use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;

final class MongoDBInstrumentation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use MongoDB\Driver\Monitoring\CommandStartedEvent;
use MongoDB\Driver\Monitoring\CommandSubscriber;
use MongoDB\Driver\Monitoring\CommandSucceededEvent;
use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Instrumentation\CachedInstrumentation;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\SpanBuilderInterface;
use OpenTelemetry\API\Trace\SpanKind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static function instance(): self
public function keys($carrier): array
{
assert($carrier instanceof Request);

/** @psalm-suppress InvalidReturnStatement */
return $carrier->headers->keys();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static function instance(): self
public function keys($carrier): array
{
assert($carrier instanceof Response);

/** @psalm-suppress InvalidReturnStatement */
return $carrier->headers->keys();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Logs/Monolog/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prefer-stable": true,
"require": {
"monolog/monolog": "^1.1|^2|^3",
"open-telemetry/api": "^1.0.0beta10"
"open-telemetry/api": "^1.0.0beta16"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/Logs/Monolog/tests/Integration/HandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeFactory;
use OpenTelemetry\SDK\Logs\Exporter\InMemoryExporter;
use OpenTelemetry\SDK\Logs\LoggerProvider;
use OpenTelemetry\SDK\Logs\Processor\SimpleLogsProcessor;
use OpenTelemetry\SDK\Logs\Processor\SimpleLogRecordProcessor;
use OpenTelemetry\SDK\Logs\ReadWriteLogRecord;
use PHPUnit\Framework\TestCase;

Expand All @@ -29,7 +29,7 @@ public function setUp(): void
$this->storage = new ArrayObject();
$exporter = new InMemoryExporter($this->storage);
$loggerProvider = new LoggerProvider(
new SimpleLogsProcessor($exporter),
new SimpleLogRecordProcessor($exporter),
new InstrumentationScopeFactory(Attributes::factory()),
);
$handler = new Handler($loggerProvider, 200);
Expand Down
9 changes: 5 additions & 4 deletions src/Propagation/TraceResponse/tests/Unit/PropagatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use OpenTelemetry\API\Trace\SpanContext;
use OpenTelemetry\API\Trace\SpanContextInterface;
use OpenTelemetry\API\Trace\SpanContextValidator;
use OpenTelemetry\API\Trace\TraceFlags;
use OpenTelemetry\API\Trace\TraceState;
use OpenTelemetry\Context\Context;
use OpenTelemetry\Context\ContextInterface;
Expand Down Expand Up @@ -43,7 +44,7 @@ public function test_inject_valid_sampled_trace_id()
$carrier,
null,
$this->withSpanContext(
SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_SAMPLED),
SpanContext::create(self::TRACE_ID, self::SPAN_ID, TraceFlags::SAMPLED),
Context::getCurrent()
)
);
Expand All @@ -65,7 +66,7 @@ public function test_inject_valid_not_sampled_trace_id()
$carrier,
null,
$this->withSpanContext(
SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_DEFAULT),
SpanContext::create(self::TRACE_ID, self::SPAN_ID),
Context::getCurrent()
)
);
Expand All @@ -87,7 +88,7 @@ public function test_inject_trace_id_with_trace_state()
$carrier,
null,
$this->withSpanContext(
SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_SAMPLED, new TraceState('vendor1=opaqueValue1')),
SpanContext::create(self::TRACE_ID, self::SPAN_ID, TraceFlags::SAMPLED, new TraceState('vendor1=opaqueValue1')),
Context::getCurrent()
)
);
Expand All @@ -109,7 +110,7 @@ public function test_inject_trace_id_with_invalid_span_context()
$carrier,
null,
$this->withSpanContext(
SpanContext::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, SpanContextInterface::TRACE_FLAG_SAMPLED, new TraceState('vendor1=opaqueValue1')),
SpanContext::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, TraceFlags::SAMPLED, new TraceState('vendor1=opaqueValue1')),
Context::getCurrent()
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
"open-telemetry/api": "^1.0.0beta10",
"open-telemetry/api": "^1.0.0beta12",
"open-telemetry/context": "^1",
"open-telemetry/exporter-otlp": "^1",
"open-telemetry/exporter-zipkin": "^1",
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/src/OtelBundle/Console/ConsoleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace OpenTelemetry\Contrib\Symfony\OtelBundle\Console;

use function get_class;
use OpenTelemetry\API\Trace\AbstractSpan as Span;
use OpenTelemetry\API\Trace\Span;
use OpenTelemetry\API\Trace\StatusCode;
use OpenTelemetry\API\Trace\TracerInterface;
use OpenTelemetry\API\Trace\TracerProviderInterface;
Expand Down
Loading