-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Compared to sentinel-golang, some functions and struct fields have different visibility in sentinel-rust.
For example, form_metric_filename in golang is public but in rust it is private.
// Generate the metric file name from the service name.
func FormMetricFileName(serviceName string, withPid bool) string {
dot := "."
separator := "-"
if strings.Contains(serviceName, dot) {
serviceName = strings.ReplaceAll(serviceName, dot, separator)
}
filename := serviceName + separator + MetricFileNameSuffix
if withPid {
pid := os.Getpid()
filename = filename + ".pid" + strconv.Itoa(pid)
}
return filename
}
// Generate the metric file name from the service name.
fn form_metric_filename(service_name: &str, with_pid: bool) -> String {
let separator = "-";
let mut filename = if service_name.contains('.') {
service_name.replace('.', separator)
} else {
service_name.to_string()
};
filename.push_str(&format!("{}{}", separator, METRIC_FILENAME_SUFFIX));
if with_pid {
let pid = std::process::id();
filename.push_str(&format!(".pid{}", pid));
}
filename
}
Metadata
Metadata
Assignees
Labels
No labels