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

Improve StackTraceFormatter #697

Merged
merged 2 commits into from
Jun 6, 2022
Merged

Conversation

Nevay
Copy link
Contributor

@Nevay Nevay commented Jun 3, 2022

Resolves some issues with the stacktrace formatter.

  • Fix "... n more" to fold only identical frames, currently we might lose information due to folding on first seen frame instead of folding last n identical frames as described by Java ("These lines indicate that the remainder of the stack trace for this exception matches the indicated number of frames from the bottom of the stack trace of the exception that was caused by this exception (the "enclosing" exception).")
  • Fix exception class names not being converted to dotted format
  • Fix functions being shown as main
  • Fix out-of-memory on circular exception

Example output to highlight some of the differences:

# new
Abc.Def.Test: bar
	at Abc.Def.Test.create(Test.php:10)
	at Abc.Def.run(example.php:8)
	at {main}(example.php:12)
Caused by: Abc.Def.Test: foo
	at Abc.Def.Test.create(Test.php:10)
	at Abc.Def.run(example.php:7)
	... 1 more
# old
Abc\Def\Test: bar
 at Abc.Def.Test.create(Test.php:10)
 at main(example.php:8)
 at main(example.php:12)
Caused by: Abc\Def\Test: foo
 ... 3 more

Additionally this changes the output format:

  • indent is now 1 tab instead of 1 space
  • empty messages are no longer displayed (no : ) - what is the desired behavior? Java prints nothing for null and : for empty.
  • main is now displayed as {main} instead of main to avoid confusion with a function named main (curly brackets for consistency with {closure})

Currently it's not possible to run the tests with PHPUnit (<directory suffix=".phpt">./tests/Unit</directory>) due to PHPUnit loading the scripts using require, which changes the stacktrace. run-tests.php can be used instead (not executed automatically for now in hopes that this will be resolved).

Nevay added 2 commits June 3, 2022 16:39
- fixes "... n more" to fold only identical frames
- fixes exception class names not being converted to dotted format
- fixes functions being shown as `main`
- fixes out-of-memory on circular exception
@codecov
Copy link

codecov bot commented Jun 3, 2022

Codecov Report

Merging #697 (a245180) into main (e728c53) will decrease coverage by 0.78%.
The diff coverage is 1.51%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #697      +/-   ##
============================================
- Coverage     83.82%   83.04%   -0.79%     
- Complexity     1233     1234       +1     
============================================
  Files           138      138              
  Lines          2980     3008      +28     
============================================
  Hits           2498     2498              
- Misses          482      510      +28     
Flag Coverage Δ
7.4 83.03% <1.51%> (-0.79%) ⬇️
8.0 83.09% <1.51%> (-0.79%) ⬇️
8.1 83.09% <1.51%> (-0.79%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/SDK/Common/Exception/StackTraceFormatter.php 0.00% <0.00%> (ø)
src/SDK/Trace/Span.php 93.69% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e728c53...a245180. Read the comment docs.

@brettmc brettmc merged commit 7dda601 into open-telemetry:main Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants