Commit Graph

344 Commits

Author SHA1 Message Date
Keerti Parthasarathy 1f864a4633 [perf tesing]Add an option to write out a log with performance related data
This is mainly to exercise the performance test framework, for writing
a report for the test runs.

- adds a flag to specify a file
- logs context information and info from the message scheduler

Started with just these two as an example as I was not sure what performance data we do want to record.

Change-Id: I3e5ff4b77c62d36e47ba7bac8f656b19ba19c457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-12-18 07:35:49 -08:00
Konstantin Shcheglov 09804d2bac Fine. Enable by default in DAS, use '--no-with-fine-dependencies' to disable.
Change-Id: I6a0ad214ae3b0f12dec9922fedb07ab28654f019
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462540
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-17 09:25:28 -08:00
Brian Wilkerson bc6b01e43b Add support for capturing a session log for a short time
Adds a new logging sink that supports an in-memory storage of events for
a subset of the whole server session. This is support for being able to
add 'start' and 'stop' buttons to the insight pages, which will allow
us and users to capture a smaller number of log entries.

Change-Id: Ia562e4da7b09c11ad9191c24cb85102970e1b116
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461901
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2025-11-14 11:39:09 -08:00
Sam Rawlins 83b47a8333 DAS: rename constants to use lowerCamelCase
Change-Id: If3f23ffc275171c67d0dc9cab3ee4abb7c5bc117
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461181
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-11-14 10:26:10 -08:00
Brian Wilkerson 64ce61bfc8 Add support for command-line arguments to the session recorder and player
In the process of adding this support I decided to add a 'kind' field to
the entries so that it was easier to check to see what kind of entry the
player was suppose to deal with.

I also create constants for the keys used in entries to make it easier
to keep the logger and player consistent.

Change-Id: Ib1f57c8f9d28bcfad6cf9bb3c8c6ec74fcb17c8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461520
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-11-12 13:03:18 -08:00
Sam Rawlins 68d44b88c1 DAS: Make many protocol constants lowerCamelCase
Change-Id: Ibe3ae38d2afe00a125ed43034625924d4e989755
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461241
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-12 09:14:29 -08:00
Brian Wilkerson 2e843c4342 Initial version of the session logger
The session logger is the first half of the replay mechanism. It
captures data in a log about all of the messages sent to and from the
analysis server. The log player will then take such a log and replay
the portions required in order to drive an analysis server.

This first CL captures all of the communications except those with the
plugin isolates. Adding support for the plugin isolates will require
some additional refactoring that I thought would be easier to review if
placed in a separate CL.

Change-Id: I8f19abd3ebff83ac26584a9377922520857801d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459341
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-11-03 14:12:29 -08:00
Sam Rawlins ac841ae559 DAS: use lowerCamelCase names in top-level driver
Change-Id: I24a99d8b94b291ab0c306456f89ff6cdcd4d148b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458065
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-29 08:37:10 -07:00
Sam Rawlins 174c15212a DAS: Comply with unintended_html_in_doc_comment
Change-Id: Ic96bb851e4f18d11badb3e429f5601e652f89b1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454162
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-15 13:43:58 -07:00
Konstantin Shcheglov d952c3ec48 Fine. Add WITH_FINE_DEPENDENCIES flag to analytics.
Change-Id: I7fda6bc37a5bbc5021e31b12f9b190bd089c5753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453180
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-10-03 08:20:00 -07:00
Konstantin Shcheglov 75ef4ef810 Fine. Add --with-fine-dependencies option for DAS.
Change-Id: I40d600320d30ee8a31b2392ad3106e43f58e12f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450942
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-09-23 09:41:34 -07:00
Sam Rawlins 33f664940a Bump DAS to use Dart SDK 3.9.0
Change-Id: I04bc285d822a657adb5573c6de3eb38655ab0fcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448232
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-09-03 12:56:29 -07:00
Sam Rawlins b40b806bee DAS: enforce unnecessary_async lint rule
Change-Id: I05c6fbcc5ea7dea37bb7a01a3492e5cd842d11ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428923
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-16 13:37:53 -07:00
Jens Johansen ba40dced14 [analyzer] Introduce --disable-file-byte-store
Intended for benchmarking in combination with `--train-using` to make
the instruction count used more stable.

