| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace WCPOS\Vendor\Sentry\State; |
| 5 |
|
| 6 |
use WCPOS\Vendor\Sentry\Breadcrumb; |
| 7 |
use WCPOS\Vendor\Sentry\CheckInStatus; |
| 8 |
use WCPOS\Vendor\Sentry\ClientInterface; |
| 9 |
use WCPOS\Vendor\Sentry\Event; |
| 10 |
use WCPOS\Vendor\Sentry\EventHint; |
| 11 |
use WCPOS\Vendor\Sentry\EventId; |
| 12 |
use WCPOS\Vendor\Sentry\Integration\IntegrationInterface; |
| 13 |
use WCPOS\Vendor\Sentry\MonitorConfig; |
| 14 |
use WCPOS\Vendor\Sentry\Severity; |
| 15 |
use WCPOS\Vendor\Sentry\Tracing\Span; |
| 16 |
use WCPOS\Vendor\Sentry\Tracing\Transaction; |
| 17 |
use WCPOS\Vendor\Sentry\Tracing\TransactionContext; |
| 18 |
interface HubInterface |
| 19 |
{ |
| 20 |
/** |
| 21 |
* Gets the client bound to the top of the stack. |
| 22 |
*/ |
| 23 |
public function getClient() : ?ClientInterface; |
| 24 |
/** |
| 25 |
* Gets the ID of the last captured event. |
| 26 |
*/ |
| 27 |
public function getLastEventId() : ?EventId; |
| 28 |
/** |
| 29 |
* Creates a new scope to store context information that will be layered on |
| 30 |
* top of the current one. It is isolated, i.e. all breadcrumbs and context |
| 31 |
* information added to this scope will be removed once the scope ends. Be |
| 32 |
* sure to always remove this scope with {@see Hub::popScope} when the |
| 33 |
* operation finishes or throws. |
| 34 |
*/ |
| 35 |
public function pushScope() : Scope; |
| 36 |
/** |
| 37 |
* Removes a previously pushed scope from the stack. This restores the state |
| 38 |
* before the scope was pushed. All breadcrumbs and context information added |
| 39 |
* since the last call to {@see Hub::pushScope} are discarded. |
| 40 |
*/ |
| 41 |
public function popScope() : bool; |
| 42 |
/** |
| 43 |
* Creates a new scope with and executes the given operation within. The scope |
| 44 |
* is automatically removed once the operation finishes or throws. |
| 45 |
* |
| 46 |
* @param callable $callback The callback to be executed |
| 47 |
* |
| 48 |
* @phpstan-template T |
| 49 |
* |
| 50 |
* @phpstan-param callable(Scope): T $callback |
| 51 |
* |
| 52 |
* @return mixed|void The callback's return value, upon successful execution |
| 53 |
* |
| 54 |
* @phpstan-return T |
| 55 |
*/ |
| 56 |
public function withScope(callable $callback); |
| 57 |
/** |
| 58 |
* Calls the given callback passing to it the current scope so that any |
| 59 |
* operation can be run within its context. |
| 60 |
*/ |
| 61 |
public function configureScope(callable $callback) : void; |
| 62 |
/** |
| 63 |
* Binds the given client to the current scope. |
| 64 |
*/ |
| 65 |
public function bindClient(ClientInterface $client) : void; |
| 66 |
/** |
| 67 |
* Captures a message event and sends it to Sentry. |
| 68 |
*/ |
| 69 |
public function captureMessage(string $message, ?Severity $level = null, ?EventHint $hint = null) : ?EventId; |
| 70 |
/** |
| 71 |
* Captures an exception event and sends it to Sentry. |
| 72 |
*/ |
| 73 |
public function captureException(\Throwable $exception, ?EventHint $hint = null) : ?EventId; |
| 74 |
/** |
| 75 |
* Captures a new event using the provided data. |
| 76 |
*/ |
| 77 |
public function captureEvent(Event $event, ?EventHint $hint = null) : ?EventId; |
| 78 |
/** |
| 79 |
* Captures an event that logs the last occurred error. |
| 80 |
*/ |
| 81 |
public function captureLastError(?EventHint $hint = null) : ?EventId; |
| 82 |
/** |
| 83 |
* Records a new breadcrumb which will be attached to future events. They |
| 84 |
* will be added to subsequent events to provide more context on user's |
| 85 |
* actions prior to an error or crash. |
| 86 |
*/ |
| 87 |
public function addBreadcrumb(Breadcrumb $breadcrumb) : bool; |
| 88 |
/** |
| 89 |
* Captures a check-in. |
| 90 |
* |
| 91 |
* @param int|float|null $duration |
| 92 |
*/ |
| 93 |
public function captureCheckIn(string $slug, CheckInStatus $status, $duration = null, ?MonitorConfig $monitorConfig = null, ?string $checkInId = null) : ?string; |
| 94 |
/** |
| 95 |
* Gets the integration whose FQCN matches the given one if it's available on the current client. |
| 96 |
* |
| 97 |
* @param string $className The FQCN of the integration |
| 98 |
* |
| 99 |
* @phpstan-template T of IntegrationInterface |
| 100 |
* |
| 101 |
* @phpstan-param class-string<T> $className |
| 102 |
* |
| 103 |
* @phpstan-return T|null |
| 104 |
*/ |
| 105 |
public function getIntegration(string $className) : ?IntegrationInterface; |
| 106 |
/** |
| 107 |
* Starts a new `Transaction` and returns it. This is the entry point to manual |
| 108 |
* tracing instrumentation. |
| 109 |
* |
| 110 |
* A tree structure can be built by adding child spans to the transaction, and |
| 111 |
* child spans to other spans. To start a new child span within the transaction |
| 112 |
* or any span, call the respective `startChild()` method. |
| 113 |
* |
| 114 |
* Every child span must be finished before the transaction is finished, |
| 115 |
* otherwise the unfinished spans are discarded. |
| 116 |
* |
| 117 |
* The transaction must be finished with a call to its `finish()` method, at |
| 118 |
* which point the transaction with all its finished child spans will be sent to |
| 119 |
* Sentry. |
| 120 |
* |
| 121 |
* @param array<string, mixed> $customSamplingContext Additional context that will be passed to the {@see SamplingContext} |
| 122 |
*/ |
| 123 |
public function startTransaction(TransactionContext $context, array $customSamplingContext = []) : Transaction; |
| 124 |
/** |
| 125 |
* Returns the transaction that is on the Hub. |
| 126 |
*/ |
| 127 |
public function getTransaction() : ?Transaction; |
| 128 |
/** |
| 129 |
* Returns the span that is on the Hub. |
| 130 |
*/ |
| 131 |
public function getSpan() : ?Span; |
| 132 |
/** |
| 133 |
* Sets the span on the Hub. |
| 134 |
*/ |
| 135 |
public function setSpan(?Span $span) : HubInterface; |
| 136 |
} |
| 137 |
|