Skip to content

Commit 293dcb9

Browse files
craig[bot]dhartunian
andcommitted
Merge #146121
146121: tsdump: better error message for virtual cluster r=dhartunian a=dhartunian Wrap gRPC errors in `tsdump` with info about which host they're connecting to. Add custom unimplemented error messages for tenant dump commands which instruct the user to connect to the "system virtual cluster". Resolves: #142823 Release note: None Co-authored-by: David Hartunian <[email protected]>
2 parents 6083171 + a1df94f commit 293dcb9

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

pkg/cli/tsdump.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ will then convert it to the --format requested in the current invocation.
160160
if debugTimeSeriesDumpOpts.format == tsDumpRaw {
161161
stream, err := tsClient.DumpRaw(context.Background(), req)
162162
if err != nil {
163-
return err
163+
return errors.Wrapf(err, "connecting to %s", conn.Target())
164164
}
165165

166166
// Buffer the writes to os.Stdout since we're going to
@@ -190,7 +190,7 @@ will then convert it to the --format requested in the current invocation.
190190
}
191191
stream, err := tsClient.Dump(context.Background(), req)
192192
if err != nil {
193-
return err
193+
return errors.Wrapf(err, "connecting to %s", conn.Target())
194194
}
195195
recv = stream.Recv
196196
} else {
@@ -245,7 +245,7 @@ will then convert it to the --format requested in the current invocation.
245245
return w.Flush()
246246
}
247247
if err != nil {
248-
return err
248+
return errors.Wrapf(err, "connecting to %s", serverCfg.AdvertiseAddr)
249249
}
250250
if err := w.Emit(data); err != nil {
251251
return err

pkg/ts/server.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,20 @@ func (s *Server) DumpRaw(req *tspb.DumpRequest, stream tspb.TimeSeries_DumpRawSe
388388
return dumpImpl(stream.Context(), s.db.db, req, d)
389389
}
390390

391+
func (s *TenantServer) DumpRaw(_ *tspb.DumpRequest, _ tspb.TimeSeries_DumpRawServer) error {
392+
return status.Errorf(codes.Unimplemented, "DumpRaw is not implemented for virtual clusters. "+
393+
"If you are attempting to take a tsdump, please connect to the system virtual cluster, "+
394+
"not an application virtual cluster. System virtual clusters will dump all persisted "+
395+
"metrics from all virtual clusters.")
396+
}
397+
398+
func (s *TenantServer) Dump(_ *tspb.DumpRequest, _ tspb.TimeSeries_DumpServer) error {
399+
return status.Errorf(codes.Unimplemented, "Dump is not implemented for virtual clusters. "+
400+
"If you are attempting to take a tsdump, please connect to the system virtual cluster, "+
401+
"not an application virtual cluster. System virtual clusters will dump all persisted "+
402+
"metrics from all virtual clusters.")
403+
}
404+
391405
func dumpImpl(
392406
ctx context.Context, db *kv.DB, req *tspb.DumpRequest, d func(*roachpb.KeyValue) error,
393407
) error {

0 commit comments

Comments
 (0)