Commit Graph

403 Commits

Author SHA1 Message Date
Lorenzo Blasa
2c24ec9f5d Add OS to record
Summary: OS will become useful later on, add it.

Reviewed By: antonk52

Differential Revision: D47989161

fbshipit-source-id: 3615544051b163b77f87e5c52e6ac9cae8c478d4
2023-08-02 07:56:17 -07:00
Lorenzo Blasa
d43173a8df adb kill-server
Summary: Introduce a new command to allow killing adb

Reviewed By: antonk52

Differential Revision: D47988522

fbshipit-source-id: bb4f17faa7f9b31b9d42e45c0ce39b3f5d98f4b3
2023-08-02 07:56:17 -07:00
Luke De Feo
eaf5b4c246 Dont kill flipper server when no clients connect and is dev
Summary: This is quite annoying and causes may un needed reboots of flipper server while developing

Reviewed By: antonk52

Differential Revision: D47949842

fbshipit-source-id: c2f18e16a4933e4209e74f51978cb7d05b80ee11
2023-08-01 10:32:29 -07:00
Lorenzo Blasa
430a42ec7a Send connectivity logs to scuba
Summary:
^

A dashboard to display the logs from a user session will be built next.

Reviewed By: antonk52

Differential Revision: D47944634

fbshipit-source-id: fb9e53981de5abb401c93c47cdec68f72c944b94
2023-08-01 03:45:05 -07:00
Lorenzo Blasa
830ac6eac9 All logs to be emitted
Summary: Error logs were missing, they're now reported.

Reviewed By: antonk52

Differential Revision: D47944591

fbshipit-source-id: a1f5515dded7c2e8955522e12554cd5f520d4c88
2023-08-01 03:45:05 -07:00
Lorenzo Blasa
143fe0e719 Cmd failures should be displayed as errors too
Summary:
Styles are applied depending on entry type. This was an issue when we had 'cmd' as a type too.

So, let's simplify and keep type to denote info, warning, or errors.

Later on we can add a different tag if we want to differentiate between logs, command, others.

Reviewed By: passy

Differential Revision: D47912857

fbshipit-source-id: 213a0768a95f63cbd692ba96f6745ab740346a58
2023-07-31 05:16:54 -07:00
Lorenzo Blasa
f301de64f3 iOSDeviceManager queryDevicesForever converted to async
Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47912037

fbshipit-source-id: ac7a9650c82219a21577e6bca7e08d075ae5da15
2023-07-31 03:55:58 -07:00
Lorenzo Blasa
e9bae419a7 iOSDeviceManager getSimulators converted to async
Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47911997

fbshipit-source-id: df2cab1986d5ddc7f2bc4e857c76cd178f6a7ccb
2023-07-31 03:55:58 -07:00
Lorenzo Blasa
1f63a25027 idb kill
Summary: Introduce a new command to allow killing idb

Reviewed By: lawrencelomax

Differential Revision: D47911709

fbshipit-source-id: 970f1147a177bbcca0bdfa9e9ba970cdc8a914a3
2023-07-31 03:55:58 -07:00
Lorenzo Blasa
bf96cc2f15 Server notifications using connection troubleshoot notification
Summary: Migrate to new server event which allows troubleshoot

Reviewed By: passy

Differential Revision: D47875977

fbshipit-source-id: 2549bef6ebb26660176747d44e3f535ad9f1d213
2023-07-28 13:04:46 -07:00
Lorenzo Blasa
0ab1aeee78 ClientQuery optional for commands
Summary:
Some commands are run without a ClientQuery i.e. fetching devices.

Nevertheless, this can be provide insights when problems take place.

Reviewed By: antonk52

Differential Revision: D47795358

fbshipit-source-id: 0b7dc34475ae061f1b72843a087a798d305ed1c8
2023-07-26 08:16:47 -07:00
Andrey Goncharov
9ef69bdbad Downgrade metro connection error
Reviewed By: passy

