-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for tracing scheduled handlers (#390)
* Add support for tracing scheduled handlers * fixes
- Loading branch information
Showing
6 changed files
with
175 additions
and
3 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
28 changes: 28 additions & 0 deletions
28
packages/OpenTelemetry/tests/Fixture/ScheduledHandler/ScheduledHandler.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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Test\Ecotone\OpenTelemetry\Fixture\ScheduledHandler; | ||
|
||
use Ecotone\Messaging\Attribute\Poller; | ||
use Ecotone\Messaging\Attribute\Scheduled; | ||
|
||
/** | ||
* licence Apache-2.0 | ||
*/ | ||
final class ScheduledHandler | ||
{ | ||
private int $counter = 0; | ||
|
||
#[Scheduled(endpointId: 'scheduled_handler')] | ||
#[Poller(fixedRateInMilliseconds: 1)] | ||
public function handle(): void | ||
{ | ||
$this->counter += 1; | ||
} | ||
|
||
public function getCounter(): int | ||
{ | ||
return $this->counter; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
packages/OpenTelemetry/tests/Fixture/ScheduledHandler/WorkflowScheduledHandler.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,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Test\Ecotone\OpenTelemetry\Fixture\ScheduledHandler; | ||
|
||
use Ecotone\Messaging\Attribute\InternalHandler; | ||
use Ecotone\Messaging\Attribute\Poller; | ||
use Ecotone\Messaging\Attribute\Scheduled; | ||
|
||
/** | ||
* licence Apache-2.0 | ||
*/ | ||
final class WorkflowScheduledHandler | ||
{ | ||
private int $counter = 0; | ||
|
||
#[Scheduled(requestChannelName: 'add', endpointId: 'scheduled_handler')] | ||
#[Poller(fixedRateInMilliseconds: 1)] | ||
public function produce(): int | ||
{ | ||
return 1; | ||
} | ||
|
||
#[Scheduled(requestChannelName: 'add', endpointId: 'scheduled_handler_without_result')] | ||
#[Poller(fixedRateInMilliseconds: 1)] | ||
public function produceNothing(): ?int | ||
{ | ||
return null; | ||
} | ||
|
||
#[InternalHandler(inputChannelName: 'add')] | ||
public function add(): void | ||
{ | ||
$this->counter += 1; | ||
} | ||
|
||
public function getCounter(): int | ||
{ | ||
return $this->counter; | ||
} | ||
} |
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