-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore(metrics): make Identify allowlist configurable #6147
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
base: master
Are you sure you want to change the base?
Conversation
It seems this issue might have been automatically generated. To help us address it effectively, please provide additional details. We value the use of LLMs for code generation and welcome your contributions but please ensure your submission is of such quality that a maintainer will spend less time reviewing it than implementing it themselves. Verify the code functions correctly and meets our standards. If your change requires tests, kindly include them and ensure they pass. If no further information is provided, the issue will be automatically closed in 7 days. Thank you for your understanding and for aiding us in maintaining quality contributions! |
Thanks for the feedback!
What changed concretely
How to pass custom protocols (example) use libp2p_metrics::{Metrics, Registry};
use libp2p_swarm::StreamProtocol;
// e.g., when an app uses a custom pubsub protocol ID via ConfigBuilder::protocol_id
let custom_gossipsub = StreamProtocol::new("/myappsub/1.2.3");
// You can pass multiple protocols (meshsub/floodsub/customs) as needed.
let extra = [
custom_gossipsub,
// StreamProtocol::new("/meshsub/1.2.0"),
// StreamProtocol::new("/floodsub/1.0.0"),
];
let mut registry = Registry::default();
let metrics = Metrics::new_with_identify_allowed_protocols(&mut registry, extra); Defaults remain unchanged when using: let metrics = Metrics::new(&mut registry); If anything else would make this more useful for users (naming, docs, or making a builder), happy to adjust. |
This is not pushed yet, I think? I can't see it in the diff. |
@elenaf9
|
Co-authored-by: Darius Clark <[email protected]>
@dariusc93 I moved the |
Make the Identify allowlist configurable instead of hard-coding protocol IDs.
identify::Metrics::new_with_allowed_protocols(...)
to accept extraStreamProtocol
s.libp2p_metrics::Metrics::new_with_identify_allowed_protocols(...)
to forward user-provided protocols.ConfigBuilder::protocol_id
.Usage
Notes & open questions
Change checklist