-
-
Notifications
You must be signed in to change notification settings - Fork 4
chore: ensure metrics are correctly exposed #701
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: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good to me, just some minor suggestions and a few questions.
I only looked at the Rust code - let me know if I should look at the docs as well.
pub fn metrics_ports(&self, role: &HbaseRole) -> Vec<(String, u16)> { | ||
match role { | ||
HbaseRole::Master => vec![( | ||
HBASE_METRICS_PORT_NAME.to_string(), | ||
HBASE_MASTER_METRICS_PORT, | ||
)], | ||
HbaseRole::RegionServer => vec![( | ||
HBASE_METRICS_PORT_NAME.to_string(), | ||
HBASE_REGIONSERVER_METRICS_PORT, | ||
)], | ||
HbaseRole::RestServer => { | ||
vec![(HBASE_METRICS_PORT_NAME.to_string(), HBASE_REST_METRICS_PORT)] | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: The mapping of role to metrics port exists in two places: Here and below at line 575 which inevitably contains the risk to drift apart. I think it makes sense to contain this mapping in a single place instead.
One possible solution is to drop the associated metrics_port
function and user .map()
to extract only the port numbers when needed.
HBASE_METRICS_PORT_NAME.to_string(), | ||
HBASE_MASTER_METRICS_PORT, | ||
)], | ||
HbaseRole::RegionServer => vec![( | ||
HBASE_METRICS_PORT_NAME.to_string(), | ||
HBASE_REGIONSERVER_METRICS_PORT, | ||
)], | ||
HbaseRole::RestServer => { | ||
vec![(HBASE_METRICS_PORT_NAME.to_string(), HBASE_REST_METRICS_PORT)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Use to_owned
instead.
HBASE_METRICS_PORT_NAME.to_string(), | |
HBASE_MASTER_METRICS_PORT, | |
)], | |
HbaseRole::RegionServer => vec![( | |
HBASE_METRICS_PORT_NAME.to_string(), | |
HBASE_REGIONSERVER_METRICS_PORT, | |
)], | |
HbaseRole::RestServer => { | |
vec![(HBASE_METRICS_PORT_NAME.to_string(), HBASE_REST_METRICS_PORT)] | |
HBASE_METRICS_PORT_NAME.to_owned(), | |
HBASE_MASTER_METRICS_PORT, | |
)], | |
HbaseRole::RegionServer => vec![( | |
HBASE_METRICS_PORT_NAME.to_owned(), | |
HBASE_REGIONSERVER_METRICS_PORT, | |
)], | |
HbaseRole::RestServer => { | |
vec![(HBASE_METRICS_PORT_NAME.to_owned(), HBASE_REST_METRICS_PORT)] |
.map(|(name, value)| ServicePort { | ||
name: Some(name), | ||
port: i32::from(value), | ||
protocol: Some("TCP".to_string()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Use to_owned
instead.
protocol: Some("TCP".to_string()), | |
protocol: Some("TCP".to_owned()), |
&rolegroup.role_group, | ||
)) | ||
.context(ObjectMetaSnafu)? | ||
.with_label(Label::try_from(("prometheus.io/scrape", "true")).context(LabelBuildSnafu)?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Does it make sense to pull this key out into a constant? Or make it an associated function on Label
, like Label::prometheus_scrape()
?
type_: Some("ClusterIP".to_string()), | ||
cluster_ip: Some("None".to_string()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Use to_owned
instead.
type_: Some("ClusterIP".to_string()), | |
cluster_ip: Some("None".to_string()), | |
type_: Some("ClusterIP".to_owned()), | |
cluster_ip: Some("None".to_owned()), |
fn prometheus_annotations(hbase: &v1alpha1::HbaseCluster, hbase_role: &HbaseRole) -> Annotations { | ||
Annotations::try_from([ | ||
("prometheus.io/path".to_owned(), "/prometheus".to_owned()), | ||
( | ||
"prometheus.io/port".to_owned(), | ||
hbase.metrics_port(hbase_role).to_string(), | ||
), | ||
( | ||
"prometheus.io/scheme".to_owned(), | ||
if hbase.has_https_enabled() { | ||
"https".to_owned() | ||
} else { | ||
"http".to_owned() | ||
}, | ||
), | ||
("prometheus.io/scrape".to_owned(), "true".to_owned()), | ||
]) | ||
.expect("should be valid annotations") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Similar question to above - does it make sense to pull these out into contants or associated function on Annotation
?
Description
Part of stackabletech/issues#747
This PR adds a metrics service with the additional Prometheus annotations. It also adds some documentation on monitoring for the TLS case since, similar to NiFi, HBase also exposes metrics behind a port which gets secured by TLS
Follow up monitoring Stack PR because moving to the metrics service, the port name changed: stackabletech/demos#316
Definition of Done Checklist
Author
Reviewer
Acceptance
type/deprecation
label & add to the deprecation scheduletype/experimental
label & add to the experimental features tracker