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

Add tracing span macro calls to the language server for better debugging #6238

Merged
merged 8 commits into from
Jul 15, 2024

Conversation

JoshuaBatty
Copy link
Member

@JoshuaBatty JoshuaBatty commented Jul 8, 2024

Description

closes #6220

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@JoshuaBatty JoshuaBatty requested a review from a team as a code owner July 8, 2024 05:02
@JoshuaBatty JoshuaBatty self-assigned this Jul 8, 2024
@JoshuaBatty JoshuaBatty added the language server LSP server label Jul 8, 2024
@JoshuaBatty JoshuaBatty marked this pull request as draft July 8, 2024 05:02
Copy link

github-actions bot commented Jul 8, 2024

Benchmark for a2ed695

Click to view benchmark
Test Base PR %
code_action 5.0±0.02ms 5.0±0.09ms 0.00%
code_lens 291.6±11.09ns 359.2±3.52ns +23.18%
compile 2.5±0.05s 2.6±0.02s +4.00%
completion 4.5±0.06ms 4.5±0.09ms 0.00%
did_change_with_caching 2.5±0.03s 2.5±0.04s 0.00%
document_symbol 882.5±27.28µs 848.3±20.03µs -3.88%
format 71.6±0.85ms 71.8±0.66ms +0.28%
goto_definition 333.3±6.40µs 339.5±6.88µs +1.86%
highlight 8.7±0.16ms 8.7±0.11ms 0.00%
hover 491.2±10.39µs 489.5±5.98µs -0.35%
idents_at_position 117.6±0.44µs 117.1±0.44µs -0.43%
inlay_hints 615.2±11.59µs 629.7±24.53µs +2.36%
on_enter 448.6±27.49ns 478.1±16.52ns +6.58%
parent_decl_at_position 3.6±0.29ms 3.6±0.04ms 0.00%
prepare_rename 331.4±4.55µs 337.3±3.94µs +1.78%
rename 9.0±0.45ms 8.9±0.12ms -1.11%
semantic_tokens 1254.3±12.44µs 1252.1±15.73µs -0.18%
token_at_position 338.8±3.81µs 338.8±1.21µs 0.00%
tokens_at_position 3.5±0.02ms 3.6±0.03ms +2.86%
tokens_for_file 395.1±5.13µs 402.1±2.78µs +1.77%
traverse 37.9±0.96ms 38.5±0.57ms +1.58%

@JoshuaBatty JoshuaBatty force-pushed the josh/lsp_tracing_spans branch from 8544b08 to 9215b58 Compare July 9, 2024 01:18
Copy link

github-actions bot commented Jul 9, 2024

Benchmark for 77cb7d5

Click to view benchmark
Test Base PR %
code_action 5.0±0.08ms 5.3±0.16ms +6.00%
code_lens 286.8±7.72ns 352.8±9.67ns +23.01%
compile 2.5±0.03s 2.7±0.03s +8.00%
completion 4.7±0.11ms 4.8±0.16ms +2.13%
did_change_with_caching 2.5±0.02s 2.6±0.03s +4.00%
document_symbol 860.0±19.37µs 930.7±33.61µs +8.22%
format 71.2±0.72ms 71.7±0.68ms +0.70%
goto_definition 333.4±7.45µs 343.0±21.95µs +2.88%
highlight 8.7±0.09ms 8.8±0.15ms +1.15%
hover 493.1±7.45µs 494.0±6.85µs +0.18%
idents_at_position 117.6±0.54µs 117.2±0.65µs -0.34%
inlay_hints 619.5±28.86µs 626.8±19.49µs +1.18%
on_enter 471.6±15.69ns 477.2±14.23ns +1.19%
parent_decl_at_position 3.6±0.06ms 3.6±0.25ms 0.00%
prepare_rename 331.5±6.77µs 344.0±8.12µs +3.77%
rename 9.0±0.16ms 9.4±0.12ms +4.44%
semantic_tokens 1274.4±17.32µs 1253.8±13.04µs -1.62%
token_at_position 341.5±1.86µs 335.4±4.89µs -1.79%
tokens_at_position 3.7±0.33ms 3.6±0.04ms -2.70%
tokens_for_file 402.8±2.80µs 404.0±3.23µs +0.30%
traverse 37.1±0.98ms 39.2±1.10ms +5.66%

