Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Elastic Apm Php Agent Laravel Package

nipwaayoni/elastic-apm-php-agent

Laravel-friendly Elastic APM PHP agent for instrumenting apps and sending performance data, errors, and transactions to an Elastic APM Server. Helps monitor response times, slow queries, and exceptions with simple setup and configurable reporting.

View on GitHub
Deep Wiki
Context7

Converting debug_backtrace to a stack trace

There is a function on a span to set a stack trace but it uses a different format from PHP's debug_backtrace().

In order to convert between the two you can use the setDebugBacktrace function. It will convert details in the background and set the stack trace for you.

A simple example would be:

$spanSt->setDebugBacktrace();

Example Code

use Nipwaayoni\Helper\StackTrace;

// create the agent
$agent = (new \Nipwaayoni\AgentBuilder())
    ->withConfig(new Nipwaayoni\Config(['serviceName' => 'examples']))
    ->build();

// Span
// start a new transaction
$parent = $agent->startTransaction('POST /auth/examples/spans');

// burn some time
usleep(rand(10, 25));

// Create Span
$spanParent = $agent->factory()->newSpan('Authenication Workflow', $parent);
// $parent->incSpanCount();
$spanParent->start();

// Create another Span that is a parent span
$spanSt = $agent->factory()->newSpan('Span with stacktrace', $spanParent);
// $parent->incSpanCount();
$spanSt->start();

// burn some fictive time ..
usleep(rand(250, 350));
$spanSt->setDebugBacktrace();

$spanSt->stop();
$agent->putEvent($spanSt);

$spanParent->stop();

// Do some stuff you want to watch ...
usleep(rand(100, 250));

$agent->putEvent($spanParent);

$agent->stopTransaction($parent->getTransactionName());

// Force manual flush if needed
// $agent->send();
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle