Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No designated place for traceback in message item #471

Open
ArturMoczulski opened this issue Sep 28, 2019 · 6 comments
Open

No designated place for traceback in message item #471

ArturMoczulski opened this issue Sep 28, 2019 · 6 comments
Assignees
Labels
Status: 3 - Construction The request is being worked on.
Milestone

Comments

@ArturMoczulski
Copy link
Contributor

Steps to reproduce:

  • set send_message_trace to true,
  • report a message item Rollbar::log(Level::INFO, 'Message from app');

Expected result
The trace back should be visible in the Rollbar item details page just as when reporting an exception.

Result
The trace back is not visible in the Rollbar item details page. It's under body.message.backtrace in unformatted and hard to read in occurrence details.

Impact across SDKs
This is a problem that will appear across other SDKs as well as currently we just don't support backtrace for message items. Support for that needs to be implemented.

@ArturMoczulski ArturMoczulski self-assigned this Sep 28, 2019
@brianr
Copy link
Member

brianr commented Sep 30, 2019

@ArturMoczulski FWIW: at the API level, the current idea for these is that "message" items that contain tracebacks would be reported as tracebacks containing an explicit message. In those the message goes in trace.exception.description.

@zanderwar
Copy link

+1 Please, this would be really great and I personally need it to go alongside SQL errors that I catch, and can only get the backtrace to appear in occurrences as @ArturMoczulski mentions

@zanderwar
Copy link

zanderwar commented Apr 8, 2020

This is good enough for me atm

function reportSqlError($sql, $error)
{
	$message = "SQL ERROR: {$error}\n\n";

	// maintain the layout, but reduce any excessive tabs or spaces
	$message .= preg_replace('/\t\s?/m', '', trim($sql)) . "\n\n";

	// build backtrace
	$e = new Exception();
	$trace = explode("\n", $e->getTraceAsString());

	// reverse array to make steps line up chronologically
	$trace = array_reverse($trace);

	// remove {main}
	array_shift($trace);

	// remove call to this method
	array_pop($trace);

	// renumber items
	$length = count($trace);
	$result = array();

	for ($i = 0; $i < $length; $i++)
	{
		$result[] = ($i + 1)  . ')' . substr($trace[$i], strpos($trace[$i], ' ')); // replace '#someNum' with '$i)', set the right ordering
	}

	$message .= implode("\n", $result);

	\Rollbar\Rollbar::log(\Rollbar\Payload\Level::CRITICAL, $message);
}

image

@troygilbert
Copy link

Glad I'm not the only one suffering this issue, but so sad to see it's been like this for 4+ years!? I don't understand why the backtrace can't be used identically to what happens when there's an exception thrown? Is there any movement on this from the Rollbar PHP maintainers?

@danielmorell
Copy link
Collaborator

Let me see if I can get this in either v4.1 or v4.2. For now, I will aim at v4.1.

@danielmorell danielmorell added this to the v4.1.0 milestone Sep 15, 2023
@troygilbert
Copy link

Any movement on this?

As a stopgap, are there any tools that can prettify the data contained in the backtrace field? I thought it was PHP serialized, but I'm unable to deserialize it, so I must be missing something.

@danielmorell danielmorell modified the milestones: v4.1.0, v4.2.0 Mar 1, 2024
@danielmorell danielmorell added the Status: 3 - Construction The request is being worked on. label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: 3 - Construction The request is being worked on.
Projects
None yet
Development

No branches or pull requests

5 participants