Skip to content

Normalize prometheus labels#204

Merged
hoytech merged 1 commit intohoytech:masterfrom
theAnuragMishra:normalize-prometheus-labels
Apr 22, 2026
Merged

Normalize prometheus labels#204
hoytech merged 1 commit intohoytech:masterfrom
theAnuragMishra:normalize-prometheus-labels

Conversation

@theAnuragMishra
Copy link
Copy Markdown
Contributor

Fixes #203

@theAnuragMishra theAnuragMishra force-pushed the normalize-prometheus-labels branch from 81a76a1 to 4cca431 Compare April 17, 2026 22:39
Comment thread src/apps/relay/RelayIngester.cpp Outdated
@@ -68,7 +78,7 @@ void RelayServer::runIngester(ThreadPool<MsgIngester>::Thread &thr) {
sendNoticeError(msg->connId, std::string("bad close: ") + e.what());
}
} else if (cmd.starts_with("NEG-")) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think it'd be better to just enumerate the known commands here, rather than using starts_with. Then there's no need for a separate normalize function, and it's more consistent with the other branches.

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.

and ignore the unknowns from metrics?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Yeah I think so. Unknown commands that don't start with NEG- are ignored in the metrics. So either we should make it work for all unknown commands, or just ignore it. Probably the later since unknown commands are just dropped anyway.

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.

done! enumerated the four NEG- commands as in NIP-77. anything else is ignored.

@theAnuragMishra theAnuragMishra force-pushed the normalize-prometheus-labels branch from 4cca431 to 742a03e Compare April 22, 2026 18:50
Comment thread src/apps/relay/RelayIngester.cpp Outdated
sendNoticeError(msg->connId, std::string("bad close: ") + e.what());
}
} else if (cmd.starts_with("NEG-")) {
} else if (cmd == "NEG-OPEN" || cmd == "NEG-MSG" || cmd == "NEG-CLOSE" || cmd == "NEG-ERR") {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks good, but NEG-ERR is never valid in a client->relay message (see ingesterProcessNegentropy).

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.

hmm my bad. i checked nip 77 docs to confirm and enumerated all the types there. fixed now.

@theAnuragMishra theAnuragMishra force-pushed the normalize-prometheus-labels branch from 742a03e to 888f97d Compare April 22, 2026 19:00
Copy link
Copy Markdown
Owner

@hoytech hoytech left a comment

Choose a reason for hiding this comment

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

Thanks!

@hoytech hoytech merged commit 5599eb3 into hoytech:master Apr 22, 2026
1 check 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.

Possibility of unbounded label growth

2 participants