-
-
Notifications
You must be signed in to change notification settings - Fork 23
LocalStorage for the browser and Node.js #41
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
Conversation
Content type is not enforced, and we use one common storage for heterogeneous data (events and configuration data).
- Added NodeFileStorage - Added DevDependency: mock-fs (https://github.com/tschaub/mock-fs) - Modified InMemoryStorage specs to work for both kinds of storage implementations
@@ -18,6 +19,10 @@ defaults.moduleCollector = new NodeModuleCollector(); | |||
defaults.requestInfoCollector = new NodeRequestInfoCollector(); | |||
defaults.submissionAdapter = new NodeSubmissionAdapter(); | |||
|
|||
Configuration.prototype.useLocalStorage = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overrides the Configuration.useLocalStorage
stub for Node.
Conflicts: package.json
Put code from BrowserStorage and NodeFileStorage into common base class
} | ||
|
||
readDate(key: string) { | ||
return Date.now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we get the tick count from the key?
let key = `ex-q-${new Date().toJSON()}-${Utils.randomNumber()}`;
Looking good |
LocalStorage for the browser and Node.js
@frankebersoll could just use |
This is the (quite naive) implementation of local storage that uses
window.localStorage
in the browser and the file system in Node; see Issue #24Configuration
client.config.useLocalStorage();
I can see making the event directory configurable for node - currently, it uses the default
.exceptionless
in the application's root directory.Performance
This could be drastically improved by using caching and background processing. We could use a combination of in-memory cache and then write the events to the file system (or local storage, which also uses the file system) in batches, so the ui is blocked for only very short times. In Node, I use synchronous file access which probably could be changed to async.
The only thing being cached now is the list of event names together with their timestamps.
ToDo
.express
relative to the application root path