diff --git a/components/cluster/command/check.go b/components/cluster/command/check.go index f2f2dbd102..eaa2da5e34 100644 --- a/components/cluster/command/check.go +++ b/components/cluster/command/check.go @@ -40,6 +40,10 @@ conflict checks with other clusters`, if len(args) != 1 { return cmd.Help() } + + if opt.ExistCluster { + clusterReport.ID = scrubClusterName(args[0]) + } // natvie ssh has it's own logic to find the default identity_file if gOpt.SSHType == executor.SSHTypeSystem && !utils.IsFlagSetByUser(cmd.Flags(), "identity_file") { opt.IdentityFile = "" diff --git a/components/cluster/command/clean.go b/components/cluster/command/clean.go index 568c911edb..955a42157c 100644 --- a/components/cluster/command/clean.go +++ b/components/cluster/command/clean.go @@ -42,6 +42,7 @@ You can retain some nodes and roles data when cleanup the cluster, eg: } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) if cleanALl { diff --git a/components/cluster/command/deploy.go b/components/cluster/command/deploy.go index f5cd93f7b9..f32c29b2cc 100644 --- a/components/cluster/command/deploy.go +++ b/components/cluster/command/deploy.go @@ -72,6 +72,7 @@ func newDeploy() *cobra.Command { if err != nil { return err } + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) teleCommand = append(teleCommand, version) @@ -103,7 +104,7 @@ func postDeployHook(builder *task.Builder, topo spec.Topology) { return nil }).BuildAsStep("Check status").SetHidden(true) - if report.Enable() { + if report.Enabled() { builder.ParallelStep("+ Check status", false, nodeInfoTask) } diff --git a/components/cluster/command/destroy.go b/components/cluster/command/destroy.go index 2201906ead..4325c607a5 100644 --- a/components/cluster/command/destroy.go +++ b/components/cluster/command/destroy.go @@ -38,6 +38,7 @@ You can retain some nodes and roles data when destroy cluster, eg: } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) // Validate the retained roles to prevent unexpected deleting data diff --git a/components/cluster/command/disable.go b/components/cluster/command/disable.go index 88c735e34b..e0cb80972e 100644 --- a/components/cluster/command/disable.go +++ b/components/cluster/command/disable.go @@ -31,6 +31,7 @@ func newDisableCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.EnableCluster(clusterName, gOpt, false) diff --git a/components/cluster/command/display.go b/components/cluster/command/display.go index d19b25be2c..138ffa6618 100644 --- a/components/cluster/command/display.go +++ b/components/cluster/command/display.go @@ -44,6 +44,7 @@ func newDisplayCmd() *cobra.Command { } clusterName = args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) exist, err := tidbSpec.Exist(clusterName) diff --git a/components/cluster/command/edit_config.go b/components/cluster/command/edit_config.go index 94a6529e46..b7fdca2ed6 100644 --- a/components/cluster/command/edit_config.go +++ b/components/cluster/command/edit_config.go @@ -27,6 +27,7 @@ func newEditConfigCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.EditConfig(clusterName, skipConfirm) diff --git a/components/cluster/command/enable.go b/components/cluster/command/enable.go index 311ec7735d..3a38b41092 100644 --- a/components/cluster/command/enable.go +++ b/components/cluster/command/enable.go @@ -31,6 +31,7 @@ func newEnableCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.EnableCluster(clusterName, gOpt, true) diff --git a/components/cluster/command/exec.go b/components/cluster/command/exec.go index a445ca528b..17ad5c14c3 100644 --- a/components/cluster/command/exec.go +++ b/components/cluster/command/exec.go @@ -30,6 +30,7 @@ func newExecCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.Exec(clusterName, opt, gOpt) diff --git a/components/cluster/command/patch.go b/components/cluster/command/patch.go index 0fda5b7bfe..d97f3b6928 100644 --- a/components/cluster/command/patch.go +++ b/components/cluster/command/patch.go @@ -39,6 +39,7 @@ func newPatchCmd() *cobra.Command { return perrs.New("the flag -R or -N must be specified at least one") } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.Patch(clusterName, args[1], gOpt, overwrite, offlineMode) diff --git a/components/cluster/command/prune.go b/components/cluster/command/prune.go index 25f594e63e..16ef7a520a 100644 --- a/components/cluster/command/prune.go +++ b/components/cluster/command/prune.go @@ -27,6 +27,8 @@ func newPruneCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) + teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.DestroyTombstone(clusterName, gOpt, skipConfirm) }, diff --git a/components/cluster/command/reload.go b/components/cluster/command/reload.go index abfd92ade2..dfded38f9c 100644 --- a/components/cluster/command/reload.go +++ b/components/cluster/command/reload.go @@ -34,6 +34,7 @@ func newReloadCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.Reload(clusterName, gOpt, skipRestart) diff --git a/components/cluster/command/rename.go b/components/cluster/command/rename.go index 68ece2590b..4a57f64ecd 100644 --- a/components/cluster/command/rename.go +++ b/components/cluster/command/rename.go @@ -32,6 +32,7 @@ func newRenameCmd() *cobra.Command { oldClusterName := args[0] newClusterName := args[1] + clusterReport.ID = scrubClusterName(oldClusterName) teleCommand = append(teleCommand, scrubClusterName(oldClusterName)) return cm.Rename(oldClusterName, gOpt, newClusterName) diff --git a/components/cluster/command/restart.go b/components/cluster/command/restart.go index ce5ea90be6..272c84ad33 100644 --- a/components/cluster/command/restart.go +++ b/components/cluster/command/restart.go @@ -31,6 +31,7 @@ func newRestartCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.RestartCluster(clusterName, gOpt) diff --git a/components/cluster/command/root.go b/components/cluster/command/root.go index cc22a55ceb..9f28220e5e 100644 --- a/components/cluster/command/root.go +++ b/components/cluster/command/root.go @@ -45,17 +45,21 @@ import ( ) var ( - errNS = errorx.NewNamespace("cmd") - rootCmd *cobra.Command - gOpt operator.Options - skipConfirm bool + errNS = errorx.NewNamespace("cmd") + rootCmd *cobra.Command + gOpt operator.Options + skipConfirm bool + reportEnabled bool // is telemetry report enabled ) var tidbSpec *spec.SpecManager var cm *manager.Manager func scrubClusterName(n string) string { - return "cluster_" + telemetry.HashReport(n) + // prepend the telemetry secret to cluster name, so that two installations + // of tiup with the same cluster name produce different hashes + cls := report.TelemetrySecret() + ":" + n + return "cluster_" + telemetry.HashReport(cls) } func getParentNames(cmd *cobra.Command) []string { @@ -240,10 +244,12 @@ func Execute() { teleReport = new(telemetry.Report) clusterReport = new(telemetry.ClusterReport) teleReport.EventDetail = &telemetry.Report_Cluster{Cluster: clusterReport} - if report.Enable() { + reportEnabled = report.Enabled() + if reportEnabled { + teleReport.InstallationUUID = report.TelemetryUUID() teleReport.EventUUID = uuid.New().String() teleReport.EventUnixTimestamp = time.Now().Unix() - clusterReport.UUID = report.UUID() + teleReport.Tiup = report.TiUPMeta() } start := time.Now() @@ -255,12 +261,12 @@ func Execute() { zap.L().Info("Execute command finished", zap.Int("code", code), zap.Error(err)) - if report.Enable() { + if reportEnabled { f := func() { defer func() { if r := recover(); r != nil { if flags.DebugMode { - fmt.Println("Recovered in telemetry report", r) + log.Debugf("Recovered in telemetry report: %v", r) } } }() @@ -268,7 +274,23 @@ func Execute() { clusterReport.ExitCode = int32(code) clusterReport.Nodes = teleNodeInfos if teleTopology != "" { - if data, err := telemetry.ScrubYaml([]byte(teleTopology), map[string]struct{}{"host": {}}); err == nil { + if data, err := telemetry.ScrubYaml( + []byte(teleTopology), + map[string]struct{}{ + "host": {}, + "name": {}, + "user": {}, + "group": {}, + "deploy_dir": {}, + "data_dir": {}, + "log_dir": {}, + }, // fields to hash + map[string]struct{}{ + "config": {}, + "server_configs": {}, + }, // fields to omit + report.TelemetrySecret(), + ); err == nil { clusterReport.Topology = (string(data)) } } @@ -283,7 +305,7 @@ func Execute() { } fmt.Printf("report: %s\n", teleReport.String()) if data, err := json.Marshal(teleReport); err == nil { - fmt.Printf("report: %s\n", string(data)) + log.Debugf("report: %s\n", string(data)) } } cancel() diff --git a/components/cluster/command/scale_in.go b/components/cluster/command/scale_in.go index 6cd46020f0..e976a89b95 100644 --- a/components/cluster/command/scale_in.go +++ b/components/cluster/command/scale_in.go @@ -32,6 +32,7 @@ func newScaleInCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) scale := func(b *task.Builder, imetadata spec.Metadata, tlsCfg *tls.Config) { diff --git a/components/cluster/command/scale_out.go b/components/cluster/command/scale_out.go index 8a67a0b8a3..a01108bcde 100644 --- a/components/cluster/command/scale_out.go +++ b/components/cluster/command/scale_out.go @@ -44,6 +44,7 @@ func newScaleOutCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) topoFile := args[1] diff --git a/components/cluster/command/start.go b/components/cluster/command/start.go index 43c5c8ef8c..a407c93e15 100644 --- a/components/cluster/command/start.go +++ b/components/cluster/command/start.go @@ -33,6 +33,7 @@ func newStartCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.StartCluster(clusterName, gOpt, func(b *task.Builder, metadata spec.Metadata) { diff --git a/components/cluster/command/stop.go b/components/cluster/command/stop.go index b38d81282b..ccf9b88f05 100644 --- a/components/cluster/command/stop.go +++ b/components/cluster/command/stop.go @@ -31,6 +31,7 @@ func newStopCmd() *cobra.Command { } clusterName := args[0] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.StopCluster(clusterName, gOpt) diff --git a/components/cluster/command/transfer.go b/components/cluster/command/transfer.go index edd8849228..3ced0e4da4 100644 --- a/components/cluster/command/transfer.go +++ b/components/cluster/command/transfer.go @@ -39,6 +39,7 @@ func newPullCmd() *cobra.Command { clusterName := args[0] opt.Remote = args[1] opt.Local = args[2] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.Transfer(clusterName, opt, gOpt) @@ -65,6 +66,7 @@ func newPushCmd() *cobra.Command { clusterName := args[0] opt.Local = args[1] opt.Remote = args[2] + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) return cm.Transfer(clusterName, opt, gOpt) diff --git a/components/cluster/command/upgrade.go b/components/cluster/command/upgrade.go index afc5cf1d83..76d76f76ac 100644 --- a/components/cluster/command/upgrade.go +++ b/components/cluster/command/upgrade.go @@ -34,6 +34,7 @@ func newUpgradeCmd() *cobra.Command { if err != nil { return err } + clusterReport.ID = scrubClusterName(clusterName) teleCommand = append(teleCommand, scrubClusterName(clusterName)) teleCommand = append(teleCommand, version) diff --git a/pkg/cluster/flags/debug.go b/pkg/cluster/flags/debug.go index a6f0fdb5be..286b7c068c 100644 --- a/pkg/cluster/flags/debug.go +++ b/pkg/cluster/flags/debug.go @@ -26,5 +26,5 @@ var ( func init() { val := os.Getenv(localdata.EnvNameDebug) - DebugMode = val == "enable" || val == "enabled" + DebugMode = (val == "enable" || val == "enabled" || val == "true") } diff --git a/pkg/cluster/report/report.go b/pkg/cluster/report/report.go index 93611defdd..6cf852ddb1 100644 --- a/pkg/cluster/report/report.go +++ b/pkg/cluster/report/report.go @@ -16,24 +16,42 @@ package report import ( "bytes" "os" + "runtime" "github.com/gogo/protobuf/proto" "github.com/pingcap/tiup/pkg/localdata" tiuptele "github.com/pingcap/tiup/pkg/telemetry" + "github.com/pingcap/tiup/pkg/version" ) -// Enable return true if we enable telemetry. -func Enable() bool { +// Enabled return true if we enable telemetry. +func Enabled() bool { s := os.Getenv(localdata.EnvNameTelemetryStatus) status := tiuptele.Status(s) return status == tiuptele.EnableStatus } -// UUID return telemetry uuid. -func UUID() string { +// TelemetryUUID return telemetry uuid. +func TelemetryUUID() string { return os.Getenv(localdata.EnvNameTelemetryUUID) } +// TelemetrySecret return telemetry uuid. +func TelemetrySecret() string { + return os.Getenv(localdata.EnvNameTelemetrySecret) +} + +// TiUPMeta returns metadata of TiUP Cluster itself +func TiUPMeta() *tiuptele.TiUPInfo { + return &tiuptele.TiUPInfo{ + TiUPVersion: os.Getenv(localdata.EnvNameTiUPVersion), + ComponentVersion: version.NewTiUPVersion().SemVer(), + GitCommit: version.NewTiUPBuildInfo().GitHash, + Os: runtime.GOOS, + Arch: runtime.GOARCH, + } +} + // NodeInfoFromText get telemetry.NodeInfo from the text. func NodeInfoFromText(text string) (info *tiuptele.NodeInfo, err error) { info = new(tiuptele.NodeInfo) diff --git a/pkg/cluster/spec/validate.go b/pkg/cluster/spec/validate.go index ad12d76e45..3bdd7bfd15 100644 --- a/pkg/cluster/spec/validate.go +++ b/pkg/cluster/spec/validate.go @@ -944,40 +944,22 @@ func (s *Specification) validateTiFlashConfigs() error { // Validate validates the topology specification and produce error if the // specification invalid (e.g: port conflicts or directory conflicts) func (s *Specification) Validate() error { - if err := s.validateTLSEnabled(); err != nil { - return err - } - - if err := s.platformConflictsDetect(); err != nil { - return err - } - - if err := s.portInvalidDetect(); err != nil { - return err - } - - if err := s.portConflictsDetect(); err != nil { - return err - } - - if err := s.dirConflictsDetect(); err != nil { - return err - } - - if err := s.validateTiSparkSpec(); err != nil { - return err - } - - if err := s.validateUserGroup(); err != nil { - return err - } - - if err := s.validatePDNames(); err != nil { - return err - } - - if err := s.validateTiFlashConfigs(); err != nil { - return err + validators := []func() error{ + s.validateTLSEnabled, + s.platformConflictsDetect, + s.portInvalidDetect, + s.portConflictsDetect, + s.dirConflictsDetect, + s.validateUserGroup, + s.validatePDNames, + s.validateTiSparkSpec, + s.validateTiFlashConfigs, + } + + for _, v := range validators { + if err := v(); err != nil { + return err + } } return RelativePathDetect(s, isSkipField) diff --git a/pkg/exec/run.go b/pkg/exec/run.go index 934fb26404..0c497550e7 100644 --- a/pkg/exec/run.go +++ b/pkg/exec/run.go @@ -32,6 +32,7 @@ import ( "github.com/pingcap/tiup/pkg/localdata" "github.com/pingcap/tiup/pkg/telemetry" "github.com/pingcap/tiup/pkg/utils" + "github.com/pingcap/tiup/pkg/version" "golang.org/x/mod/semver" ) @@ -215,11 +216,13 @@ func PrepareCommand(p *PrepareCommandParams) (*exec.Cmd, error) { fmt.Sprintf("%s=%s", localdata.EnvNameHome, profile.Root()), fmt.Sprintf("%s=%s", localdata.EnvNameWorkDir, tiupWd), fmt.Sprintf("%s=%s", localdata.EnvNameUserInputVersion, p.Version.String()), + fmt.Sprintf("%s=%s", localdata.EnvNameTiUPVersion, version.NewTiUPVersion().SemVer()), fmt.Sprintf("%s=%s", localdata.EnvNameInstanceDataDir, p.InstanceDir), fmt.Sprintf("%s=%s", localdata.EnvNameComponentDataDir, sd), fmt.Sprintf("%s=%s", localdata.EnvNameComponentInstallDir, installPath), fmt.Sprintf("%s=%s", localdata.EnvNameTelemetryStatus, teleMeta.Status), fmt.Sprintf("%s=%s", localdata.EnvNameTelemetryUUID, teleMeta.UUID), + fmt.Sprintf("%s=%s", localdata.EnvNameTelemetrySecret, teleMeta.Secret), fmt.Sprintf("%s=%s", localdata.EnvTag, p.Tag), } envs = append(envs, os.Environ()...) diff --git a/pkg/localdata/constant.go b/pkg/localdata/constant.go index 0caab925b7..7167d71c8e 100644 --- a/pkg/localdata/constant.go +++ b/pkg/localdata/constant.go @@ -60,6 +60,9 @@ const ( // EnvNameUserInputVersion represents the version user specified when running a component by `tiup component:version` EnvNameUserInputVersion = "TIUP_USER_INPUT_VERSION" + // EnvNameTiUPVersion represents the version of TiUP itself, not the version of component + EnvNameTiUPVersion = "TIUP_VERSION" + // EnvNameHome represents the environment name of tiup home directory EnvNameHome = "TIUP_HOME" @@ -69,6 +72,9 @@ const ( // EnvNameTelemetryUUID represents the environment name of tiup telemetry uuid EnvNameTelemetryUUID = "TIUP_TELEMETRY_UUID" + // EnvNameTelemetrySecret represents the environment name of tiup telemetry secret + EnvNameTelemetrySecret = "TIUP_TELEMETRY_SECRET" + // EnvTag is the tag of the running component EnvTag = "TIUP_TAG" diff --git a/pkg/telemetry/generate.sh b/pkg/telemetry/generate.sh index 25d54a7199..bdb3f24e2c 100755 --- a/pkg/telemetry/generate.sh +++ b/pkg/telemetry/generate.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash echo "generate code by proto..." -GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf +#GOGO_ROOT=${GOPATH}/src/github.com/gogo/protobuf +GOGO_ROOT=${GOPATH}/pkg/mod/github.com/gogo/protobuf@v1.3.2 protoc -I.:${GOGO_ROOT}:${GOGO_ROOT}/protobuf --gofast_out=./ report.proto sed -i.bak -E 's/import _ \"gogoproto\"//g' *.pb.go sed -i.bak -E 's/import fmt \"fmt\"//g' *.pb.go diff --git a/pkg/telemetry/meta.go b/pkg/telemetry/meta.go index 0377169945..5d6447c891 100644 --- a/pkg/telemetry/meta.go +++ b/pkg/telemetry/meta.go @@ -14,6 +14,7 @@ package telemetry import ( + "fmt" "os" "path/filepath" @@ -21,6 +22,7 @@ import ( "github.com/pingcap/errors" "github.com/pingcap/tiup/pkg/environment" "github.com/pingcap/tiup/pkg/localdata" + "github.com/pingcap/tiup/pkg/utils/rand" "gopkg.in/yaml.v2" ) @@ -40,6 +42,7 @@ const defaultStatus = EnableStatus // Meta data of telemetry. type Meta struct { UUID string `yaml:"uuid,omitempty"` + Secret string `yaml:"secret,omitempty"` Status Status `yaml:"status,omitempty"` } @@ -48,10 +51,21 @@ func NewUUID() string { return uuid.New().String() } +// NewSecret generates a new random string as encryption secret +func NewSecret() string { + rbytes := make([]byte, 16) + _, err := rand.Read(rbytes) + if err != nil { + return NewUUID() + } + return fmt.Sprintf("%x", rbytes) +} + // NewMeta create a new default Meta. func NewMeta() *Meta { return &Meta{ UUID: NewUUID(), + Secret: NewSecret(), Status: EnableStatus, } } @@ -73,6 +87,20 @@ func LoadFrom(fname string) (meta *Meta, err error) { meta = new(Meta) err = yaml.Unmarshal(data, meta) + // populate UUID and secret if not set + var updated bool + if meta.UUID == "" { + meta.UUID = NewUUID() + updated = true + } + if meta.Secret == "" { + meta.Secret = NewSecret() + updated = true + } + if updated { + err = meta.SaveTo(fname) + } + return } diff --git a/pkg/telemetry/report.pb.go b/pkg/telemetry/report.pb.go index 2f8c636d6c..50932af350 100644 --- a/pkg/telemetry/report.pb.go +++ b/pkg/telemetry/report.pb.go @@ -1,33 +1,17 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: report.proto -/* - Package telemetry is a generated protocol buffer package. - - It is generated from these files: - report.proto - - It has these top-level messages: - Report - ClusterReport - NodeInfo - CPUInfo - HardwareInfo - OSInfo - MemInfo -*/ package telemetry import ( - "fmt" - - proto "github.com/golang/protobuf/proto" - - math "math" - encoding_binary "encoding/binary" - + fmt "fmt" io "io" + math "math" + math_bits "math/bits" + + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -39,20 +23,53 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Report struct { - EventUUID string `protobuf:"bytes,1,opt,name=eventUUID,proto3" json:"eventUUID,omitempty"` - EventUnixTimestamp int64 `protobuf:"varint,2,opt,name=event_unix_timestamp,json=eventUnixTimestamp,proto3" json:"event_unix_timestamp,omitempty"` + InstallationUUID string `protobuf:"bytes,1,opt,name=installationUUID,proto3" json:"installationUUID,omitempty"` + EventUUID string `protobuf:"bytes,2,opt,name=eventUUID,proto3" json:"eventUUID,omitempty"` + EventUnixTimestamp int64 `protobuf:"varint,3,opt,name=event_unix_timestamp,json=eventUnixTimestamp,proto3" json:"event_unix_timestamp,omitempty"` // Types that are valid to be assigned to EventDetail: // *Report_Cluster - EventDetail isReport_EventDetail `protobuf_oneof:"event_detail"` + EventDetail isReport_EventDetail `protobuf_oneof:"event_detail"` + Tiup *TiUPInfo `protobuf:"bytes,5,opt,name=tiup,proto3" json:"tiup,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Report) Reset() { *m = Report{} } +func (m *Report) String() string { return proto.CompactTextString(m) } +func (*Report) ProtoMessage() {} +func (*Report) Descriptor() ([]byte, []int) { + return fileDescriptor_3eedb623aa6ca98c, []int{0} +} +func (m *Report) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Report) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Report.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Report) XXX_Merge(src proto.Message) { + xxx_messageInfo_Report.Merge(m, src) +} +func (m *Report) XXX_Size() int { + return m.Size() +} +func (m *Report) XXX_DiscardUnknown() { + xxx_messageInfo_Report.DiscardUnknown(m) } -func (m *Report) Reset() { *m = Report{} } -func (m *Report) String() string { return proto.CompactTextString(m) } -func (*Report) ProtoMessage() {} -func (*Report) Descriptor() ([]byte, []int) { return fileDescriptorReport, []int{0} } +var xxx_messageInfo_Report proto.InternalMessageInfo type isReport_EventDetail interface { isReport_EventDetail() @@ -61,7 +78,7 @@ type isReport_EventDetail interface { } type Report_Cluster struct { - Cluster *ClusterReport `protobuf:"bytes,3,opt,name=cluster,oneof"` + Cluster *ClusterReport `protobuf:"bytes,4,opt,name=cluster,proto3,oneof" json:"cluster,omitempty"` } func (*Report_Cluster) isReport_EventDetail() {} @@ -73,6 +90,13 @@ func (m *Report) GetEventDetail() isReport_EventDetail { return nil } +func (m *Report) GetInstallationUUID() string { + if m != nil { + return m.InstallationUUID + } + return "" +} + func (m *Report) GetEventUUID() string { if m != nil { return m.EventUUID @@ -94,79 +118,69 @@ func (m *Report) GetCluster() *ClusterReport { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Report) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Report_OneofMarshaler, _Report_OneofUnmarshaler, _Report_OneofSizer, []interface{}{ - (*Report_Cluster)(nil), - } -} - -func _Report_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Report) - // event_detail - switch x := m.EventDetail.(type) { - case *Report_Cluster: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Cluster); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Report.EventDetail has unexpected type %T", x) +func (m *Report) GetTiup() *TiUPInfo { + if m != nil { + return m.Tiup } return nil } -func _Report_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Report) - switch tag { - case 3: // event_detail.cluster - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ClusterReport) - err := b.DecodeMessage(msg) - m.EventDetail = &Report_Cluster{msg} - return true, err - default: - return false, nil - } -} - -func _Report_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Report) - // event_detail - switch x := m.EventDetail.(type) { - case *Report_Cluster: - s := proto.Size(x.Cluster) - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Report) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Report_Cluster)(nil), } - return n } type ClusterReport struct { - UUID string `protobuf:"bytes,1,opt,name=UUID,proto3" json:"UUID,omitempty"` + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` TakeMilliseconds uint64 `protobuf:"varint,3,opt,name=take_milliseconds,json=takeMilliseconds,proto3" json:"take_milliseconds,omitempty"` ExitCode int32 `protobuf:"varint,4,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"` // only deploy and scale-out is setted: - Topology string `protobuf:"bytes,5,opt,name=topology,proto3" json:"topology,omitempty"` - Nodes []*NodeInfo `protobuf:"bytes,6,rep,name=nodes" json:"nodes,omitempty"` + Topology string `protobuf:"bytes,5,opt,name=topology,proto3" json:"topology,omitempty"` + Nodes []*NodeInfo `protobuf:"bytes,6,rep,name=nodes,proto3" json:"nodes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClusterReport) Reset() { *m = ClusterReport{} } +func (m *ClusterReport) String() string { return proto.CompactTextString(m) } +func (*ClusterReport) ProtoMessage() {} +func (*ClusterReport) Descriptor() ([]byte, []int) { + return fileDescriptor_3eedb623aa6ca98c, []int{1} +} +func (m *ClusterReport) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClusterReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClusterReport.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ClusterReport) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClusterReport.Merge(m, src) +} +func (m *ClusterReport) XXX_Size() int { + return m.Size() +} +func (m *ClusterReport) XXX_DiscardUnknown() { + xxx_messageInfo_ClusterReport.DiscardUnknown(m) } -func (m *ClusterReport) Reset() { *m = ClusterReport{} } -func (m *ClusterReport) String() string { return proto.CompactTextString(m) } -func (*ClusterReport) ProtoMessage() {} -func (*ClusterReport) Descriptor() ([]byte, []int) { return fileDescriptorReport, []int{1} } +var xxx_messageInfo_ClusterReport proto.InternalMessageInfo -func (m *ClusterReport) GetUUID() string { +func (m *ClusterReport) GetID() string { if m != nil { - return m.UUID + return m.ID } return "" } @@ -206,16 +220,126 @@ func (m *ClusterReport) GetNodes() []*NodeInfo { return nil } +type TiUPInfo struct { + TiUPVersion string `protobuf:"bytes,1,opt,name=TiUPVersion,proto3" json:"TiUPVersion,omitempty"` + ComponentVersion string `protobuf:"bytes,2,opt,name=ComponentVersion,proto3" json:"ComponentVersion,omitempty"` + GitCommit string `protobuf:"bytes,3,opt,name=GitCommit,proto3" json:"GitCommit,omitempty"` + Os string `protobuf:"bytes,4,opt,name=os,proto3" json:"os,omitempty"` + Arch string `protobuf:"bytes,5,opt,name=arch,proto3" json:"arch,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TiUPInfo) Reset() { *m = TiUPInfo{} } +func (m *TiUPInfo) String() string { return proto.CompactTextString(m) } +func (*TiUPInfo) ProtoMessage() {} +func (*TiUPInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_3eedb623aa6ca98c, []int{2} +} +func (m *TiUPInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TiUPInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TiUPInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TiUPInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TiUPInfo.Merge(m, src) +} +func (m *TiUPInfo) XXX_Size() int { + return m.Size() +} +func (m *TiUPInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TiUPInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TiUPInfo proto.InternalMessageInfo + +func (m *TiUPInfo) GetTiUPVersion() string { + if m != nil { + return m.TiUPVersion + } + return "" +} + +func (m *TiUPInfo) GetComponentVersion() string { + if m != nil { + return m.ComponentVersion + } + return "" +} + +func (m *TiUPInfo) GetGitCommit() string { + if m != nil { + return m.GitCommit + } + return "" +} + +func (m *TiUPInfo) GetOs() string { + if m != nil { + return m.Os + } + return "" +} + +func (m *TiUPInfo) GetArch() string { + if m != nil { + return m.Arch + } + return "" +} + type NodeInfo struct { - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Hardware HardwareInfo `protobuf:"bytes,6,opt,name=hardware" json:"hardware"` - Os OSInfo `protobuf:"bytes,7,opt,name=os" json:"os"` + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + Hardware HardwareInfo `protobuf:"bytes,6,opt,name=hardware,proto3" json:"hardware"` + Os OSInfo `protobuf:"bytes,7,opt,name=os,proto3" json:"os"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeInfo) Reset() { *m = NodeInfo{} } +func (m *NodeInfo) String() string { return proto.CompactTextString(m) } +func (*NodeInfo) ProtoMessage() {} +func (*NodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_3eedb623aa6ca98c, []int{3} +} +func (m *NodeInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NodeInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeInfo.Merge(m, src) +} +func (m *NodeInfo) XXX_Size() int { + return m.Size() +} +func (m *NodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_NodeInfo.DiscardUnknown(m) } -func (m *NodeInfo) Reset() { *m = NodeInfo{} } -func (m *NodeInfo) String() string { return proto.CompactTextString(m) } -func (*NodeInfo) ProtoMessage() {} -func (*NodeInfo) Descriptor() ([]byte, []int) { return fileDescriptorReport, []int{2} } +var xxx_messageInfo_NodeInfo proto.InternalMessageInfo func (m *NodeInfo) GetNodeId() string { if m != nil { @@ -239,18 +363,49 @@ func (m *NodeInfo) GetOs() OSInfo { } type CPUInfo struct { - Numcpu int32 `protobuf:"varint,1,opt,name=numcpu,proto3" json:"numcpu,omitempty"` - Sockets int32 `protobuf:"varint,2,opt,name=sockets,proto3" json:"sockets,omitempty"` - Cores int32 `protobuf:"varint,3,opt,name=cores,proto3" json:"cores,omitempty"` - Model string `protobuf:"bytes,4,opt,name=model,proto3" json:"model,omitempty"` - Mhz float32 `protobuf:"fixed32,5,opt,name=mhz,proto3" json:"mhz,omitempty"` - Features []string `protobuf:"bytes,6,rep,name=features" json:"features,omitempty"` + Numcpu int32 `protobuf:"varint,1,opt,name=numcpu,proto3" json:"numcpu,omitempty"` + Sockets int32 `protobuf:"varint,2,opt,name=sockets,proto3" json:"sockets,omitempty"` + Cores int32 `protobuf:"varint,3,opt,name=cores,proto3" json:"cores,omitempty"` + Model string `protobuf:"bytes,4,opt,name=model,proto3" json:"model,omitempty"` + Mhz float32 `protobuf:"fixed32,5,opt,name=mhz,proto3" json:"mhz,omitempty"` + Features []string `protobuf:"bytes,6,rep,name=features,proto3" json:"features,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CPUInfo) Reset() { *m = CPUInfo{} } +func (m *CPUInfo) String() string { return proto.CompactTextString(m) } +func (*CPUInfo) ProtoMessage() {} +func (*CPUInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_3eedb623aa6ca98c, []int{4} +} +func (m *CPUInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CPUInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CPUInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CPUInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_CPUInfo.Merge(m, src) +} +func (m *CPUInfo) XXX_Size() int { + return m.Size() +} +func (m *CPUInfo) XXX_DiscardUnknown() { + xxx_messageInfo_CPUInfo.DiscardUnknown(m) } -func (m *CPUInfo) Reset() { *m = CPUInfo{} } -func (m *CPUInfo) String() string { return proto.CompactTextString(m) } -func (*CPUInfo) ProtoMessage() {} -func (*CPUInfo) Descriptor() ([]byte, []int) { return fileDescriptorReport, []int{3} } +var xxx_messageInfo_CPUInfo proto.InternalMessageInfo func (m *CPUInfo) GetNumcpu() int32 { if m != nil { @@ -295,16 +450,47 @@ func (m *CPUInfo) GetFeatures() []string { } type HardwareInfo struct { - Virtualization string `protobuf:"bytes,1,opt,name=virtualization,proto3" json:"virtualization,omitempty"` - Cpu CPUInfo `protobuf:"bytes,2,opt,name=cpu" json:"cpu"` - Mem MemInfo `protobuf:"bytes,3,opt,name=mem" json:"mem"` - Loadavg15 float32 `protobuf:"fixed32,4,opt,name=loadavg15,proto3" json:"loadavg15,omitempty"` + Virtualization string `protobuf:"bytes,1,opt,name=virtualization,proto3" json:"virtualization,omitempty"` + Cpu CPUInfo `protobuf:"bytes,2,opt,name=cpu,proto3" json:"cpu"` + Mem MemInfo `protobuf:"bytes,3,opt,name=mem,proto3" json:"mem"` + Loadavg15 float32 `protobuf:"fixed32,4,opt,name=loadavg15,proto3" json:"loadavg15,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HardwareInfo) Reset() { *m = HardwareInfo{} } +func (m *HardwareInfo) String() string { return proto.CompactTextString(m) } +func (*HardwareInfo) ProtoMessage() {} +func (*HardwareInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_3eedb623aa6ca98c, []int{5} +} +func (m *HardwareInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HardwareInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HardwareInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HardwareInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_HardwareInfo.Merge(m, src) +} +func (m *HardwareInfo) XXX_Size() int { + return m.Size() +} +func (m *HardwareInfo) XXX_DiscardUnknown() { + xxx_messageInfo_HardwareInfo.DiscardUnknown(m) } -func (m *HardwareInfo) Reset() { *m = HardwareInfo{} } -func (m *HardwareInfo) String() string { return proto.CompactTextString(m) } -func (*HardwareInfo) ProtoMessage() {} -func (*HardwareInfo) Descriptor() ([]byte, []int) { return fileDescriptorReport, []int{4} } +var xxx_messageInfo_HardwareInfo proto.InternalMessageInfo func (m *HardwareInfo) GetVirtualization() string { if m != nil { @@ -335,15 +521,46 @@ func (m *HardwareInfo) GetLoadavg15() float32 { } type OSInfo struct { - Family string `protobuf:"bytes,1,opt,name=family,proto3" json:"family,omitempty"` - Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Family string `protobuf:"bytes,1,opt,name=family,proto3" json:"family,omitempty"` + Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OSInfo) Reset() { *m = OSInfo{} } +func (m *OSInfo) String() string { return proto.CompactTextString(m) } +func (*OSInfo) ProtoMessage() {} +func (*OSInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_3eedb623aa6ca98c, []int{6} +} +func (m *OSInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OSInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OSInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OSInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_OSInfo.Merge(m, src) +} +func (m *OSInfo) XXX_Size() int { + return m.Size() +} +func (m *OSInfo) XXX_DiscardUnknown() { + xxx_messageInfo_OSInfo.DiscardUnknown(m) } -func (m *OSInfo) Reset() { *m = OSInfo{} } -func (m *OSInfo) String() string { return proto.CompactTextString(m) } -func (*OSInfo) ProtoMessage() {} -func (*OSInfo) Descriptor() ([]byte, []int) { return fileDescriptorReport, []int{5} } +var xxx_messageInfo_OSInfo proto.InternalMessageInfo func (m *OSInfo) GetFamily() string { if m != nil { @@ -367,14 +584,45 @@ func (m *OSInfo) GetVersion() string { } type MemInfo struct { - Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` - Available uint64 `protobuf:"varint,2,opt,name=available,proto3" json:"available,omitempty"` + Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + Available uint64 `protobuf:"varint,2,opt,name=available,proto3" json:"available,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemInfo) Reset() { *m = MemInfo{} } +func (m *MemInfo) String() string { return proto.CompactTextString(m) } +func (*MemInfo) ProtoMessage() {} +func (*MemInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_3eedb623aa6ca98c, []int{7} +} +func (m *MemInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemInfo.Merge(m, src) +} +func (m *MemInfo) XXX_Size() int { + return m.Size() +} +func (m *MemInfo) XXX_DiscardUnknown() { + xxx_messageInfo_MemInfo.DiscardUnknown(m) } -func (m *MemInfo) Reset() { *m = MemInfo{} } -func (m *MemInfo) String() string { return proto.CompactTextString(m) } -func (*MemInfo) ProtoMessage() {} -func (*MemInfo) Descriptor() ([]byte, []int) { return fileDescriptorReport, []int{6} } +var xxx_messageInfo_MemInfo proto.InternalMessageInfo func (m *MemInfo) GetTotal() uint64 { if m != nil { @@ -393,16 +641,68 @@ func (m *MemInfo) GetAvailable() uint64 { func init() { proto.RegisterType((*Report)(nil), "telemetry.Report") proto.RegisterType((*ClusterReport)(nil), "telemetry.ClusterReport") + proto.RegisterType((*TiUPInfo)(nil), "telemetry.TiUPInfo") proto.RegisterType((*NodeInfo)(nil), "telemetry.NodeInfo") proto.RegisterType((*CPUInfo)(nil), "telemetry.CPUInfo") proto.RegisterType((*HardwareInfo)(nil), "telemetry.HardwareInfo") proto.RegisterType((*OSInfo)(nil), "telemetry.OSInfo") proto.RegisterType((*MemInfo)(nil), "telemetry.MemInfo") } + +func init() { proto.RegisterFile("report.proto", fileDescriptor_3eedb623aa6ca98c) } + +var fileDescriptor_3eedb623aa6ca98c = []byte{ + // 704 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x94, 0xcf, 0x4e, 0xdb, 0x4a, + 0x14, 0xc6, 0xb1, 0x93, 0x38, 0xf1, 0x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, 0xb1, 0x94, 0x25, + 0xbb, 0x36, 0x69, 0xaf, 0xa0, 0xc2, 0x84, 0xbf, 0xed, 0x3d, 0xa4, 0xa2, 0xee, 0x15, 0x54, 0xe8, + 0xa1, 0x73, 0x49, 0x62, 0x32, 0x9b, 0x3e, 0x7d, 0x69, 0xc0, 0x5c, 0xbc, 0x28, 0x84, 0x27, 0xe0, + 0xd9, 0xd6, 0xea, 0x26, 0x4e, 0x88, 0x60, 0xfc, 0xb2, 0x1a, 0xa6, 0x55, 0x1a, 0x36, 0xe5, 0x44, + 0x4d, 0x64, 0x26, 0xca, 0x87, 0x35, 0xd7, 0xba, 0xc1, 0xb3, 0xf2, 0xcd, 0xd9, 0xe7, 0x54, 0xc9, + 0xf0, 0x35, 0xb4, 0xcb, 0x2c, 0xba, 0xab, 0x4a, 0x2a, 0xc2, 0xcd, 0xbd, 0x4d, 0x6c, 0x85, 0x8e, + 0x45, 0x66, 0x84, 0x71, 0x72, 0xca, 0xa9, 0xb9, 0xb7, 0x89, 0x17, 0x85, 0xbd, 0xee, 0xf5, 0x4d, + 0xcf, 0xf9, 0x7e, 0xd3, 0x73, 0x7e, 0xde, 0xf4, 0x9c, 0xcf, 0xbf, 0x7a, 0x4b, 0xa7, 0x9e, 0xf9, + 0xc1, 0x3d, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0xd0, 0x2b, 0xff, 0x4c, 0x11, 0x05, 0x00, 0x00, +} + func (m *Report) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -410,49 +710,87 @@ func (m *Report) Marshal() (dAtA []byte, err error) { } func (m *Report) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Report) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.EventUUID) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.EventUUID))) - i += copy(dAtA[i:], m.EventUUID) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.EventUnixTimestamp != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintReport(dAtA, i, uint64(m.EventUnixTimestamp)) + if m.Tiup != nil { + { + size, err := m.Tiup.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReport(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a } if m.EventDetail != nil { - nn1, err := m.EventDetail.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size := m.EventDetail.Size() + i -= size + if _, err := m.EventDetail.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } } - i += nn1 } - return i, nil + if m.EventUnixTimestamp != 0 { + i = encodeVarintReport(dAtA, i, uint64(m.EventUnixTimestamp)) + i-- + dAtA[i] = 0x18 + } + if len(m.EventUUID) > 0 { + i -= len(m.EventUUID) + copy(dAtA[i:], m.EventUUID) + i = encodeVarintReport(dAtA, i, uint64(len(m.EventUUID))) + i-- + dAtA[i] = 0x12 + } + if len(m.InstallationUUID) > 0 { + i -= len(m.InstallationUUID) + copy(dAtA[i:], m.InstallationUUID) + i = encodeVarintReport(dAtA, i, uint64(len(m.InstallationUUID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Report_Cluster) MarshalTo(dAtA []byte) (int, error) { - i := 0 + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Report_Cluster) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Cluster != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Cluster.Size())) - n2, err := m.Cluster.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Cluster.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReport(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x22 } - return i, nil + return len(dAtA) - i, nil } func (m *ClusterReport) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -460,203 +798,311 @@ func (m *ClusterReport) Marshal() (dAtA []byte, err error) { } func (m *ClusterReport) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClusterReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.UUID) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.UUID))) - i += copy(dAtA[i:], m.UUID) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.Command) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.Command))) - i += copy(dAtA[i:], m.Command) + if len(m.Nodes) > 0 { + for iNdEx := len(m.Nodes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Nodes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReport(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } } - if m.TakeMilliseconds != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintReport(dAtA, i, uint64(m.TakeMilliseconds)) + if len(m.Topology) > 0 { + i -= len(m.Topology) + copy(dAtA[i:], m.Topology) + i = encodeVarintReport(dAtA, i, uint64(len(m.Topology))) + i-- + dAtA[i] = 0x2a } if m.ExitCode != 0 { - dAtA[i] = 0x20 - i++ i = encodeVarintReport(dAtA, i, uint64(m.ExitCode)) + i-- + dAtA[i] = 0x20 } - if len(m.Topology) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.Topology))) - i += copy(dAtA[i:], m.Topology) + if m.TakeMilliseconds != 0 { + i = encodeVarintReport(dAtA, i, uint64(m.TakeMilliseconds)) + i-- + dAtA[i] = 0x18 } - if len(m.Nodes) > 0 { - for _, msg := range m.Nodes { - dAtA[i] = 0x32 - i++ - i = encodeVarintReport(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if len(m.Command) > 0 { + i -= len(m.Command) + copy(dAtA[i:], m.Command) + i = encodeVarintReport(dAtA, i, uint64(len(m.Command))) + i-- + dAtA[i] = 0x12 + } + if len(m.ID) > 0 { + i -= len(m.ID) + copy(dAtA[i:], m.ID) + i = encodeVarintReport(dAtA, i, uint64(len(m.ID))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } -func (m *NodeInfo) Marshal() (dAtA []byte, err error) { +func (m *TiUPInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } -func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { - var i int +func (m *TiUPInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TiUPInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.NodeId) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.NodeId))) - i += copy(dAtA[i:], m.NodeId) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Arch) > 0 { + i -= len(m.Arch) + copy(dAtA[i:], m.Arch) + i = encodeVarintReport(dAtA, i, uint64(len(m.Arch))) + i-- + dAtA[i] = 0x2a } - dAtA[i] = 0x32 - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Hardware.Size())) - n3, err := m.Hardware.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Os) > 0 { + i -= len(m.Os) + copy(dAtA[i:], m.Os) + i = encodeVarintReport(dAtA, i, uint64(len(m.Os))) + i-- + dAtA[i] = 0x22 } - i += n3 - dAtA[i] = 0x3a - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Os.Size())) - n4, err := m.Os.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.GitCommit) > 0 { + i -= len(m.GitCommit) + copy(dAtA[i:], m.GitCommit) + i = encodeVarintReport(dAtA, i, uint64(len(m.GitCommit))) + i-- + dAtA[i] = 0x1a + } + if len(m.ComponentVersion) > 0 { + i -= len(m.ComponentVersion) + copy(dAtA[i:], m.ComponentVersion) + i = encodeVarintReport(dAtA, i, uint64(len(m.ComponentVersion))) + i-- + dAtA[i] = 0x12 + } + if len(m.TiUPVersion) > 0 { + i -= len(m.TiUPVersion) + copy(dAtA[i:], m.TiUPVersion) + i = encodeVarintReport(dAtA, i, uint64(len(m.TiUPVersion))) + i-- + dAtA[i] = 0xa } - i += n4 - return i, nil + return len(dAtA) - i, nil } -func (m *CPUInfo) Marshal() (dAtA []byte, err error) { +func (m *NodeInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } -func (m *CPUInfo) MarshalTo(dAtA []byte) (int, error) { - var i int +func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Numcpu != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Numcpu)) - } - if m.Sockets != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Sockets)) - } - if m.Cores != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Cores)) - } - if len(m.Model) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.Model))) - i += copy(dAtA[i:], m.Model) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - if m.Mhz != 0 { - dAtA[i] = 0x2d - i++ - encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Mhz)))) - i += 4 + { + size, err := m.Os.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReport(dAtA, i, uint64(size)) } - if len(m.Features) > 0 { - for _, s := range m.Features { - dAtA[i] = 0x32 - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) + i-- + dAtA[i] = 0x3a + { + size, err := m.Hardware.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintReport(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + if len(m.NodeId) > 0 { + i -= len(m.NodeId) + copy(dAtA[i:], m.NodeId) + i = encodeVarintReport(dAtA, i, uint64(len(m.NodeId))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } -func (m *HardwareInfo) Marshal() (dAtA []byte, err error) { +func (m *CPUInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } -func (m *HardwareInfo) MarshalTo(dAtA []byte) (int, error) { - var i int +func (m *CPUInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CPUInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Virtualization) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.Virtualization))) - i += copy(dAtA[i:], m.Virtualization) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x12 - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Cpu.Size())) - n5, err := m.Cpu.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(m.Features) > 0 { + for iNdEx := len(m.Features) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Features[iNdEx]) + copy(dAtA[i:], m.Features[iNdEx]) + i = encodeVarintReport(dAtA, i, uint64(len(m.Features[iNdEx]))) + i-- + dAtA[i] = 0x32 + } } - i += n5 - dAtA[i] = 0x1a - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Mem.Size())) - n6, err := m.Mem.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.Mhz != 0 { + i -= 4 + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Mhz)))) + i-- + dAtA[i] = 0x2d + } + if len(m.Model) > 0 { + i -= len(m.Model) + copy(dAtA[i:], m.Model) + i = encodeVarintReport(dAtA, i, uint64(len(m.Model))) + i-- + dAtA[i] = 0x22 + } + if m.Cores != 0 { + i = encodeVarintReport(dAtA, i, uint64(m.Cores)) + i-- + dAtA[i] = 0x18 + } + if m.Sockets != 0 { + i = encodeVarintReport(dAtA, i, uint64(m.Sockets)) + i-- + dAtA[i] = 0x10 + } + if m.Numcpu != 0 { + i = encodeVarintReport(dAtA, i, uint64(m.Numcpu)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *HardwareInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HardwareInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HardwareInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i += n6 if m.Loadavg15 != 0 { - dAtA[i] = 0x25 - i++ + i -= 4 encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.Loadavg15)))) - i += 4 + i-- + dAtA[i] = 0x25 + } + { + size, err := m.Mem.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReport(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Cpu.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReport(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Virtualization) > 0 { + i -= len(m.Virtualization) + copy(dAtA[i:], m.Virtualization) + i = encodeVarintReport(dAtA, i, uint64(len(m.Virtualization))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *OSInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -664,35 +1110,47 @@ func (m *OSInfo) Marshal() (dAtA []byte, err error) { } func (m *OSInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OSInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Family) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.Family))) - i += copy(dAtA[i:], m.Family) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintReport(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x1a } if len(m.Platform) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Platform) + copy(dAtA[i:], m.Platform) i = encodeVarintReport(dAtA, i, uint64(len(m.Platform))) - i += copy(dAtA[i:], m.Platform) + i-- + dAtA[i] = 0x12 } - if len(m.Version) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintReport(dAtA, i, uint64(len(m.Version))) - i += copy(dAtA[i:], m.Version) + if len(m.Family) > 0 { + i -= len(m.Family) + copy(dAtA[i:], m.Family) + i = encodeVarintReport(dAtA, i, uint64(len(m.Family))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *MemInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -700,35 +1158,53 @@ func (m *MemInfo) Marshal() (dAtA []byte, err error) { } func (m *MemInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MemInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Total != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintReport(dAtA, i, uint64(m.Total)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Available != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintReport(dAtA, i, uint64(m.Available)) + i-- + dAtA[i] = 0x10 } - return i, nil + if m.Total != 0 { + i = encodeVarintReport(dAtA, i, uint64(m.Total)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func encodeVarintReport(dAtA []byte, offset int, v uint64) int { + offset -= sovReport(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func (m *Report) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l + l = len(m.InstallationUUID) + if l > 0 { + n += 1 + l + sovReport(uint64(l)) + } l = len(m.EventUUID) if l > 0 { n += 1 + l + sovReport(uint64(l)) @@ -739,10 +1215,20 @@ func (m *Report) Size() (n int) { if m.EventDetail != nil { n += m.EventDetail.Size() } + if m.Tiup != nil { + l = m.Tiup.Size() + n += 1 + l + sovReport(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *Report_Cluster) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Cluster != nil { @@ -752,9 +1238,12 @@ func (m *Report_Cluster) Size() (n int) { return n } func (m *ClusterReport) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - l = len(m.UUID) + l = len(m.ID) if l > 0 { n += 1 + l + sovReport(uint64(l)) } @@ -778,10 +1267,48 @@ func (m *ClusterReport) Size() (n int) { n += 1 + l + sovReport(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TiUPInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TiUPVersion) + if l > 0 { + n += 1 + l + sovReport(uint64(l)) + } + l = len(m.ComponentVersion) + if l > 0 { + n += 1 + l + sovReport(uint64(l)) + } + l = len(m.GitCommit) + if l > 0 { + n += 1 + l + sovReport(uint64(l)) + } + l = len(m.Os) + if l > 0 { + n += 1 + l + sovReport(uint64(l)) + } + l = len(m.Arch) + if l > 0 { + n += 1 + l + sovReport(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *NodeInfo) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.NodeId) @@ -792,10 +1319,16 @@ func (m *NodeInfo) Size() (n int) { n += 1 + l + sovReport(uint64(l)) l = m.Os.Size() n += 1 + l + sovReport(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *CPUInfo) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Numcpu != 0 { @@ -820,10 +1353,16 @@ func (m *CPUInfo) Size() (n int) { n += 1 + l + sovReport(uint64(l)) } } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *HardwareInfo) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Virtualization) @@ -837,10 +1376,16 @@ func (m *HardwareInfo) Size() (n int) { if m.Loadavg15 != 0 { n += 5 } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *OSInfo) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = len(m.Family) @@ -855,10 +1400,16 @@ func (m *OSInfo) Size() (n int) { if l > 0 { n += 1 + l + sovReport(uint64(l)) } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } return n } func (m *MemInfo) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l if m.Total != 0 { @@ -867,23 +1418,224 @@ func (m *MemInfo) Size() (n int) { if m.Available != 0 { n += 1 + sovReport(uint64(m.Available)) } - return n -} + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovReport(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozReport(x uint64) (n int) { + return sovReport(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Report) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Report: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Report: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InstallationUUID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthReport + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InstallationUUID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EventUUID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthReport + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EventUUID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EventUnixTimestamp", wireType) + } + m.EventUnixTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EventUnixTimestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthReport + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReport + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ClusterReport{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.EventDetail = &Report_Cluster{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tiup", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthReport + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReport + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tiup == nil { + m.Tiup = &TiUPInfo{} + } + if err := m.Tiup.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipReport(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthReport + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } -func sovReport(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n -} -func sozReport(x uint64) (n int) { - return sovReport(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *Report) Unmarshal(dAtA []byte) error { +func (m *ClusterReport) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -898,7 +1650,7 @@ func (m *Report) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -906,15 +1658,15 @@ func (m *Report) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Report: wiretype end group for non-group") + return fmt.Errorf("proto: ClusterReport: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Report: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ClusterReport: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EventUUID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -926,7 +1678,7 @@ func (m *Report) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -936,16 +1688,19 @@ func (m *Report) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } - m.EventUUID = string(dAtA[iNdEx:postIndex]) + m.ID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EventUnixTimestamp", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) } - m.EventUnixTimestamp = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowReport @@ -955,14 +1710,97 @@ func (m *Report) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EventUnixTimestamp |= (int64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthReport + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Command = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TakeMilliseconds", wireType) + } + m.TakeMilliseconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TakeMilliseconds |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExitCode", wireType) + } + m.ExitCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExitCode |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cluster", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthReport + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topology = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nodes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -974,7 +1812,7 @@ func (m *Report) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -983,14 +1821,16 @@ func (m *Report) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } - v := &ClusterReport{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Nodes = append(m.Nodes, &NodeInfo{}) + if err := m.Nodes[len(m.Nodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.EventDetail = &Report_Cluster{v} iNdEx = postIndex default: iNdEx = preIndex @@ -998,12 +1838,13 @@ func (m *Report) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthReport } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1013,7 +1854,7 @@ func (m *Report) Unmarshal(dAtA []byte) error { } return nil } -func (m *ClusterReport) Unmarshal(dAtA []byte) error { +func (m *TiUPInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1028,7 +1869,7 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1036,15 +1877,15 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ClusterReport: wiretype end group for non-group") + return fmt.Errorf("proto: TiUPInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ClusterReport: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TiUPInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UUID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TiUPVersion", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1056,7 +1897,7 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1066,14 +1907,17 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } - m.UUID = string(dAtA[iNdEx:postIndex]) + m.TiUPVersion = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Command", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ComponentVersion", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1085,7 +1929,7 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1095,16 +1939,19 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Command = string(dAtA[iNdEx:postIndex]) + m.ComponentVersion = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TakeMilliseconds", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GitCommit", wireType) } - m.TakeMilliseconds = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowReport @@ -1114,33 +1961,27 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TakeMilliseconds |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExitCode", wireType) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthReport } - m.ExitCode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowReport - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExitCode |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport } - case 5: + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GitCommit = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Os", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1152,7 +1993,7 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1162,16 +2003,19 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } - m.Topology = string(dAtA[iNdEx:postIndex]) + m.Os = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nodes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Arch", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowReport @@ -1181,22 +2025,23 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthReport + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { return ErrInvalidLengthReport } - postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - m.Nodes = append(m.Nodes, &NodeInfo{}) - if err := m.Nodes[len(m.Nodes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Arch = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1204,12 +2049,13 @@ func (m *ClusterReport) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthReport } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1234,7 +2080,7 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1262,7 +2108,7 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1272,6 +2118,9 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1291,7 +2140,7 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1300,6 +2149,9 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1321,7 +2173,7 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1330,6 +2182,9 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1343,12 +2198,13 @@ func (m *NodeInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthReport } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1373,7 +2229,7 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1401,7 +2257,7 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Numcpu |= (int32(b) & 0x7F) << shift + m.Numcpu |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -1420,7 +2276,7 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Sockets |= (int32(b) & 0x7F) << shift + m.Sockets |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -1439,7 +2295,7 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Cores |= (int32(b) & 0x7F) << shift + m.Cores |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -1458,7 +2314,7 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1468,6 +2324,9 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1498,7 +2357,7 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1508,6 +2367,9 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1519,12 +2381,13 @@ func (m *CPUInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthReport } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1549,7 +2412,7 @@ func (m *HardwareInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1577,7 +2440,7 @@ func (m *HardwareInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1587,6 +2450,9 @@ func (m *HardwareInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1606,7 +2472,7 @@ func (m *HardwareInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1615,6 +2481,9 @@ func (m *HardwareInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1636,7 +2505,7 @@ func (m *HardwareInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -1645,6 +2514,9 @@ func (m *HardwareInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1669,12 +2541,13 @@ func (m *HardwareInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthReport } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1699,7 +2572,7 @@ func (m *OSInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1727,7 +2600,7 @@ func (m *OSInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1737,6 +2610,9 @@ func (m *OSInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1756,7 +2632,7 @@ func (m *OSInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1766,6 +2642,9 @@ func (m *OSInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1785,7 +2664,7 @@ func (m *OSInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1795,6 +2674,9 @@ func (m *OSInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthReport } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthReport + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -1806,12 +2688,13 @@ func (m *OSInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthReport } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1836,7 +2719,7 @@ func (m *MemInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1864,7 +2747,7 @@ func (m *MemInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Total |= (uint64(b) & 0x7F) << shift + m.Total |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1883,7 +2766,7 @@ func (m *MemInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Available |= (uint64(b) & 0x7F) << shift + m.Available |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1894,12 +2777,13 @@ func (m *MemInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthReport } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -1912,6 +2796,7 @@ func (m *MemInfo) Unmarshal(dAtA []byte) error { func skipReport(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -1943,10 +2828,8 @@ func skipReport(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -1963,98 +2846,34 @@ func skipReport(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthReport } - return iNdEx, nil + iNdEx += length case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowReport - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipReport(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupReport + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthReport + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthReport = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowReport = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthReport = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowReport = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupReport = fmt.Errorf("proto: unexpected end of group") ) - -func init() { proto.RegisterFile("report.proto", fileDescriptorReport) } - -var fileDescriptorReport = []byte{ - // 610 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x53, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0x9e, 0xdb, 0x26, 0x6d, 0xfe, 0x8d, 0x69, 0x33, 0x13, 0x8b, 0x06, 0x2a, 0x55, 0x0e, 0x50, - 0x40, 0x1a, 0x30, 0xe0, 0xc0, 0x81, 0xcb, 0xc6, 0x61, 0x3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0x7d, 0xf2, 0xf5, 0x4f, 0x7f, 0xe9, 0x38, - 0x74, 0xbf, 0xfc, 0xb3, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x3b, 0x95, 0x25, 0x23, 0x04, - 0x00, 0x00, -} diff --git a/pkg/telemetry/report.proto b/pkg/telemetry/report.proto index 426fcfbaa9..f476dc3a2c 100644 --- a/pkg/telemetry/report.proto +++ b/pkg/telemetry/report.proto @@ -4,16 +4,18 @@ package telemetry; import "gogoproto/gogo.proto"; message Report { - string eventUUID = 1; - int64 event_unix_timestamp = 2; // unix time second + string installationUUID = 1; + string eventUUID = 2; + int64 event_unix_timestamp = 3; // unix time second oneof event_detail { - ClusterReport cluster = 3; + ClusterReport cluster = 4; } + TiUPInfo tiup = 5; } message ClusterReport { - string UUID = 1; + string ID = 1; string command = 2; uint64 take_milliseconds = 3; int32 exit_code = 4; @@ -23,6 +25,14 @@ message ClusterReport { repeated NodeInfo nodes = 6; } +message TiUPInfo { + string TiUPVersion = 1; + string ComponentVersion = 2; + string GitCommit = 3; + string os = 4; + string arch = 5; +} + message NodeInfo { string node_id = 1; HardwareInfo hardware = 6 [(gogoproto.nullable) = false]; diff --git a/pkg/telemetry/scrub.go b/pkg/telemetry/scrub.go index 61fcbe4558..e74e22edc8 100644 --- a/pkg/telemetry/scrub.go +++ b/pkg/telemetry/scrub.go @@ -18,6 +18,7 @@ import ( "fmt" "reflect" + "github.com/pingcap/tiup/pkg/set" "gopkg.in/yaml.v2" ) @@ -30,22 +31,36 @@ func HashReport(val string) string { return s } -// ScrubYaml scrub the value. -// for string type, replace as "_", unless the field name is in the hashFieldNames. -// for any other type set as the zero value of the according type. -func ScrubYaml(data []byte, hashFieldNames map[string]struct{}) (scrubed []byte, err error) { +// ScrubYaml scrub the values in yaml +func ScrubYaml( + data []byte, + hashFieldNames set.StringSet, + omitFieldNames set.StringSet, + salt string, +) (scrubed []byte, err error) { mp := make(map[interface{}]interface{}) err = yaml.Unmarshal(data, mp) if err != nil { return nil, err } - smp := scrupMap(mp, hashFieldNames, false).(map[string]interface{}) + smp := scrupMap(mp, hashFieldNames, omitFieldNames, false, false, salt).(map[string]interface{}) scrubed, err = yaml.Marshal(smp) return } -func scrupMap(val interface{}, hashFieldNames map[string]struct{}, hash bool) interface{} { +// scrupMap scrub the values in map +// for string type, replace as "_" if the field is in the omit list, +// for any other type set as the zero value of the according type if it's in the omit list. +// so configs are ended up with only keys reported, and all field values are hash masked +// or with zero values. +func scrupMap( + val interface{}, + hashFieldNames set.StringSet, + omitFieldNames set.StringSet, + hash, omit bool, + salt string, +) interface{} { if val == nil { return nil } @@ -58,27 +73,42 @@ func scrupMap(val interface{}, hashFieldNames map[string]struct{}, hash bool) in if !ok { return val } - _, hash = hashFieldNames[kk] - ret[kk] = scrupMap(v, hashFieldNames, hash) + khash := hash || hashFieldNames.Exist(kk) + komit := omit || omitFieldNames.Exist(kk) + ret[kk] = scrupMap(v, hashFieldNames, omitFieldNames, khash, komit, salt) } return ret } rv := reflect.ValueOf(val) - if rv.Kind() == reflect.Slice { + switch rv.Kind() { + case reflect.Slice: var ret []interface{} for i := 0; i < rv.Len(); i++ { - ret = append(ret, scrupMap(rv.Index(i).Interface(), hashFieldNames, false)) + ret = append(ret, + scrupMap(rv.Index(i).Interface(), hashFieldNames, omitFieldNames, hash, omit, salt)) } return ret - } - - if rv.Kind() == reflect.String { + case reflect.Map: + ret := make(map[string]interface{}) + iter := rv.MapRange() + for iter.Next() { + k := iter.Key().String() + v := iter.Value().Interface() + ret[k] = scrupMap(v, hashFieldNames, omitFieldNames, hash, omit, salt) + } + return ret + case reflect.String: if hash { - return HashReport(rv.String()) + return HashReport(salt + ":" + rv.String()) + } + if omit { + return "_" } - return "_" } - return reflect.Zero(rv.Type()).Interface() + if omit { + return reflect.Zero(rv.Type()).Interface() + } + return rv.Interface() } diff --git a/pkg/telemetry/scrub_test.go b/pkg/telemetry/scrub_test.go index 355f1a1d71..5d98b99bb9 100644 --- a/pkg/telemetry/scrub_test.go +++ b/pkg/telemetry/scrub_test.go @@ -19,6 +19,7 @@ import ( "strings" "github.com/pingcap/check" + "github.com/pingcap/tiup/pkg/set" ) type scrubSuite struct{} @@ -39,10 +40,21 @@ func (s *scrubSuite) testScrubYaml(c *check.C, generate bool) { data, err := os.ReadFile(filepath.Join("./testdata", f.Name())) c.Assert(err, check.IsNil) - hashs := make(map[string]struct{}) - hashs["host"] = struct{}{} + hashs := map[string]struct{}{ + "host": {}, + "name": {}, + "user": {}, + "group": {}, + "deploy_dir": {}, + "data_dir": {}, + "log_dir": {}, + } + omits := set.NewStringSet( + "config", + "server_configs", + ) - scrubed, err := ScrubYaml(data, hashs) + scrubed, err := ScrubYaml(data, hashs, omits, "dummy-salt-string") c.Assert(err, check.IsNil) outName := filepath.Join("./testdata", f.Name()+".out") @@ -68,8 +80,10 @@ func (s *scrubSuite) TestNilValueNotPanic(c *check.C) { hashs := make(map[string]struct{}) hashs["host"] = struct{}{} + omits := make(map[string]struct{}) + omits["config"] = struct{}{} - scrubed, err := ScrubYaml(data, hashs) + scrubed, err := ScrubYaml(data, hashs, omits, "dummy-salt-string") c.Assert(err, check.IsNil) var _ = scrubed diff --git a/pkg/telemetry/telemetry.go b/pkg/telemetry/telemetry.go index f75d4eecff..706a427d08 100644 --- a/pkg/telemetry/telemetry.go +++ b/pkg/telemetry/telemetry.go @@ -17,9 +17,10 @@ import ( "bytes" "context" "encoding/json" - "net/http" + "time" "github.com/pingcap/errors" + "github.com/pingcap/tiup/pkg/utils" ) var defaultURL = "https://telemetry.pingcap.com/api/v1/clusters/report" @@ -27,12 +28,12 @@ var defaultURL = "https://telemetry.pingcap.com/api/v1/clusters/report" // Telemetry control telemetry. type Telemetry struct { url string - cli *http.Client + cli *utils.HTTPClient } // NewTelemetry return a new Telemetry instance. func NewTelemetry() *Telemetry { - cli := new(http.Client) + cli := utils.NewHTTPClient(time.Second*10, nil) return &Telemetry{ url: defaultURL, @@ -47,22 +48,9 @@ func (t *Telemetry) Report(ctx context.Context, msg *Report) error { return errors.AddStack(err) } - req, err := http.NewRequestWithContext(ctx, "POST", t.url, bytes.NewReader(dst)) - if err != nil { + if _, err = t.cli.Post(t.url, bytes.NewReader(dst)); err != nil { return errors.AddStack(err) } - req.Header.Add("Content-Type", "application/json") - resp, err := t.cli.Do(req) - if err != nil { - return errors.AddStack(err) - } - defer resp.Body.Close() - - code := resp.StatusCode - if code < 200 || code >= 300 { - return errors.Errorf("StatusCode: %d, Status: %s", resp.StatusCode, resp.Status) - } - return nil } diff --git a/pkg/telemetry/telemetry_test.go b/pkg/telemetry/telemetry_test.go index f52b8b9dc9..14e32ad943 100644 --- a/pkg/telemetry/telemetry_test.go +++ b/pkg/telemetry/telemetry_test.go @@ -22,6 +22,7 @@ import ( "testing" "github.com/pingcap/check" + "github.com/pingcap/tiup/pkg/utils" ) func Test(t *testing.T) { check.TestingT(t) } @@ -55,7 +56,8 @@ func (s *TelemetrySuite) TestReport(c *check.C) { defer ts.Close() tele := NewTelemetry() - tele.cli = ts.Client() + tele.cli = &utils.HTTPClient{} + tele.cli.WithClient(ts.Client()) tele.url = ts.URL msg := new(Report) diff --git a/pkg/telemetry/testdata/full.yaml b/pkg/telemetry/testdata/full.yaml index 59b0bb5d1e..b219579dac 100644 --- a/pkg/telemetry/testdata/full.yaml +++ b/pkg/telemetry/testdata/full.yaml @@ -11,6 +11,7 @@ server_configs: tidb_servers: - host: 172.19.0.101 + arch: arm64 - host: 172.19.0.102 pd_servers: @@ -25,6 +26,8 @@ tikv_servers: - host: 172.19.0.103 data_dir: "/home/tidb/my_kv_data" - host: 172.19.0.104 + config: + server.labels: { zone: "us-west-1", disk: "ssd" } - host: 172.19.0.105 # tiflash eat too much memory diff --git a/pkg/telemetry/testdata/full.yaml.out b/pkg/telemetry/testdata/full.yaml.out index 797a2d0f5a..6f462db255 100644 --- a/pkg/telemetry/testdata/full.yaml.out +++ b/pkg/telemetry/testdata/full.yaml.out @@ -1,27 +1,27 @@ alertmanager_servers: -- host: 24b7e8f209cf3a8b43ca34f86a0858a0 +- host: badee9e1e6212d0c4f6bdc58e55198ca cdc_servers: -- host: d6b873c771bf523e6e46a3065dfa8bed -- host: 8b928279d5af90a9fc276e872a065372 -- host: 2e58f921c680e3adc7981a1e1823e416 +- host: 237459442b7b33b83cb17c7d8e28d1dc +- host: 9d04c2caf8519f98d6c2a8f4b134aed3 +- host: 744cabc99d81ff6a7b961bcd0bafaac4 drainer_servers: -- commit_ts: 0 +- commit_ts: -1 config: syncer.db-type: _ - data_dir: _ - host: 24b7e8f209cf3a8b43ca34f86a0858a0 + data_dir: d5fd212c212ed275cfbbe66dbd0fcfca + host: badee9e1e6212d0c4f6bdc58e55198ca grafana_servers: -- host: 24b7e8f209cf3a8b43ca34f86a0858a0 +- host: badee9e1e6212d0c4f6bdc58e55198ca monitoring_servers: -- host: 24b7e8f209cf3a8b43ca34f86a0858a0 +- host: badee9e1e6212d0c4f6bdc58e55198ca pd_servers: -- host: d6b873c771bf523e6e46a3065dfa8bed -- host: 8b928279d5af90a9fc276e872a065372 -- host: 2e58f921c680e3adc7981a1e1823e416 +- host: 237459442b7b33b83cb17c7d8e28d1dc +- host: 9d04c2caf8519f98d6c2a8f4b134aed3 +- host: 744cabc99d81ff6a7b961bcd0bafaac4 pump_servers: -- host: d6b873c771bf523e6e46a3065dfa8bed -- host: 8b928279d5af90a9fc276e872a065372 -- host: 2e58f921c680e3adc7981a1e1823e416 +- host: 237459442b7b33b83cb17c7d8e28d1dc +- host: 9d04c2caf8519f98d6c2a8f4b134aed3 +- host: 744cabc99d81ff6a7b961bcd0bafaac4 server_configs: pd: replication.enable-placement-rules: false @@ -33,13 +33,18 @@ server_configs: tikv: storage.reserve-space: _ tidb_servers: -- host: 24b7e8f209cf3a8b43ca34f86a0858a0 -- host: 785e9420afbfbfd0b9b2ea68e0406057 +- arch: arm64 + host: badee9e1e6212d0c4f6bdc58e55198ca +- host: 54ab9723ff45bb84558ba1e2582be534 tiflash_servers: -- host: d6b873c771bf523e6e46a3065dfa8bed +- host: 237459442b7b33b83cb17c7d8e28d1dc tikv_servers: -- host: 785e9420afbfbfd0b9b2ea68e0406057 -- data_dir: _ - host: d6b873c771bf523e6e46a3065dfa8bed -- host: 8b928279d5af90a9fc276e872a065372 -- host: 2e58f921c680e3adc7981a1e1823e416 +- host: 54ab9723ff45bb84558ba1e2582be534 +- data_dir: bc3cfc9f10c670d5781c2c98369e6a6d + host: 237459442b7b33b83cb17c7d8e28d1dc +- config: + server.labels: + disk: _ + zone: _ + host: 9d04c2caf8519f98d6c2a8f4b134aed3 +- host: 744cabc99d81ff6a7b961bcd0bafaac4 diff --git a/pkg/telemetry/testdata/simple.yaml.out b/pkg/telemetry/testdata/simple.yaml.out index 69ef5b5952..959f72e99e 100644 --- a/pkg/telemetry/testdata/simple.yaml.out +++ b/pkg/telemetry/testdata/simple.yaml.out @@ -1,6 +1,6 @@ tidb_servers: -- host: 24b7e8f209cf3a8b43ca34f86a0858a0 - no_hash_str: _ - port: 0 -- host: 785e9420afbfbfd0b9b2ea68e0406057 - port: 0 +- host: badee9e1e6212d0c4f6bdc58e55198ca + no_hash_str: aaaaaaaaaaaaaa + port: 22 +- host: 54ab9723ff45bb84558ba1e2582be534 + port: 33 diff --git a/pkg/utils/http_client.go b/pkg/utils/http_client.go index 9d2945cc1a..7f3ef6db01 100644 --- a/pkg/utils/http_client.go +++ b/pkg/utils/http_client.go @@ -83,6 +83,12 @@ func (c *HTTPClient) Delete(url string, body io.Reader) ([]byte, int, error) { return b, statusCode, err } +// WithClient uses the specified HTTP client +func (c *HTTPClient) WithClient(client *http.Client) *HTTPClient { + c.client = client + return c +} + // checkHTTPResponse checks if an HTTP response is with normal status codes func checkHTTPResponse(res *http.Response) ([]byte, error) { body, err := io.ReadAll(res.Body) diff --git a/pkg/utils/rand/rand.go b/pkg/utils/rand/rand.go index 684e86b170..ebf77edbe6 100644 --- a/pkg/utils/rand/rand.go +++ b/pkg/utils/rand/rand.go @@ -48,3 +48,8 @@ func Intn(n int) int { func Int63n(n int64) int64 { return Reader.Int63n(n) } + +// Read wraps Rand.Read +func Read(b []byte) (int, error) { + return Reader.Read(b) +}