public function beginCurrentSpan()

in elastic_apm/elastic_apm.php [268:345]


    public function beginCurrentSpan(
        string $name,
        string $type,
        ?string $subtype = null,
        ?string $action = null,
        ?float $timestamp = null
    ): SpanInterface;

    /**
     * Begins a new span with the current execution segment as the new span's parent and
     * sets the new span as the current span for this transaction.
     * The current execution segment is the current span if there is one or this transaction itself otherwise.
     *
     * @param string      $name      New span's name
     * @param string      $type      New span's type
     * @param \Closure     $callback  Callback to execute as the new span
     * @param string|null $subtype   New span's subtype
     * @param string|null $action    New span's action
     * @param float|null  $timestamp Start time of the new span
     *
     * @see             SpanInterface::setName() For the description.
     * @see             SpanInterface::setType() For the description.
     * @see             SpanInterface::setSubtype() For the description.
     * @see             SpanInterface::setAction() For the description.
     * @see             SpanInterface::getTimestamp() For the description.
     *
     * @return mixed The return value of $callback
     */
    public function captureCurrentSpan(
        string $name,
        string $type,
        \Closure $callback,
        ?string $subtype = null,
        ?string $action = null,
        ?float $timestamp = null
    );

    /**
     * Returns the current span.
     *
     * @return SpanInterface The current span
     */
    public function getCurrentSpan(): SpanInterface;

    /**
     * Returns context (context allows to set labels, etc.)
     */
    public function context(): TransactionContextInterface;

    /**
     * The result of the transaction.
     * For HTTP-related transactions, this should be the status code formatted like 'HTTP 2xx'.
     *
     * @link https://github.com/elastic/apm-server/blob/7.0/docs/spec/transactions/transaction.json#L52
     *
     * @param string|null $result
     *
     * @return void
     */
    public function setResult(?string $result): void;

    /**
     * @see setResult() For the description
     */
    public function getResult(): ?string;

    /**
     * If the transaction does not have a parent ID yet,
     * calling this method generates a new ID,
     * sets it as the parent ID of this transaction, and returns it as a string.
     *
     * @return string
     */
    public function ensureParentId(): string;
}

interface SpanInterface extends ExecutionSegmentInterface
{