Differential Revision: D47515502

fbshipit-source-id: aa05e9f62b661989187f0340cf06eaa7dbaac379
2023-07-17 08:38:50 -07:00
Sanjaiyan Parthipan
7cef8286f9 Concurrent Function Upgrade for Enhanced Performance (#4918)
Summary:
Republishing sanjaiyan-dev's PR https://github.com/facebook/flipper/pull/4889 running `git rebase` because of a conflict.

Pull Request resolved: https://github.com/facebook/flipper/pull/4918

Reviewed By: lblasa

Differential Revision: D47294545

Pulled By: passy

fbshipit-source-id: 74904ec6179ed5a3bab6f9b701c3cd769ecad3bf
2023-07-17 04:43:14 -07:00
Lorenzo Blasa
f404827c69 Exit if proxy fails
Summary:
If the proxy fails, exit.

The proxy server is the one listening on the supplied TCP port, used by PWA.

If it has failed, then quit the process.

Reviewed By: aigoncharov

Differential Revision: D47433631

fbshipit-source-id: 55750db5bf3e00876074a6b403747ec07718878c
2023-07-13 03:59:58 -07:00
Lorenzo Blasa
0e01fcad44 Android container utility integration
Summary: Report commands as executed by the android container utility.

Reviewed By: antonk52

Differential Revision: D47340410

fbshipit-source-id: dc2f80572816c8746e603aae2d721da2c47c3c4e
2023-07-12 03:30:34 -07:00
Lorenzo Blasa
6668420083 Disable stdout for successful device listing
Summary: If it is successful, we rarely care about stdout, which can be quite verbose. So don't use it.

Reviewed By: antonk52

Differential Revision: D47339446

fbshipit-source-id: 66f43d4184e44ed07364a6f33715139e19b2dc1d
2023-07-11 07:21:00 -07:00
Lorenzo Blasa
564d62d8d5 AndroidDevice, transform to async function
Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47331809

fbshipit-source-id: 819aefd1703cefc24b71216b946ca66bed3f5db1
2023-07-11 04:04:37 -07:00
Lorenzo Blasa
cc0f42be76 Integrate iOS and Android certificate providers with recorder
Summary: Integrate and clean existing logs.

Reviewed By: antonk52

Differential Revision: D47330592

fbshipit-source-id: 7b1c7ebbe5804ccc184edd2583f5cddd598f11e8
2023-07-10 05:52:07 -07:00
Lorenzo Blasa
c15ac08714 Clean AndroidCertificateProvider
Summary: Remove debug logs and add re-format other warn logs to have parity with iOS

Reviewed By: antonk52

Differential Revision: D47330455

fbshipit-source-id: ac8edde2124bbe99d0ea11f46f3b85dd77b96c7b
2023-07-10 05:52:07 -07:00
Lorenzo Blasa
e484867f21 Enable dispatch of events
Summary: To dispatch events, we need a valid instance of FlipperServer. This is the place so enable the recorder with it.

Reviewed By: antonk52

Differential Revision: D47295986

fbshipit-source-id: f2231544c58ba8f76e9102265e10a99520260b0a
2023-07-10 05:52:07 -07:00
Lorenzo Blasa
e20d723ac0 Make ClientQuery available to certificate provider
Summary:
CertificateProvider is intrinsically related to a client query, make it available to it.

This becomes the optional 'context' of shell executions. When these are recorded, the context is provider to the recorder which can then link an ongoing certificate exchange process with the success or failure of said command.

Reviewed By: antonk52

Differential Revision: D47295894

fbshipit-source-id: 9469d18bda02793d71a6a8b29c93f4af1db23569
2023-07-10 05:52:07 -07:00
Lorenzo Blasa
fc38355eee Centralise logging
Summary:
Centralise connectivity logging into a single place. By having all logs go through a single interface, then it becomes trivial to manipulate them as needed.

In this change, this is not done.

In subsequent diffs, logs will be dispatched via an event and will be visualised in the Connectivity Hub.

Reviewed By: passy

Differential Revision: D47185054

fbshipit-source-id: fb5eab98895be0c8f61fb9a77d3e66d6a8dbcb27
2023-07-10 04:14:14 -07:00
Lorenzo Blasa
f78ca5c09e iOSContainerUtility improvements (?)
Summary:
Bit of refactoring, bit of improvements, maybe. Mainly:

- Name consistency
- Promise chaining to async/await
- Refactoring

Reviewed By: lawrencelomax, antonk52

Differential Revision: D47224620

fbshipit-source-id: 5f4515f576decc03d470c11f24577b43f34a5a28
2023-07-05 05:15:01 -07:00
Lorenzo Blasa
e052c27f27 Remove ClientCsrQuery
Summary: Already have SecureClientQuery. No need to have this as a type as it's not used or needed anywhere.

Reviewed By: antonk52

Differential Revision: D47210345

fbshipit-source-id: d9f3026a0e2a0b5dd2e87f16dba34a388dacd75f
2023-07-04 09:01:26 -07:00
Lorenzo Blasa
4a0ad8c1c3 SecureClientQuery moved to flipper-common
Summary: It should've been there with ClientQuery.

Reviewed By: antonk52

Differential Revision: D47210314

fbshipit-source-id: 869496918648f20b616c1a612296fff55597af77
2023-07-04 09:01:26 -07:00
Lorenzo Blasa
f63e5d440a Move certificate exchange bits to app-connectivity
Summary: Bit of reorganising as utils is a bit too generic and crowded.

Reviewed By: passy

Differential Revision: D47186536

fbshipit-source-id: 7b1dd26db95aef00778ff4f23d91f7371c4d07ad
2023-07-04 02:19:58 -07:00
Lorenzo Blasa
62cb33b763 comms: app-connectivity
Summary: It doesn't get more generic than 'comms'. So, narrow it down: app-connectivity.

Reviewed By: passy

Differential Revision: D47185255

fbshipit-source-id: 87e9c2487c9b07603d14e856de670757078c0da1
2023-07-03 09:40:26 -07:00
Lorenzo Blasa
48495c906e ServerAdapter: ServerWebSocketBase
Summary: Make it more clear about that this is. `ServerAdapter` was VERY generic.

Reviewed By: passy

Differential Revision: D47185076

fbshipit-source-id: 7d9b30f423398004bedc92ad22bc0217d1c8453f
2023-07-03 05:01:17 -07:00
Lorenzo Blasa
165a989cc6 Use setProcessState
Summary:
`setProcessState` does some adjusting to PATH. This was only ever done for Electron.

This change moves that functionality to FlipperServerImpl which is the one what orchestrates. By doing this, flipper server also benefits from getting these adjustments.

Reviewed By: antonk52

Differential Revision: D46836659

fbshipit-source-id: f98291d320cf9b7f3808223af8745c068b1318ce
2023-06-19 04:05:07 -07:00
Lorenzo Blasa
8f70cf14a4 Kill server after 30 seconds
Summary: Bring timeout from 15min to 30seconds.

Reviewed By: passy

Differential Revision: D46726959

fbshipit-source-id: cae1fdd4668fc5237ad0f187385f3a63a51c4797
2023-06-14 09:59:21 -07:00
Lukas Kurucz
279a9e6b52 fix: prefixed plugin package name (#4811)
Summary:
When distributing plugin over Marketplace. Currently there is an issue with downloading a plugin to `tmp` folder if the plugin `packageName` starts with `company-prefix/flipper-plugin-name`. It would throw `ENONET` error while trying to stream the response data into `tmp` folder.

## Changelog

- add support for prefixed plugin package names (`shopify/flipper-plugin-name`,...)

Pull Request resolved: https://github.com/facebook/flipper/pull/4811

Test Plan: - Try install a plugin from Marketplace which has `/` in the plugin `package.json` `name`.

Reviewed By: lblasa

Differential Revision: D46679195

Pulled By: passy

fbshipit-source-id: f330896dae9da7cbe101b1c6d7ed07667fb7ae0a
2023-06-13 03:53:18 -07:00
Lorenzo Blasa
0db4e99aff Track bootstrap diagnostics
Summary:
^

In addition to logging to the console bootstrap performance metrics, track these events to scuba as well.

Reviewed By: aigoncharov

Differential Revision: D46648876

fbshipit-source-id: 191704c13158884bb8cfbca614a23f2a64f1fd93
2023-06-13 02:45:57 -07:00
Lorenzo Blasa
146a5cf666 Move server started analytics
Summary: This is a better place as it takes place once the server starts listening.

Reviewed By: passy

Differential Revision: D46558350

fbshipit-source-id: f586defecc8e16d8f0b285615803662d8b6b75fb
2023-06-08 11:03:44 -07:00
Lorenzo Blasa
bd809853e7 Fixes an issue with client queries and rsocket
Summary: This is necessary as we map from the protocol medium to our internal medium representation.

Reviewed By: mweststrate

Differential Revision: D46557431

fbshipit-source-id: 617307cd860e1c7e230be2441c06417c44af580e
2023-06-08 07:24:32 -07:00
Lorenzo Blasa
85f5c6f893 Close server if no clients are connected
Summary: If after 15min there are no connected clients, close flipper server.

Reviewed By: antonk52

Differential Revision: D46519563

fbshipit-source-id: c3396ed8987be8ca7075c644734793e4ebceba18
2023-06-07 10:46:15 -07:00
Lorenzo Blasa
7dc978c3d3 Remove processDevices logs
Summary: These are no longer that useful and can be quite verbose, remove.

Reviewed By: antonk52

Differential Revision: D46516093

fbshipit-source-id: e6c3a546d379ca20ff8757fdc3feaa11bf0788a0
2023-06-07 06:59:31 -07:00
Lorenzo Blasa
98f376ec69 Use auth token when connecting to existing server from Electron
Summary:
All clients need to provide an authentication token before connecting. Electron app is no different.

This change adds the authentication token whether we are connecting over UDS or TCP.

Before this change, if Flipper server was already running, launching the Electron app would look similar to this:

{F1016961594}

Reviewed By: antonk52

Differential Revision: D46418758

fbshipit-source-id: f00ffe675df78403d5921250e3e9ed9331a55bde
2023-06-05 05:26:10 -07:00
Lorenzo Blasa
90240f4186 Move auth token to the default directory for crypto related files
Summary:
Used to be stored in the static directory as it was meant to be used by connecting clients.

This is still the case, except that there may be different clients with different static directories all trying to connect to the same server.

Instead, store the authentication token with the other crypto files, in the user's home directory.

By doing this, all clients, as long as they have access to the local filesystem, can use it.

Reviewed By: mweststrate

Differential Revision: D46418639

fbshipit-source-id: 181e98346d86ad7b3fc1d0005aca3350deb6df32
2023-06-05 05:26:10 -07:00
Lorenzo Blasa
80c201b10f Add localhost as a valid host
Summary: ^

Reviewed By: passy

Differential Revision: D46393661

fbshipit-source-id: eeaa0971a747d6435a10c3eb27969bb452cd73a7
2023-06-02 09:35:32 -07:00
Andrey Goncharov
e8e1a32e48 Back out "Update adbkit and logcat to maintained librarys"
Summary:
Original commit changeset: 2a23c0eaa12f

Original Phabricator Diff: D45569652

The new lib causes weird log parsing https://fb.workplace.com/groups/flippersupport/permalink/1629943924152926/

Reviewed By: LukeDefeo, passy

Differential Revision: D46390961

fbshipit-source-id: 7c9d0ca7fff2d9cb1ac1a309710f2348233a3471
2023-06-02 08:10:47 -07:00
Lorenzo Blasa
828d56f617 Kill PortForwardingApp on exit
Summary:
I noticed we were not killing the PortForwardingApp on exit.

This is not ideal.

So, use an exit hook to kill the app.

Reviewed By: passy

Differential Revision: D46392855

fbshipit-source-id: e2b75f76c9dfab0ff46df3ad2c94a1a523154b2a
2023-06-02 07:55:56 -07:00
Lorenzo Blasa
2f9e633fad Medium refactoring
Summary:
Simplifies medium usage. Clients report this value as an integer. Internally, we transform this integer as type (a set of valid strings).

Instead of transform this value in different places, do it once when the client query is received.

Reviewed By: antonk52

Differential Revision: D46358024

fbshipit-source-id: ecd2b6c6ccbe7c38787a89d4e2f81930c7b91864
2023-06-02 03:59:15 -07:00
Andrey Goncharov
94cb8935b2 Fix adb connection
Summary: On my mac localhost resolves to an IP6 address by the new adb lib. This should fix it.

Reviewed By: LukeDefeo

Differential Revision: D46314612

fbshipit-source-id: 3771efd2c6b79fe9ae9851ce4aac35bcede28847
2023-05-31 09:25:55 -07:00
Andrey Goncharov
1d595862b5 Fix e2e test
Summary: This time for real

Reviewed By: elboman

Differential Revision: D46279935

fbshipit-source-id: a639a6abafa7267ef4539c183323a5c96674e202
2023-05-30 09:47:19 -07:00
Andrey Goncharov
53a5939d68 Add one more fallback for the adb path
Summary: It seems that adb path has changed on the jest-e2e side. That might case the flipper e2e test failure. With this fallback we have granular control of the path.

Reviewed By: antonk52

Differential Revision: D46278512

fbshipit-source-id: 97310459de54eeb003eefb3a3ff06af8b13bebae
2023-05-30 09:47:19 -07:00
Lorenzo Blasa
27909e8296 Track CSR processing
Summary:
Need to answer:

- Certificate exchange success rate, fails and errors a day per OS and device type.

Reviewed By: antonk52

Differential Revision: D46221301

fbshipit-source-id: 03c6993aa15f56fdf98a7abd57d00b2af0e9ce1a
2023-05-26 08:02:12 -07:00
Lorenzo Blasa
f25591580c Track insecure connection attempts
Summary: Same as previous diff but for plain socket.

Reviewed By: antonk52

Differential Revision: D46220933

fbshipit-source-id: 235ca860891b8514dd0d743d32fe85f15a2cdd7e
2023-05-26 08:02:12 -07:00
Lorenzo Blasa
135d3e3aa8 Track secure connection attempts
Summary: Same as previous diff but for TLS attempts.

Reviewed By: antonk52

Differential Revision: D46220897

fbshipit-source-id: 9495c39edffbdebe0ba21ec7320b63bad8759dde
2023-05-26 08:02:12 -07:00
Lorenzo Blasa
8065313949 Track app connections
Summary:
Need to answer:

- How many app connections a day/week?
- How many connections a day/week per app?
- How many connections a day/week per os?
- How many connections a day/week over WWW exchange?
- How many connections a day/week over FS exchange?
- How many connections over a device?
- How many connections over a simulator?

Reviewed By: antonk52

Differential Revision: D46220581

fbshipit-source-id: 6783f49b59cba91cd04625044314973d98cef301
2023-05-26 08:02:12 -07:00
Lorenzo Blasa
e7806d5be7 Track server start
Summary:
Need to answer:

- How many starts a day over time

Reviewed By: antonk52

Differential Revision: D46219995

fbshipit-source-id: bffaeadf684a2d34c6e145784c5a86dbaf5f532a
2023-05-26 08:02:12 -07:00