Skip to content

Pass metrics uri to backend - #81

Merged
ArgusLi merged 4 commits into
mainfrom
pass-metrics-uri-to-backend-on-start
Nov 21, 2025
Merged

Pass metrics uri to backend#81
ArgusLi merged 4 commits into
mainfrom
pass-metrics-uri-to-backend-on-start

Conversation

@ArgusLi

@ArgusLi ArgusLi commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

When a Metrics instance is created, we now pass the metrics server uri to the server app, where it is stored in a map of valkeyServerInstanceID to its respective metrics server URI.

On metrics instance close, we delete the metrics URI from the server.

Signed-off-by: Argus Li <contactme@chunkeili.com>
Signed-off-by: Argus Li <contactme@chunkeili.com>
Comment thread apps/frontend/electron.main.js Outdated
Comment thread apps/server/src/index.ts Outdated
const metricsServerURIs: Map<string, string> = new Map()

process.on("message", (message) => {
if (message && message.type === "metrics-started") {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can message be null | undefined actually?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It can be undefined but not null.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you can then write

if (message?.type === "metrics-started")

Signed-off-by: Argus Li <contactme@chunkeili.com>
metricsProcess.on('message', (message) => {
if (message && message.type === 'metrics-started') {
console.log(`Metrics server for ${serverConnectionId} started successfully on host: ${message.payload.metricsHost} port ${message.payload.metricsPort}`);
serverProcess.send?.({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this be process.post?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's confusing as there's both electron and node.js option. In this case, it's send as this is a node.js child process. https://nodejs.org/dist/latest-v16.x/docs/api/child_process.html#subprocesssendmessage-sendhandle-options-callback

Signed-off-by: Argus Li <contactme@chunkeili.com>
@ArgusLi
ArgusLi merged commit a376bae into main Nov 21, 2025
2 checks passed
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.

3 participants