Commit Graph
280 Commits
Author SHA1 Message Date
John Colvin a0d8dfd3de build: Resolve app data dir and shared mem prefix at runtime
We really can't define them at compile time anymore as we build multiple
exes that depend on libspark in the same dir (e.g., spark api server,
pubsub, ds-publisher, webapp, etc.). That means one libspark.so (or dll)
must serve all exes. We should compile a consistent libspark to mitigate
the risk of running an exe with the wrong version (of libspark). For
example, running pubsub with a libspark configured for spark api server,
leftover from an earlier build.
2024-10-21 13:29:59 +00:00
John Colvin 6a88337355 Display exception stack trace w/ 1 call per line in ds webapp 2024-10-21 13:29:59 +00:00
John Colvin 5cd558d402 Remove unused ErrorView from ds webapp 2024-10-21 13:29:59 +00:00
John Colvin 7f87644b10 Propagate ViewStream errors to webapp frontend 2024-10-21 13:29:59 +00:00
John Colvin 3e36a4ded5 Add ErrorChanged event to propagate DataStream exceptions 2024-10-21 13:29:59 +00:00
John Colvin 81f27e0dc5 Set columns to empty array rather than null in ds webapp
If no data has been received. Since the 'columns' property was marked
'required', this eliminates a warning that was being logged to console.
2024-10-21 13:29:59 +00:00
John Colvin 10f1eb9144 Improve alignment/spacing in ds webapp 2024-10-21 13:29:59 +00:00
John Colvin 146a52f0ab Configure datastream deployment with docker-compose
To deploy to aws, connect to our aws vpn then run:
tools/deploy-docker-compose.sh

The deploy script does the following:
* builds sparkd
* builds datastream apps (pubsub, md-publisher, and webapp)
* uploads the build to aws
* bounces all services (sparkd, pubsub, md-publisher, and webapp)

Note: the name 'md-publisher' refers to DataStreamPublisher w/ MarketData
configuration
2024-10-21 13:29:59 +00:00
John Colvin 179926ce94 Remove "BTS Cloud Streams" title from webapp
Space is precious when viewing on phone (tbh, it didn't look that good
anyways).
2024-10-21 13:29:59 +00:00
John Colvin 6fef5410a2 fix: Ensure md-publisher waits for pubsub and sparkd
Bugs (fixed):
  * md-publisher silently fails if it tries to connect before those services are "ready".

The Docker compose "depends_on" property ensures sparkd and pubsub
containers are up, but doesn't prevent startup race bugs (e.g., if
md-publisher and pubsub start around the same time, and md-publisher
tries to connect before pubsub has started accepting connections). To
address these race conditions, we use a nifty tool called "dockerize"

References:
  * https://github.com/jwilder/dockerize
2024-10-21 13:29:59 +00:00
John Colvin 7f94366389 Replace ErrorView component w/ robust QueryStatusView 2024-10-21 13:29:59 +00:00
John Colvin aca2f92fcc Fix typos in query button theme 2024-10-21 13:29:59 +00:00
John Colvin a330e22beb fix: Don't assert on exception in BooleanExpression.evaluate
Bugs (fixed):
  * DataStream WebApp Server sometimes crashes when the user enters a
    bad query.
