Merge pull request #3570 from Gouthamve/colon-snapshot

Make the date returned by snapshot script friendly
This commit is contained in:
Goutham Veeramachaneni 2017-12-11 19:04:10 -08:00 committed by GitHub
commit 2d73d2b892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -400,12 +400,12 @@ $ curl -XPOST http://localhost:9090/api/v1/admin/tsdb/snapshot
{
"status": "success",
"data": {
"name": "2017-11-30T15:31:59Z-2366f0a55106d6e1"
"name": "20171210T211224Z-2be650b6d019eb54"
}
}
```
The snapshot now exists at `<data-dir>/snapshots/2017-11-30T15:31:59Z-2366f0a55106d6e1`
The snapshot now exists at `<data-dir>/snapshots/20171210T211224Z-2be650b6d019eb54`
*New in v2.1*

View File

@ -637,7 +637,9 @@ func (api *API) snapshot(r *http.Request) (interface{}, *apiError) {
var (
snapdir = filepath.Join(db.Dir(), "snapshots")
name = fmt.Sprintf("%s-%x", time.Now().UTC().Format(time.RFC3339), rand.Int())
name = fmt.Sprintf("%s-%x",
time.Now().UTC().Format("20060102T150405Z0700"),
rand.Int())
dir = filepath.Join(snapdir, name)
)
if err := os.MkdirAll(dir, 0777); err != nil {

View File

@ -174,7 +174,9 @@ func (s *Admin) TSDBSnapshot(_ old_ctx.Context, _ *pb.TSDBSnapshotRequest) (*pb.
}
var (
snapdir = filepath.Join(db.Dir(), "snapshots")
name = fmt.Sprintf("%s-%x", time.Now().UTC().Format(time.RFC3339), rand.Int())
name = fmt.Sprintf("%s-%x",
time.Now().UTC().Format("20060102T150405Z0700"),
rand.Int())
dir = filepath.Join(snapdir, name)
)
if err := os.MkdirAll(dir, 0777); err != nil {