Skip to content

Initial implementation: logger, example usage, and tests#1

Merged
stefanrammo merged 1 commit intoCDPTechnologies:mainfrom
stefanrammo:main
Mar 20, 2025
Merged

Initial implementation: logger, example usage, and tests#1
stefanrammo merged 1 commit intoCDPTechnologies:mainfrom
stefanrammo:main

Conversation

@stefanrammo
Copy link
Copy Markdown
Collaborator

No description provided.

@stefanrammo stefanrammo merged commit 96c1f87 into CDPTechnologies:main Mar 20, 2025
Comment thread README.md
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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add reference to cdpstudio.com and contact information like in the real-time data client https://github.com/CDPTechnologies/JavascriptCDPClient

Comment thread README.md
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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread test/client.test.js
};
};
// Create a new client instance.
client = new Client('127.0.0.1', 17000, true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());

Comment thread index.js

function requestDataPoints(limits) {
console.log("Log limits received:", limits);
return client.requestDataPoints(["Output"], limits.start_s, limits.end_s, 25);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start_s and end_s should be camelCase I think

Comment thread client.js
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."));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.".

Comment thread client.js
return value;
}

_valueFromVariant(value) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed the real-time client uses a different method for valueFromVariant conversions.

https://github.com/CDPTechnologies/JavascriptCDPClient/blob/main/index.js#L94

Comment thread client.js
}
}

_updateTimeDiff() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread client.js
for (let i = 0; i < data.signalInfoResponse.name.length; i++) {
const node = {
name: data.signalInfoResponse.name[i],
routing: data.signalInfoResponse.path[i]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should implement tags support (the python client also does not have it yet but tags are available in the .proto file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants