Skip to content
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

form_metric_filename does not form correct metric filename when the service_name does not contain dot #140

Closed
flearc opened this issue Mar 25, 2024 · 0 comments · Fixed by #141

Comments

@flearc
Copy link
Contributor

flearc commented Mar 25, 2024

The function form_metric_filename takes service_name as a parameter but always uses empty string as filename to generate the metric filename if the service_name does not contains dot(.).

// Generate the metric file name from the service name.
fn form_metric_filename(service_name: &str, with_pid: bool) -> String {
    let dot = ".";
    let separator = "-";
    let mut filename = String::new();
    if service_name.contains(dot) {
        filename = service_name.replace(dot, separator);
    }
    let mut filename = format!("{}{}{}", filename, separator, METRIC_FILENAME_SUFFIX);
    if with_pid {
        let pid = std::process::id();
        filename = format!("{}.pid{}", filename, pid);
    }
    filename
}
@flearc flearc changed the title form_metric_filename does not handle service name without dot correctly form_metric_filename does not form correct metric filename when the service_name does not contain dot Mar 25, 2024
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 a pull request may close this issue.

1 participant