E.g. run like

```
perf stat -e "instructions:u" \
  out/ReleaseX64/dart-sdk/bin/dartaotruntime \
  --deterministic pkg/analysis_server/bin/server.aot \
  --disable-file-byte-store --train-using pkg/front_end/lib/
```

(on an aot-compiled server (

```
out/ReleaseX64/dart-sdk/bin/dart compile \
  aot-snapshot pkg/analysis_server/bin/server.dart`
```

)

looking at `instructions:u` the standard deviation is reduced quite a
bit compared to not passing the new parameter.

Without: 179,111,320 (95% becomes ±0.14%)
With: 2,743,207 (95% becomes ±0.002%)

Raw (although sorsted) numbers:

Without:

```
51,029,580,408
51,032,748,835
51,033,471,737
51,040,240,638
51,041,785,525
51,042,264,608
51,059,291,236
51,102,379,269
51,112,553,122
51,130,806,654
51,132,553,799
51,136,189,490
51,145,979,715
51,154,797,225
51,157,949,300
51,158,330,761
51,158,991,218
51,166,545,840
51,173,629,326
51,291,270,598
51,457,570,261
51,460,114,586
51,475,491,602
51,545,172,493
51,658,750,242
```

With:

```
49,878,337,415
49,878,419,595
49,879,001,051
49,881,016,075
49,882,607,217
49,882,624,488
49,883,029,234
49,883,305,881
49,883,384,825
49,883,585,095
49,883,725,866
49,884,020,490
49,884,020,988
49,884,213,971
49,884,552,882
49,884,562,548
49,884,644,369
49,885,275,225
49,885,344,007
49,885,914,848
49,886,165,117
49,886,968,388
49,887,615,329
49,888,309,000
49,888,930,570
```

Change-Id: Id492e094a3176c2877f15e5952767ea55bef3657
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428000
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-12 23:17:35 -07:00
Brian Wilkerson 7f74e064b0 Allow analytics gathering for any clients that can display a message
This test was added before the unified analytics package and was
intended to guard against gathering analytics where we were not allowed
to do so. We can now gather analytics from other clients as long as we
have displayed the appropriate message, and that should be a sufficient
check at this point.

Change-Id: I1ec68439cb1048d99fbbdec2084332e8e830235a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417861
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2025-04-30 10:07:28 -07:00
Parker Lougheed 04b178d8dc [analysis_server] Remove a few instances of dynamic
Change-Id: If117a852bf052f9e3deb879cdd92c48b68241b26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423161
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-28 15:29:21 -07:00
Brian Wilkerson 5b7fb2e8e8 Move and split the message scheduler
This CL makes three changes:
- moves the message scheduler into a new directory,
- splits the implementation into two files,
- and renames `MessageObject` to `ScheduledMessage`.

It does not make any semantic changes to the code.

The expectation is that we will need to make the message scheduler more
complex as part of improving the performance of the server, and that it
will be easier to do this if the code is structured differently.

Change-Id: I3f8741cadceb34c69fd45c1bf21f331d15824565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420500
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-04-04 10:39:51 -07:00
Brian Wilkerson 3cabc9a44f Minor cleanup in the message scheduler
Rename a couple of fields so that their purpose is more clear.

Enhance a few comments to record information I had to work to discover.

Change-Id: I9f9daa623ee4d2885d9831b59c40cccb7ab50ff7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420183
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-04-03 13:35:33 -07:00
pq 46699a91d0 [das] allow interleaved requests in the message scheduler
Includes a new `allowOverlappingHandlers` flag to support re-disablement as discussed w/ Danny.

Bug: https://github.com/dart-lang/sdk/issues/60440
Change-Id: I007f0276bf8cdbfd418ea5dacb251db3eef8dd3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-04-01 09:11:43 -07:00
Sam Rawlins 331c700f33 DAS plugins: Move Assist code to analysis_server_plugin package
The PluginServer class needs access to AssistProcessor in order to
compute assists. That class needs access to a few other classes, which
then must also be moved:

* assist_core.dart - the Assist class
* assist_dart.dart - the DartAssistContext class
* assist_generators.dart - the registeredAssistGenerators variable
* assist_performance.dart - the AssistPerformance and
  GetAssistsPerformance classes
* assist_processor.dart - the AssistProcessor class with it's
  singular API, `compute()`
* performance.dart - the ProducerRequestPerformance class
* the `addCaretAtOffset` helper function, refactored into a
  `withCaretAt` extension method

This change is functionally a no-op.

Change-Id: Ic883d21e9cc8c3db1f6093f830f01ec6eb9a0976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416680
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-19 13:44:51 -07:00
pq a098bf3dae [analytics] performance tracking for getAssists
Bug: https://github.com/dart-lang/sdk/issues/60258
Change-Id: Iffc42602680786b93de877fb581fb8248a970c8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414826
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-03-14 07:28:09 -07:00
Sam Rawlins a804d0d2e5 DAS: Require assists to be registered
This is required so that an analyzer plugin can process producer generators that are registered in a plugin isolate.

* Change `AssistProcessor._generators` and
  `AssistProcessor._multiGenerators` into private top-level variables
  which are only used as "built-in" assist processor generators. They
  must be explicitly registered, which we see much of in this change.
* Rename all of the lists of _generators_ and maps with lists of
  _generators_, which were named "producers". The new names are
  "generators." This leads to giant diffs because of alphabetizing.

Change-Id: Id4432737daaec1bb282f0b387619b23c18c0ea55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414665
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-03-12 12:07:40 -07:00
Jens Johansen 3873af28e9 [analyzer server] Legacy protocol debounces getFixes and getAsssits requests too; benchmark
In reports of the analyzer being slow we've seen `edit.getFixes` causing
a long queue because they take longer to execute than the wait before
the next one comes in.

While we haven't been able to reproduce that, this CL adds a benchmark
that fires *a lot* of both `edit.getFixes` (seen in reports from users)
and `edit.getAssists` (which seems, locally at least, to happen every
time the cursor moves), and debounces them, changing the benchmark
results from

```
4 files / CodeType.ImportCycle:
Initial analysis: 1.322030
Completion after change: 3.096128

4 files / CodeType.ImportChain:
Initial analysis: 1.361750
Completion after change: 3.500849

4 files / CodeType.ImportExportCycle:
Initial analysis: 1.349346
Completion after change: 3.065497

4 files / CodeType.ImportExportChain:
Initial analysis: 1.367151
Completion after change: 3.246891

4 files / CodeType.ImportCycleExportChain:
Initial analysis: 1.360573
Completion after change: 3.393901
```

to

```
4 files / CodeType.ImportCycle:
Initial analysis: 1.322070
Completion after change: 0.546532

4 files / CodeType.ImportChain:
Initial analysis: 1.410870
Completion after change: 0.649789

4 files / CodeType.ImportExportCycle:
Initial analysis: 1.349923
Completion after change: 0.741040

4 files / CodeType.ImportExportChain:
Initial analysis: 1.360396
Completion after change: 0.638332

4 files / CodeType.ImportCycleExportChain:
Initial analysis: 1.354682
Completion after change: 0.658086
```

Change-Id: Icb0423133726e02e08e204b1c59209264889f8a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413682
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-11 00:22:15 -07:00
Jens Johansen 0309919795 [analyzer server] Legacy protocol debounces hover requests too
TL;DR: By only responding (for real) to the newest hover request a
benchmark that used to take ~10 seconds now takes ~0.6 seconds.

Details:

In https://github.com/dart-lang/sdk/issues/55281#issuecomment-2700500279
I noticed that some of the performance issues people are seeing fom the
analyzer server stem from many requests being fired, each taking longer
the wait before the next is issued, naturally building up a longer and
loger queue before responses are made. Their it was for `edit.getFixes`,
but I'm yet to actually reproduce that. I did reproduce for hover
requests though, so here I'm debounsing those hover requests.
I'm hooking into the system that already debounces completion requests
and following the pattern used there.

On my machine, running

```
out/ReleaseX64/dart-sdk/bin/dart \
pkg/analysis_server/tool/benchmark_tools/big_chain_benchmark/legacy_many_hover_requests.dart
```

I get these numbers:

Before CL (taken from the parent CL that introduces the benchmark):

```
4 files / CodeType.ImportCycle:
Initial analysis: 1.249438
Completion after change: 10.143719

4 files / CodeType.ImportChain:
Initial analysis: 1.367604
Completion after change: 9.936909

4 files / CodeType.ImportExportCycle:
Initial analysis: 1.233644
Completion after change: 10.011695

4 files / CodeType.ImportExportChain:
Initial analysis: 1.226382
Completion after change: 9.875991

4 files / CodeType.ImportCycleExportChain:
Initial analysis: 1.262932
Completion after change: 9.995607
```

With CL:

```
4 files / CodeType.ImportCycle:
Initial analysis: 1.322501
Completion after change: 0.569768

4 files / CodeType.ImportChain:
Initial analysis: 1.347588
Completion after change: 0.635748

4 files / CodeType.ImportExportCycle:
Initial analysis: 1.492362
Completion after change: 0.575233

4 files / CodeType.ImportExportChain:
Initial analysis: 1.331619
Completion after change: 0.576199

4 files / CodeType.ImportCycleExportChain:
Initial analysis: 1.342130
Completion after change: 0.608064
```

Change-Id: Ide3dbc4dfb885af9e1c46a763338ba545c0ab7db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413982
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2025-03-10 05:00:19 -07:00
Danny Tuppeny 9ee4414536 [analysis_server] Add a diagnostic page to stream the analysis PerformanceLog
This adds a new page to the analysis server diagnostics that allow you to start/stop streaming the analyzer `PerformanceLog` to the client. This can be useful to capture a slice of this traffic (for example while typing in a file where performance feels bad) without having to enable the on-disk log which can grow very large and hard to match up with specific points in time.

Change-Id: I6bf2b891481191929593beaef813c02df5d3a0c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403420
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-04 13:13:05 -08:00
Konstantin Shcheglov a5468363c6 CQ. Remove unnecessary 'async' where no 'await'.
Change-Id: I58f56c098c9cec753325ab56d0aad37e1fde0ec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403082
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-07 10:08:11 -08:00
Sam Rawlins d3fed4088b DAS: Clean up some broken comment references
Change-Id: I319620941b6051b138326cab9bbb8985b43216eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402426
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-12-30 11:56:34 -08:00
Sam Rawlins 57c4da6911 Make Driver.instrumentationService private and final
Change-Id: I903c293771c6666e5f1b0f7dc2637abc51943849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401580
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-12-17 17:49:29 -08:00
Sam Rawlins f934e392f2 analyzer: Remove unnecessary Driver.httpServer
Change-Id: I504f7f2ebf01a1a5e963374f3c0b4a66c2ed9d1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401383
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-17 17:35:10 -08:00
Danny Tuppeny 343ffd1ea8 [analysis_server] Fix URI/path comparisons for Windows in the Scheduler
We can't use `uri.path` to get a file path from a `file:///` URI because on Windows it will be incorrect. Instead, we should use `toFilePath()`... however, it's possible in future we'll have non-file URIs here (macros etc.), so it's better to compare URIs directly.

Fixes https://github.com/dart-lang/sdk/issues/59615

Change-Id: I9b4badb96edc9f7dae57b1fa399d0e4fef8bb86a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397620
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-11-26 21:52:58 +00:00
Keerti Parthasarathy f7c9899217 [Message scheduler] Implement handling one message at a time.
Change-Id: I2294a7f209414a499fce05c0180358ec271349fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386581
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-22 01:12:11 +00:00
Sam Rawlins e5274a522e DAS: Use new package:args API for less casting
Change-Id: Ib0fbdebb6c703202f13330d7bf53eade26fa73de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396040
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2024-11-18 19:34:39 +00:00
Sam Rawlins fbf331e0dd DAS: reformat source code with tall-style
Change-Id: I42b4a44fd6a2197e499e8623274b3cd1a4b5556f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394003
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 23:04:00 +00:00
Keerti Parthasarathy da1930ab6c Add cancellation token for legacy requests in message scheduler
Change-Id: I6b0837edbf373d2b8b72b16ed47d157c097347d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-11-06 12:58:02 +00:00
Keerti Parthasarathy 1d1cbf2837 Move cancellation token creation to MessageScheduler
Change-Id: I1def99245a7f063c5613cb9b82d75b686aff9ce7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391203
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-22 16:23:09 +00:00
Danny Tuppeny 0bd1bffa84 [analysis_server] Show analysis driver scheduler timings in the diagnostic pages
The `AnalysisDriverScheduler` already keeps timings of all of its operations (in `accumulatedPerformance`), but they're not easily accessible to users and might help track down some kinds of performance issues.

This adds a new page to the diagnostics server that shows the timings, as well as a reset button to clear them so they can collect numbers just for a specific operation(s).

It involves some tweaks to the server to handle `POST` (because we shouldn't really use `GET` to mutate anything).

Change-Id: Ia49d471aaa1637a0c978f75569556b26982367d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388561
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-07 17:10:16 +00:00
Danny Tuppeny df010e598f Support DTD requests in the message scheduler
Most DTD tests are currently skipped because we're not currently exposing the LSP handlers, however I temporarily added them and verified with this change that those tests pass (both success and error requests).

Change-Id: I001b7b07c99be18a3711a434bdd081a631e4b4c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-09-10 16:42:47 +00:00
Keerti Parthasarathy caa36cfe83 Add a MessageScheduler queue that all incoming messages to the analysis server go through.
Change-Id: I3770b5a1a8faa391fb35a5a1e3d2678dbc4fb3f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383703
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-05 20:45:59 +00:00
Danny Tuppeny 916272331b [analysis_server] Remove the singleton uriConverter and pass explicitly to all toJson/fromJson methods
This avoids accidentally using the converter when talking to plugins, (at least for now) URIs are never expected, and file paths should always be used regardless of which mode the server is in.

This unfortunately touches a _lot_ of code, so I've pushed in many separate patch sets to Gerrit.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5156

Change-Id: I312c3e2cbc35a05a078aaa0138aec7288b3c7dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373745
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-02 14:15:11 +00:00
Danny Tuppeny 3833a7bd3e [dartdev]/[analysis_server] Report server errors to "dart analyze" to prevent misleading output for parse/analysis exceptions
If analysis failed due to an exception, "dart analyze" may still report "no issues found" because it didn't get any server errors.

It didn't get server errors for a number of reasons:

1. Analysis errors were silent (see https://github.com/dart-lang/sdk/issues/39284)
2. `server` in ErrorNotifier was always `null` because the code that set it did so too early
3. `ErrorNotifier` was never added to the instrumentation service, so never got called anyway

Additionally, "dart analyze" printed "No errors found!" even if server errors occurred (as long as the server didn't crash).

This change fixes up the server reference in ErrorNotifier, adds it to the instrumentation service and uses a new flag ("--disable-silent-analysis-exceptions") to allow opting-in to getting analysis errors to the client. It also updates "dart analyze" to not print "No errors found!" (and to not use a 0 exit code) when server errors occur.

Because this change "fixes" ErrorNotifier, it's possible that with this change clients will now get additional error notifications (non-silent exceptions that were being dropped previously) which could result in users seeing more errors - but presumably errors that should have been reported before anyway.

Fixes https://github.com/dart-lang/sdk/issues/49931

Change-Id: I4948117c78b8f382550b7641076de443250bba6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358902
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-05-28 19:10:40 +00:00
Konstantin Shcheglov 017bed7b9a CQ. Enable unnecessary_final in analysis_server/
Change-Id: Ieb62a1c774a5e8f5a22deaa8e8e5fff6f9f849dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-05-16 21:20:28 +00:00
Devon Carew 8d6ad53c7e [pkg/analysis_server] remove use of package:usage
Change-Id: I3a18670b6131f4e8c445217f1b302e64a74f591c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365489
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-05-07 22:11:29 +00:00
Konstantin Shcheglov 5c07c89a35 Enable 'unnecessary_final' in analysis_server/.
Change-Id: I71ee934b915d4aff924cf5925f87bcc9adc6c015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-16 20:04:15 +00:00
Konstantin Shcheglov 8968e5500a CQ. Enable avoid_redundant_argument_values in analysis_server/
Change-Id: If9c09f81bdbac890553573a8491ca27cb4f22dd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353805
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-26 19:51:41 +00:00
Brian Wilkerson 2404a0cb4c Add a flag to disable debouncing of status notifications
I tried to find tests related to the server's command-line options, but
we don't appear to test them.

Change-Id: I0c840deca19402acc59fd5c126be46e4bb2de81d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348765
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-01-27 16:08:10 +00:00
Sam Rawlins 3f91beb64f analyzer: Separate FixProcessor from built-in fix producer mappings
In order for CorrectionProducers to be used in analyzer plugins, we
need to access DartFixContributor which needs to compute fixes via
FixProcessor. So both DartFixContributor and FixProcessor need to be
moved into analyzer_plugin (eventually). For now, to support
prototyping, I am moving FixProcessor to its own library, and
separating all of the built in mappings (from diagnostic to producer
generators).

I think this separation actually stands on its own as being tidier,
simplifying fix_internal.dart, and separating code from data, as it
were.

Work towards https://github.com/dart-lang/sdk/issues/53402

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try
Change-Id: I3b4fadc7ed94c23597d72bef7dcd832380d34e9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345561
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-01-15 23:41:29 +00:00
Parker Lougheed 597d7e4d82 [analysis_server] Verify training dev server waits for analysis to complete
Without this fix, the notification handlers were being called multiple times
due to the original listener not closing in time.

Fixes https://github.com/dart-lang/sdk/issues/51017
Closes https://github.com/dart-lang/sdk/issues/54161

Bug: https://github.com/dart-lang/sdk/issues/51017
Change-Id: I969e46496a9a330252cf8247b97cb057befabbc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337882
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-11-27 18:54:59 +00:00
pq 440ea59ee0 enable flutter_style_todos in server
Change-Id: I4921d538e1498e66c8cab2d84dfcad21d1a7b555
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335952
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-14 21:08:12 +00:00
Helin Shiah 6b03758f76 Collect analytics from VS Code remote usages
This is the ID sometimes sent for internal VS Code users, and we want to capture these users as well for some internal IDE tracking.

Change-Id: Id3b5aa89eacefb873e88b59745014454a89e6a73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321323
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-08-17 20:24:30 +00:00
eliasyishak 34f0e26d45 Swapping NoopAnalytics for noop from package:unified_analytics
Change-Id: I3419a128830ae434fa37bd10a1fc8a3da146fd89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Elias Yishak <eliasyishak@google.com>
2023-07-14 19:15:20 +00:00