From 92f9abab418051e08f03b20ebe80986456f7f27e Mon Sep 17 00:00:00 2001 From: Roman Lomonosov Date: Fri, 9 Feb 2018 09:55:43 +0300 Subject: [PATCH] Readme hash-filenames --- README.md | 4 +++- deploy/go-carbon.conf | 3 +++ tags/normalize.go | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5bfe8ac8..9f728101 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,9 @@ sparse-create = false # use flock on every file call (ensures consistency if there are concurrent read/writes to the same file) flock = false enabled = true +# Use hashed filenames for tagged metrics instead of human readable +# https://github.com/lomik/go-carbon/pull/225 +hash-filenames = true [cache] # Limit of in-memory stored points (not metrics) @@ -239,7 +242,6 @@ buffer-size = 0 # receiver_max_messages = 1000 # receiver_max_bytes = 500000000 # default 500MB - [carbonlink] listen = "127.0.0.1:7002" enabled = true diff --git a/deploy/go-carbon.conf b/deploy/go-carbon.conf index 7b84b176..b2903f43 100644 --- a/deploy/go-carbon.conf +++ b/deploy/go-carbon.conf @@ -25,6 +25,9 @@ sparse-create = false # use flock on every file call (ensures consistency if there are concurrent read/writes to the same file) flock = false enabled = true +# Use hashed filenames for tagged metrics instead of human readable +# https://github.com/lomik/go-carbon/pull/225 +hash-filenames = true [cache] # Limit of in-memory stored points (not metrics) diff --git a/tags/normalize.go b/tags/normalize.go index b040d95e..c021fb12 100644 --- a/tags/normalize.go +++ b/tags/normalize.go @@ -98,10 +98,10 @@ func Normalize(s string) (string, error) { return strings.Join(arr[:len(arr)-toDel], ";"), nil } -func FilePath(root string, s string, hash_only bool) string { +func FilePath(root string, s string, hashOnly bool) string { sum := sha256.Sum256([]byte(s)) hash := fmt.Sprintf("%x", sum) - if hash_only == true { + if hashOnly == true { return filepath.Join(root, "_tagged", hash[:3], hash[3:6], hash) } else { return filepath.Join(root, "_tagged", hash[:3], hash[3:6], strings.Replace(s, ".", "_DOT_", -1))