Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Zero value if unspecified
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardjkim committed Jun 26, 2020
1 parent 474edf6 commit 48a8b9c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
5 changes: 1 addition & 4 deletions lib/install/operation.go
Expand Up @@ -268,10 +268,7 @@ func (i *Installer) generateDebugReport(ctx context.Context, clusterKey ops.Site
os.Remove(f.Name())
}
}()
rc, err := i.config.Operator.GetSiteReport(ctx, ops.GetClusterReportRequest{
SiteKey: clusterKey,
Since: time.Duration(0),
})
rc, err := i.config.Operator.GetSiteReport(ctx, ops.GetClusterReportRequest{SiteKey: clusterKey})
if err != nil {
return trace.ConvertSystemError(err)
}
Expand Down
12 changes: 1 addition & 11 deletions lib/ops/opshandler/opshandler.go
Expand Up @@ -1840,17 +1840,7 @@ func (h *WebHandler) streamOperationLogs(w http.ResponseWriter, r *http.Request,
*/
func (h *WebHandler) getSiteOperationCrashReport(w http.ResponseWriter, r *http.Request, p httprouter.Params, context *HandlerContext) error {
var since time.Duration
if val := r.URL.Query().Get("since"); val != "" {
var err error
if since, err = time.ParseDuration(val); err != nil {
return trace.Wrap(err)
}
}
report, err := context.Operator.GetSiteReport(r.Context(), ops.GetClusterReportRequest{
SiteKey: siteKey(p),
Since: since,
})
report, err := context.Operator.GetSiteReport(r.Context(), ops.GetClusterReportRequest{SiteKey: siteKey(p)})
if err != nil {
return trace.Wrap(err)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ops/opsservice/report.go
Expand Up @@ -256,7 +256,7 @@ func (s *site) collectEtcdInfoFromMasters(ctx context.Context, dir string, maste
return nil
}

// collectEtcdInfo collects etcd metrics.
// collectEtcdInfo collects etcd metrics and captures a snapshot of the data.
func (s *site) collectEtcdInfo(reportWriter report.FileWriter, runner *serverRunner) error {
w, err := reportWriter.NewWriter("etcd.tar.gz")
if err != nil {
Expand Down
6 changes: 1 addition & 5 deletions lib/ops/suite/opssuite.go
Expand Up @@ -25,7 +25,6 @@ import (
"io/ioutil"
"net/url"
"strings"
"time"

"github.com/gravitational/gravity/lib/app"
apptest "github.com/gravitational/gravity/lib/app/service/test"
Expand Down Expand Up @@ -154,10 +153,7 @@ func (s *OpsSuite) SitesCRUD(c *C) {
c.Assert(logStream.Close(), IsNil)

// download crashreport
reportStream, err := s.O.GetSiteReport(context.TODO(), ops.GetClusterReportRequest{
SiteKey: opKey.SiteKey(),
Since: time.Duration(0),
})
reportStream, err := s.O.GetSiteReport(context.TODO(), ops.GetClusterReportRequest{SiteKey: opKey.SiteKey()})
c.Assert(err, IsNil)
_, err = io.Copy(ioutil.Discard, reportStream)
c.Assert(err, IsNil)
Expand Down

0 comments on commit 48a8b9c

Please sign in to comment.