context = new \Sentry\Tracing\TransactionContext(); $this->context->setName( $name?$name: (php_sapi_name()=='cli'?'CLI execution':'HTTP request') ); $this->context->setOp( $op?$op: (php_sapi_name()=='cli'?'cli.command':'http.request') ); // Start the transaction $this->transaction = \Sentry\startTransaction($this->context); // Set the current transaction as the current span so we can retrieve it later \Sentry\SentrySdk::getCurrentHub()->setSpan($this->transaction); } /** * Destructor: Stop the current Sentry transaction * @return void */ public function __destruct() { SentrySpan :: finishAll(); $this->transaction->finish(); } } # vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab