Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

remove directory prefix when writing metric names #743

Merged
merged 2 commits into from
Oct 8, 2017

Conversation

jtlisi
Copy link
Contributor

@jtlisi jtlisi commented Oct 5, 2017

This is a fix to the importer-reader tool that removes the whisper directory flag from the metric name.

@jtlisi jtlisi requested a review from replay October 5, 2017 15:51
@@ -205,7 +205,7 @@ func getMetricName(file string) string {
file = file[1:]
}

return *namePrefix + strings.Replace(strings.TrimSuffix(file, ".wsp"), "/", ".", -1)
return *namePrefix + strings.Replace(strings.TrimSuffix(strings.TrimPrefix(file, *whisperDirectory), ".wsp"), "/", ".", -1)
Copy link
Contributor

@replay replay Oct 5, 2017

Choose a reason for hiding this comment

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

that's great.
is it possible that you'll need to take care of a potential leading / that's omitted in whisperDirectory?
like f.e. if the whisperDirectory is /opt/storage and the file is /opt/storage/mypath/abc.wsp then we'll want mypath/abc.wsp and not /mypath/abc.wsp right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, that's definitely an issue, since there could be a . prefixing the name
https://play.golang.org/p/lLZtHioeJO

Copy link
Contributor

@replay replay left a comment

Choose a reason for hiding this comment

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

👍

@Dieterbe
Copy link
Contributor

Dieterbe commented Oct 8, 2017

fix #731

@Dieterbe Dieterbe merged commit 897b53d into master Oct 8, 2017
@Dieterbe Dieterbe deleted the importer-reader-directory-bugfix branch September 18, 2018 09:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants