Commit Graph
13642 Commits
Author SHA1 Message Date
John Colvin be77b630dd vscode: Fix sparkd debug config 2024-11-29 14:58:54 +00:00
John Colvin b20c38bd1a 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-11-29 14:58:54 +00:00
John Colvin 932918f473 Don't log "initializing spark config" if it has already been initialized 2024-11-29 14:58:54 +00:00
John Colvin 24cbfd9062 vscode: Add debug cfg for spark api server 2024-11-29 14:58:54 +00:00
John Colvin e39de508f7 Use dependency injection in spark api server 2024-11-29 14:58:54 +00:00
John Colvin a9542b3dd1 Add SparkLoggerAdapter for Msft ILogger 2024-11-29 14:57:44 +00:00
John Colvin badb5e4c2d Display exception stack trace w/ 1 call per line in ds webapp 2024-11-29 14:57:44 +00:00
John Colvin 7d870d925b Remove unused ErrorView from ds webapp 2024-11-29 14:57:44 +00:00
John Colvin a47fc311b3 Propagate ViewStream errors to webapp frontend 2024-11-29 14:57:44 +00:00
John Colvin 4e63428540 Add ErrorChanged event to propagate DataStream exceptions 2024-11-29 14:57:44 +00:00
John Colvin 29b305635d 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-11-29 14:57:44 +00:00
John Colvin ef10ae6075 Improve alignment/spacing in ds webapp 2024-11-29 14:57:44 +00:00
John Colvin 7e8ee6a22c 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-11-29 14:57:44 +00:00
John Colvin 95d3f643d5 Remove "BTS Cloud Streams" title from webapp
Space is precious when viewing on phone (tbh, it didn't look that good
anyways).
2024-11-29 14:57:44 +00:00
John Colvin 5819bfdd87 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-11-29 14:57:44 +00:00
John Colvin 61427533d3 Replace ErrorView component w/ robust QueryStatusView 2024-11-29 14:57:44 +00:00
John Colvin a84af452af Fix typos in query button theme 2024-11-29 14:57:44 +00:00
John Colvin c1bdd09d80 fix: Don't assert on exception in BooleanExpression.evaluate
Bugs (fixed):
  * DataStream WebApp Server sometimes crashes when the user enters a
    bad query.
2024-11-29 14:57:44 +00:00
John Colvin 9de72db6fd Change VITE_DATASTREAM_WEBSOCKET_URL to localhost 2024-11-29 14:57:44 +00:00
John Colvin dd0e46b6f8 Assert that local ip address is successfully obtained 2024-11-29 14:57:44 +00:00
John Colvin 1b5a4aad61 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-11-29 14:57:44 +00:00
John Colvin 1bd8765f39 Assert TcpConnection endpoint matches expected 2024-11-29 14:57:44 +00:00
John Colvin 493f7229f3 Fix typo in log msg (was missing interpolation '$') 2024-11-29 14:57:44 +00:00
John Colvin 0ad996a959 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-11-29 14:57:44 +00:00
John Colvin 4c5a3fa229 fix: Format PubSubRoute as json in log msgs
It was previously using the default ToString, which simply returns the type name
2024-11-29 14:57:44 +00:00
John Colvin 565b004ea5 build: Upgrade packages (deps) in DataStreamTests 2024-11-29 14:57:44 +00:00
John Colvin 92952eb9e9 cleanup: Remove unused ViewStreamDatabase config 2024-11-29 14:57:44 +00:00
John Colvin e89911b6e8 vscode: Add PubSubServer debug cfg to skip build 2024-11-29 14:57:44 +00:00
John Colvin 00c110beb2 Configure apps as a distributed system via Docker compose 2024-11-29 14:57:44 +00:00
John Colvin 86448372cb 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-11-29 14:57:44 +00:00
John Colvin 525bb61140 refactor: Run RemoteQueryManager as an IHostedService
This paradigm more accurately represents the RemoteQueryManager as a
Service that can be started/stopped.
2024-11-29 14:57:44 +00:00
John Colvin b49e392915 Remove inappropriate "Unable to dispose subscription" log msg 2024-11-29 14:57:44 +00:00
John Colvin d4a39e3d1c fix: Ensure spark config init and login are only performed once
As a static function that could be called from anywhere in the code
(directly or indirectly), 'Configuration.Initialize' was vulnerable to
race bugs. The "Configuration.get<T>()" method, whose calls are
ubiquitous in our code, would initialize config if it hadn't been done
so already. Without a reference to the configServer param, this param
would effectively be ignored/overridden with null.

It's important that login only be performed once, for obvious reasons
(our exes that connect to sparkd are generally designed to process data
for a single user). Furthermore, not every routine that requires a
successful login has a reference to the credentials needed to do it. To
address this, we now pass the ISparkdLoginService singleton to these
routines so they can wait until the singular login task has completed
before they begin.
2024-11-29 14:57:44 +00:00
John Colvin 2241da9f9e Move misplaced log abt initializing query text to appropriate place 2024-11-29 14:57:44 +00:00
John Colvin 659e387841 Assert ViewStreamDatabase.instance is only created once
The instance must be initialized via ViewStreamDatabase.SetGlobalInstance
2024-11-29 14:57:44 +00:00
John Colvin 1a408fe86d cleanup: Remove unused code from ViewStreamDatabase 2024-11-29 14:57:44 +00:00
John Colvin 5b9302a3f0 Include subscription id in ds websocket updates 2024-11-29 14:57:44 +00:00
John Colvin dc5a5c858f fix: Define BoooleanConstant before StringConstant
Otherwise the former masks the latter and prevents it from matching
2024-11-29 14:57:44 +00:00
John Colvin 3dec8153f6 Log event data in websocket open, close, error callbacks 2024-11-29 14:57:44 +00:00
John Colvin 2b47263453 refactor: Bring back Material DataGrid
Fix the column resize bugs that made it previously unusable
2024-11-29 14:57:44 +00:00
John Colvin 4539113b70 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-11-29 14:57:44 +00:00
John Colvin f6bac8750b cleanup: Get rid of magic const (subscriptionId) in webapp App.jsx 2024-11-29 14:57:44 +00:00
John Colvin bcbcdfcfa5 build: Copy configuration profiles to publish dir 2024-11-29 14:57:44 +00:00
John Colvin 8933523731 cleanup: Remove unnecessary deps from csprojs 2024-11-29 14:57:44 +00:00
John Colvin 96f8eef3af build: Change publish_data_stream.py to publish the sln
We were publishing individual projects as a workaround for the
dependency issue (bug) that caused some projects to incorrectly target
net8.0. The fact that publishing individual projects "just worked" was
probably dumb luck. Now that the underlying issue has been addressed, we
can resume publishing the sln as a whole.
2024-11-29 14:57:44 +00:00
John Colvin ae4abfb5e6 dev: Install docker in devcontainer
So we can start various services like sparkd, pubsub, ds publishers, ds
webapp, etc. from inside the devcontainer.
2024-11-29 14:57:44 +00:00
John Colvin a1e15c90c8 dev: Remove dotnet8 from devcontainer
We'll upgrade to dotnet8 eventually, but now isn't the time (too much
more important work to be done).
2024-11-29 14:57:44 +00:00
John Colvin bd30ba1dab dev: Run devcontainer on host network
So we don't need to worry about publishing the right ports (and don't
need to rebuild the container everytime the list of ports changes).
2024-11-29 14:57:44 +00:00
John Colvin 563ef13420 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-11-29 14:57:44 +00:00
John Colvin ffd07b96e3 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-11-29 14:57:44 +00:00