@JoshuaBatty JoshuaBatty force-pushed the josh/lsp_tracing_spans branch from ef28f0d to 4461ad3 Compare July 9, 2024 02:20
Copy link

github-actions bot commented Jul 9, 2024

Benchmark for 0ab0fc9

Click to view benchmark
Test Base PR %
code_action 5.0±0.01ms 5.1±0.07ms +2.00%
code_lens 284.1±8.99ns 289.7±9.83ns +1.97%
compile 2.6±0.05s 2.6±0.03s 0.00%
completion 4.6±0.16ms 4.6±0.02ms 0.00%
did_change_with_caching 2.5±0.02s 2.5±0.02s 0.00%
document_symbol 876.4±25.26µs 927.9±46.01µs +5.88%
format 71.3±1.10ms 70.9±0.94ms -0.56%
goto_definition 345.8±18.44µs 356.1±6.58µs +2.98%
highlight 8.7±0.16ms 8.8±0.17ms +1.15%
hover 499.9±6.95µs 510.5±8.42µs +2.12%
idents_at_position 117.7±0.49µs 121.4±1.10µs +3.14%
inlay_hints 623.5±30.75µs 635.6±20.63µs +1.94%
on_enter 472.0±13.29ns 460.4±13.77ns -2.46%
parent_decl_at_position 3.6±0.02ms 3.6±0.02ms 0.00%
prepare_rename 337.7±6.59µs 355.6±5.57µs +5.30%
rename 9.0±0.17ms 9.0±0.16ms 0.00%
semantic_tokens 1269.0±7.99µs 1250.1±12.52µs -1.49%
token_at_position 333.9±2.34µs 337.3±3.42µs +1.02%
tokens_at_position 3.6±0.03ms 3.6±0.02ms 0.00%
tokens_for_file 398.3±3.23µs 398.6±2.52µs +0.08%
traverse 37.4±0.40ms 37.3±0.76ms -0.27%

@JoshuaBatty JoshuaBatty marked this pull request as ready for review July 9, 2024 02:56
@JoshuaBatty JoshuaBatty requested a review from a team July 9, 2024 02:56
Copy link
Member

@kayagokalp kayagokalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we seem to be trying to catch function spans. I think #[instrument] will already do that and might be cleaner if you prefer it: https://docs.rs/tracing/latest/tracing/attr.instrument.html, otherwise happy to approve

@JoshuaBatty
Copy link
Member Author

Generally we seem to be trying to catch function spans. I think #[instrument] will already do that and might be cleaner if you prefer it: https://docs.rs/tracing/latest/tracing/attr.instrument.html, otherwise happy to approve

Yeah nice, can see how this would be handy in certain situations. I'll probably prefer to stick with this current approach for now though. Thanks for sharing though!

Copy link

Benchmark for 206b2ad

Click to view benchmark
Test Base PR %
code_action 5.2±0.07ms 5.3±0.07ms +1.92%
code_lens 280.0±9.40ns 310.3±4.29ns +10.82%
compile 2.6±0.03s 2.6±0.04s 0.00%
completion 4.7±0.01ms 4.6±0.04ms -2.13%
did_change_with_caching 2.5±0.02s 2.6±0.04s +4.00%
document_symbol 869.7±24.46µs 896.9±10.84µs +3.13%
format 71.0±0.56ms 70.9±1.16ms -0.14%
goto_definition 336.6±6.15µs 340.1±6.94µs +1.04%
highlight 9.0±0.08ms 9.0±0.04ms 0.00%
hover 493.5±15.88µs 494.1±6.63µs +0.12%
idents_at_position 119.2±0.64µs 117.9±0.50µs -1.09%
inlay_hints 631.1±18.72µs 636.6±20.30µs +0.87%
on_enter 479.6±12.76ns 464.3±39.52ns -3.19%
parent_decl_at_position 3.7±0.05ms 3.7±0.03ms 0.00%
prepare_rename 333.9±8.79µs 340.1±7.47µs +1.86%
rename 9.6±0.42ms 9.3±0.02ms -3.12%
semantic_tokens 1251.1±14.07µs 1266.5±31.87µs +1.23%
token_at_position 332.4±2.19µs 339.8±2.16µs +2.23%
tokens_at_position 3.7±0.03ms 3.7±0.01ms 0.00%
tokens_for_file 397.8±2.18µs 446.7±11.44µs +12.29%
traverse 36.0±0.80ms 37.3±1.01ms +3.61%

