namespace App\Services;
use Eerzho\Instrumentation\Class\Attribute\Traceable;
#[Traceable]
class OrderService
{
public function create(array $items): void
{
// span "App\Services\OrderService::create" is created automatically
}
public function cancel(int $orderId): void
{
// span "App\Services\OrderService::cancel" is created automatically
}
}
namespace App\Services;
use Eerzho\Instrumentation\Class\Attribute\Traceable;
#[Traceable(exclude: ['healthCheck', 'getVersion'])]
class PaymentService
{
public function charge(int $amount, string $currency): void
{
// traced
}
public function healthCheck(): bool
{
// NOT traced
return true;
}
public function getVersion(): string
{
// NOT traced
return '1.0.0';
}
}
namespace App\Services;
use Eerzho\Instrumentation\Class\Attribute\Arguments;
use Eerzho\Instrumentation\Class\Attribute\Traceable;
#[Traceable]
class AuthService
{
#[Arguments(exclude: ['password', 'token'])]
public function login(string $email, string $password, string $token): void
{
// span captures "email" attribute only
// "password" and "token" are excluded
}
public function logout(int $userId): void
{
// span captures "userId" attribute (no exclusions)
}
}