2024-10-21 13:29:59 +00:00
John Colvin e078043829 Change VITE_DATASTREAM_WEBSOCKET_URL to localhost 2024-10-21 13:29:59 +00:00
John Colvin 6b2d9c0bc3 Assert that local ip address is successfully obtained 2024-10-21 13:29:59 +00:00
John Colvin bd95260cc1 improvement: Resolve hostnames when comparing ip addrs
So we can to configure pubsub routes by hostname or ipv4 (ipv6 hasn't been
tested yet...so we should assume it doesn't work).
2024-10-21 13:29:59 +00:00
John Colvin a697cc4958 Assert TcpConnection endpoint matches expected 2024-10-21 13:29:59 +00:00
John Colvin 596478d978 Fix typo in log msg (was missing interpolation '$') 2024-10-21 13:29:59 +00:00
John Colvin 6cace25a7c Catch exceptions on AsyncTCPConnector_AsyncWrapper background thread
Since it spawns a new thread on each attempt, uncaught exceptions were previously undetected,
and caused silent failures down the pipe. This should make it easier to track such bugs down.
2024-10-21 13:29:59 +00:00
John Colvin 6a723b913f fix: Format PubSubRoute as json in log msgs
It was previously using the default ToString, which simply returns the type name
2024-10-21 13:29:59 +00:00
John Colvin 4afbca2e05 build: Upgrade packages (deps) in DataStreamTests 2024-10-21 13:29:59 +00:00
John Colvin 17efe0a411 cleanup: Remove unused ViewStreamDatabase config 2024-10-21 13:29:59 +00:00
John Colvin 6a881c8f2b Configure apps as a distributed system via Docker compose 2024-10-21 13:29:59 +00:00
John Colvin 4c5c4388b5 Remove reference to spark protobuf Config in ViewStream
We can't read spark protobuf Config until it has been initialized,
and since ViewStream doesn't have the configServer param handy it
isn't able to initialize config if necessary. In that case, it would simply
block until config was initialized by someone else. Such a risk doesn't
seem justified for this particular configuration dependency
(DataStreamConfig.UseUncopiedNewRowsInFire). For now, its hardcoded to false.
2024-10-21 13:29:59 +00:00
John Colvin e8f5407e2f refactor: Run RemoteQueryManager as an IHostedService
This paradigm more accurately represents the RemoteQueryManager as a
Service that can be started/stopped.
2024-10-21 13:29:59 +00:00
John Colvin 3f0d3889d7 Remove inappropriate "Unable to dispose subscription" log msg 2024-10-21 13:29:59 +00:00
John Colvin 0435fbee94 Move misplaced log abt initializing query text to appropriate place 2024-10-21 13:29:59 +00:00
John Colvin c5ff2aa03d Assert ViewStreamDatabase.instance is only created once
The instance must be initialized via ViewStreamDatabase.SetGlobalInstance
2024-10-21 13:29:59 +00:00
John Colvin 8d7f1469cc cleanup: Remove unused code from ViewStreamDatabase 2024-10-21 13:29:59 +00:00
John Colvin ecbf9d083c Include subscription id in ds websocket updates 2024-10-21 13:29:59 +00:00
John Colvin de3300de02 fix: Define BoooleanConstant before StringConstant
Otherwise the former masks the latter and prevents it from matching
2024-10-21 13:29:59 +00:00
John Colvin c92f219357 Log event data in websocket open, close, error callbacks 2024-10-21 13:29:59 +00:00
John Colvin 65d8af4939 refactor: Bring back Material DataGrid
Fix the column resize bugs that made it previously unusable
2024-10-21 13:29:59 +00:00
John Colvin 2342670c66 refactor: Improve react webapp state management
* Add queryTextResetTime as part of the CannedQuery state
  (the QueryControl compares the canned query click time with the time of the
  last user input, and applies the text from the most recent change)

* Replace 'isRunning' (bool) with a 'queryState' (string) to reflect the subscription status
  value received from the server. Less indirection this way.

* Replace inappropriate useMemo call w/ useEffect
2024-10-21 13:29:59 +00:00
John Colvin d8bf2d3cda cleanup: Get rid of magic const (subscriptionId) in webapp App.jsx 2024-10-21 13:29:59 +00:00
John Colvin c38dc2dc4f cleanup: Remove unnecessary deps from csprojs 2024-10-21 13:29:59 +00:00
John Colvin c45ef25a31 fix: Downgrade Microsoft.Extensions.Hosting to 7.0.1
A handful of csprojs were referencing version 8.0.0. Since that version
targets net8.0, I have no idea why it didn't cause the build to fail.
Instead, this framework mismatch led to a mysterious runtime crash with
the following error, despite the dll in question being present in the
build dir:

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
The system cannot find the file specified.

It is worth noting that this crash would only happen for exes published
as part of the DataStreamSuite.sln with the "--self-contained" flag. For
example, the Bts.DataStreamSuite.Server exe would always fail if
published via:

dotnet publish --configuration Release --sc --framework net7.0 --runtime linux-x64 <DataStreamSuite.sln>
2024-10-21 13:29:58 +00:00
John Colvin 431ef0ae70 Add HttpsRedirection middleware first in the webapp pipeline
Middleware handlers are invoked in the order in which they are added. Any middleware
that is added before HttpsRedirection may can prevent the request from being redirected.
As of now, only development-specific middleware is added ahead of HttpsRedircetion.
2024-10-21 13:29:58 +00:00
John Colvin a770724de1 build: Copy configuration profiles to build dir
So they are readily available to publish/deploy scripts.
2024-10-21 13:29:58 +00:00
John Colvin 5a9930334e fix: Catch exception when creating TcpClient 2024-10-21 13:29:58 +00:00
John Colvin 69ba13f3a1 fix: Catch WebSocketException in DataStreamSubscription 2024-10-21 13:29:58 +00:00
John Colvin 9b0e1642a9 fix: Add null check to NonIncGroupByStream 2024-10-21 13:29:58 +00:00
John Colvin bec2932203 fix: Add null check to TableAccumulator2 2024-10-21 13:29:58 +00:00
John Colvin 25d2e8048e fix: Make SystemSubscriptionMapPublisher threadsafe
The PubSubState.onTagMapChanged event may not be invoked on
the same thread as doWork.
2024-10-21 13:29:58 +00:00
John Colvin 0e8726c78c fix: Add null check in TimeBasedFilter.cs 2024-10-21 13:29:58 +00:00
John Colvin a1d3c50aef Reduce task wait/timeout code in AsyncTCPConnector 2024-10-21 13:29:58 +00:00
John Colvin d84d993b7d Add a few canned queries to AwsProd.json for ds webapp 2024-10-21 13:29:58 +00:00
John Colvin c58e9b9e96 fix: Copy canned queries to clipboard on click
Instead of trying to update the text directly, which causes the front end
to overwrite the user's changes everytime the data updates from then on.
2024-10-21 13:29:58 +00:00
John Colvin 21240312e7 fix: Convert invalid doubles to nan in ds webapp serializer 2024-10-21 13:29:58 +00:00
John Colvin 5f75a110b7 Increase datagrid maxheight in ds webapp to 1000px 2024-10-21 13:29:58 +00:00