@JoshuaBatty JoshuaBatty enabled auto-merge (squash) July 10, 2024 06:40
Copy link

Benchmark for 5bbf20a

Click to view benchmark
Test Base PR %
code_action 5.5±0.15ms 5.2±0.02ms -5.45%
code_lens 288.2±5.33ns 353.4±9.89ns +22.62%
compile 2.6±0.03s 2.6±0.06s 0.00%
completion 4.7±0.05ms 4.7±0.07ms 0.00%
did_change_with_caching 2.6±0.03s 2.6±0.03s 0.00%
document_symbol 868.6±11.40µs 903.1±38.26µs +3.97%
format 72.0±0.80ms 70.7±0.90ms -1.81%
goto_definition 346.7±8.81µs 335.6±6.22µs -3.20%
highlight 9.0±0.11ms 9.0±0.09ms 0.00%
hover 493.9±4.57µs 488.9±6.04µs -1.01%
idents_at_position 117.8±0.39µs 118.6±0.44µs +0.68%
inlay_hints 637.8±22.80µs 633.9±12.25µs -0.61%
on_enter 464.2±14.91ns 492.7±69.63ns +6.14%
parent_decl_at_position 3.7±0.08ms 3.7±0.03ms 0.00%
prepare_rename 344.1±17.55µs 335.2±5.89µs -2.59%
rename 9.7±0.27ms 9.3±0.14ms -4.12%
semantic_tokens 1253.9±53.58µs 1264.4±6.91µs +0.84%
token_at_position 327.6±1.32µs 336.2±2.37µs +2.63%
tokens_at_position 3.7±0.03ms 3.7±0.02ms 0.00%
tokens_for_file 399.7±10.90µs 399.7±5.84µs 0.00%
traverse 38.2±0.58ms 37.8±0.97ms -1.05%

Copy link

Benchmark for e828064

Click to view benchmark
Test Base PR %
code_action 5.2±0.34ms 5.2±0.08ms 0.00%
code_lens 292.4±8.64ns 335.3±10.16ns +14.67%
compile 2.7±0.03s 2.7±0.04s 0.00%
completion 4.7±0.06ms 4.7±0.02ms 0.00%
did_change_with_caching 2.6±0.02s 2.6±0.05s 0.00%
document_symbol 873.3±26.87µs 947.7±12.84µs +8.52%
format 72.5±1.78ms 71.4±0.71ms -1.52%
goto_definition 486.3±1.86µs 349.4±5.99µs -28.15%
highlight 9.1±0.17ms 9.0±0.02ms -1.10%
hover 498.8±12.36µs 525.4±6.24µs +5.33%
idents_at_position 119.4±0.33µs 120.9±0.49µs +1.26%
inlay_hints 658.3±23.70µs 643.5±26.28µs -2.25%
on_enter 469.2±12.73ns 456.6±16.76ns -2.69%
parent_decl_at_position 3.7±0.04ms 3.7±0.04ms 0.00%
prepare_rename 360.2±6.12µs 350.8±7.92µs -2.61%
rename 9.3±0.08ms 9.3±0.17ms 0.00%
semantic_tokens 1280.9±15.10µs 1202.0±10.29µs -6.16%
token_at_position 339.0±2.80µs 342.1±4.09µs +0.91%
tokens_at_position 3.7±0.03ms 3.7±0.04ms 0.00%
tokens_for_file 399.6±4.45µs 401.1±5.70µs +0.38%
traverse 37.8±1.15ms 38.7±0.96ms +2.38%

@JoshuaBatty JoshuaBatty merged commit 4adae25 into master Jul 15, 2024
39 checks passed
@JoshuaBatty JoshuaBatty deleted the josh/lsp_tracing_spans branch July 15, 2024 15:25
esdrubal pushed a commit that referenced this pull request Aug 13, 2024
…ing (#6238)

## Description
closes #6220

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tracing span macro calls to the language server for better debugging.
3 participants