Initial implementation: logger, example usage, and tests#1
Initial implementation: logger, example usage, and tests#1stefanrammo merged 1 commit intoCDPTechnologies:mainfrom stefanrammo:main
Conversation
| A simple Javascript interface to communicate with CDP applications containing a CDPLogger component to retrieve historic data. | ||
| # CDPLogger Client for JavaScript | ||
|
|
||
| A simple JavaScript interface for communicating with CDP applications that include a CDPLogger component to retrieve historic data. |
There was a problem hiding this comment.
Also add reference to cdpstudio.com and contact information like in the real-time data client https://github.com/CDPTechnologies/JavascriptCDPClient
| The index.js file contains a simple logger built for the CDP Studio example case. | ||
|
|
||
| 1. Set up and run the Logger in CDP Studio. | ||
| (Refer to Help → Framework - Data Logging → How to Setup Logging in Automation System) |
There was a problem hiding this comment.
| }; | ||
| }; | ||
| // Create a new client instance. | ||
| client = new Client('127.0.0.1', 17000, true); |
There was a problem hiding this comment.
The real-time JS client takes host and port as a single url argument. Better to be consistent with that.
E.g. from the JS real-time client example:
var client = new studio.api.Client(window.location.host, new NotificationListener());
|
|
||
| function requestDataPoints(limits) { | ||
| console.log("Log limits received:", limits); | ||
| return client.requestDataPoints(["Output"], limits.start_s, limits.end_s, 25); |
There was a problem hiding this comment.
start_s and end_s should be camelCase I think
| if (this.storedPromises[data.versionResponse.requestId]) { | ||
| const { reject } = this.storedPromises[data.versionResponse.requestId]; | ||
| delete this.storedPromises[data.versionResponse.requestId]; | ||
| reject(new Error("CDP version needs to be 3.0 or newer.")); |
There was a problem hiding this comment.
Seems this message was wrong in python logger client as well. CDP version and logger API version are different things. Logger API version 3.0 corresponds to CDP version 4.3, so could you change the message to print "CDP version needs to be 4.3 or newer.".
| return value; | ||
| } | ||
|
|
||
| _valueFromVariant(value) { |
There was a problem hiding this comment.
Noticed the real-time client uses a different method for valueFromVariant conversions.
https://github.com/CDPTechnologies/JavascriptCDPClient/blob/main/index.js#L94
| } | ||
| } | ||
|
|
||
| _updateTimeDiff() { |
There was a problem hiding this comment.
I think the Client should have some option to disable time sync. It has previously got in the way that sometimes people want raw database values from the logger without time adjustment
| for (let i = 0; i < data.signalInfoResponse.name.length; i++) { | ||
| const node = { | ||
| name: data.signalInfoResponse.name[i], | ||
| routing: data.signalInfoResponse.path[i] |
There was a problem hiding this comment.
Should implement tags support (the python client also does not have it yet but tags are available in the .proto file)
No description provided.