mirror of
https://github.com/ClusterCockpit/cc-metric-store.git
synced 2024-12-26 16:59:07 +01:00
Merge pull request #34 from ClusterCockpit/devel
feat: support for ns,ms,us,s in lineprotocol
This commit is contained in:
commit
adbdc839a9
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,3 +25,6 @@ test.creds
|
|||||||
migrateTimestamps.pl
|
migrateTimestamps.pl
|
||||||
test_ccms_api.sh
|
test_ccms_api.sh
|
||||||
test_ccms_free_api.sh
|
test_ccms_free_api.sh
|
||||||
|
test_ccms_write_api.sh
|
||||||
|
sample_alex.txt
|
||||||
|
sample_fritz.txt
|
@ -313,7 +313,20 @@ func decodeLine(dec *lineprotocol.Decoder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t, err = dec.Time(lineprotocol.Second, t); err != nil {
|
if t, err = dec.Time(lineprotocol.Second, t); err != nil {
|
||||||
return fmt.Errorf("timestamp : %#v with error : %#v", lineprotocol.Second, err.Error())
|
t = time.Now()
|
||||||
|
if t, err = dec.Time(lineprotocol.Millisecond, t); err != nil {
|
||||||
|
t = time.Now()
|
||||||
|
if t, err = dec.Time(lineprotocol.Microsecond, t); err != nil {
|
||||||
|
t = time.Now()
|
||||||
|
if t, err = dec.Time(lineprotocol.Nanosecond, t); err != nil {
|
||||||
|
return fmt.Errorf("timestamp : %#v with error : %#v", t, err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("timestamp : %#v with error : %#v", t, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ms.WriteToLevel(lvl, selector, t.Unix(), []memorystore.Metric{metric}); err != nil {
|
if err := ms.WriteToLevel(lvl, selector, t.Unix(), []memorystore.Metric{metric}); err != nil {
|
||||||
|
@ -268,6 +268,15 @@ func (l *Level) toCheckpoint(dir string, from, to int64, m *MemoryStore) error {
|
|||||||
// This function can only be called once and before the very first write or read.
|
// This function can only be called once and before the very first write or read.
|
||||||
// Different host's data is loaded to memory in parallel.
|
// Different host's data is loaded to memory in parallel.
|
||||||
func (m *MemoryStore) FromCheckpoint(dir string, from int64) (int, error) {
|
func (m *MemoryStore) FromCheckpoint(dir string, from int64) (int, error) {
|
||||||
|
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
||||||
|
// The directory does not exist, so create it using os.MkdirAll()
|
||||||
|
err := os.MkdirAll(dir, 0755) // 0755 sets the permissions for the directory
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Error creating directory: %#v\n", err)
|
||||||
|
}
|
||||||
|
fmt.Printf("%#v Directory created successfully.\n", dir)
|
||||||
|
}
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
work := make(chan [2]string, NumWorkers)
|
work := make(chan [2]string, NumWorkers)
|
||||||
n, errs := int32(0), int32(0)
|
n, errs := int32(0), int32(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user