diff --git a/grid-cli/go.mod b/grid-cli/go.mod index 5084cbb8..a1ecf2cf 100644 --- a/grid-cli/go.mod +++ b/grid-cli/go.mod @@ -26,6 +26,7 @@ require ( github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/ethereum/go-ethereum v1.11.6 // indirect + github.com/getsentry/sentry-go v0.29.1 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/gomodule/redigo v2.0.0+incompatible // indirect @@ -53,6 +54,7 @@ require ( golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200609130330-bd2cb7843e1b // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/protobuf v1.34.1 // indirect diff --git a/grid-cli/go.sum b/grid-cli/go.sum index 0682a8b6..c030078d 100644 --- a/grid-cli/go.sum +++ b/grid-cli/go.sum @@ -32,6 +32,10 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnN github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/ethereum/go-ethereum v1.11.6 h1:2VF8Mf7XiSUfmoNOy3D+ocfl9Qu8baQBrCNbo2CXQ8E= github.com/ethereum/go-ethereum v1.11.6/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y= +github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA= +github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0= +github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk= +github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= @@ -93,6 +97,8 @@ github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaG github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -161,6 +167,8 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.zx2c4.com/wireguard v0.0.20200121/go.mod h1:P2HsVp8SKwZEufsnezXZA4GRX/T49/HlU7DGuelXsU4= diff --git a/grid-client/deployer/deployment_deployer.go b/grid-client/deployer/deployment_deployer.go index 716e4fc7..309a541e 100644 --- a/grid-client/deployer/deployment_deployer.go +++ b/grid-client/deployer/deployment_deployer.go @@ -31,12 +31,12 @@ func NewDeploymentDeployer(tfPluginClient *TFPluginClient) DeploymentDeployer { // Validate validates a deployment deployer func (d *DeploymentDeployer) Validate(ctx context.Context, dls []*workloads.Deployment) error { if err := validateAccountBalanceForExtrinsics(d.tfPluginClient.SubstrateConn, d.tfPluginClient.Identity); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } for _, dl := range dls { if err := dl.Validate(); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } } @@ -44,7 +44,7 @@ func (d *DeploymentDeployer) Validate(ctx context.Context, dls []*workloads.Depl } // GenerateVersionlessDeployments generates a new deployment without a version -func (d *DeploymentDeployer) GenerateVersionlessDeployments(ctx context.Context, dls []*workloads.Deployment) (map[uint32][]zos.Deployment, error) { +func (d *DeploymentDeployer) generateVersionlessDeployments(ctx context.Context, dls []*workloads.Deployment) (map[uint32][]zos.Deployment, error) { gridDlsPerNodes := make(map[uint32][]zos.Deployment) var wg sync.WaitGroup @@ -107,16 +107,16 @@ func (d *DeploymentDeployer) GenerateVersionlessDeployments(ctx context.Context, // Deploy deploys a new deployment func (d *DeploymentDeployer) Deploy(ctx context.Context, dl *workloads.Deployment) error { if err := d.Validate(ctx, []*workloads.Deployment{dl}); err != nil { - return fmt.Errorf("invalid deployment: %w", err) + return d.tfPluginClient.sentry.error(fmt.Errorf("invalid deployment: %w", err)) } - dlsPerNodes, err := d.GenerateVersionlessDeployments(ctx, []*workloads.Deployment{dl}) + dlsPerNodes, err := d.generateVersionlessDeployments(ctx, []*workloads.Deployment{dl}) if err != nil { - return errors.Wrap(err, "could not generate deployments data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not generate deployments data")) } if len(dlsPerNodes[dl.NodeID]) == 0 { - return fmt.Errorf("failed to generate the grid deployment") + return d.tfPluginClient.sentry.error(fmt.Errorf("failed to generate the grid deployment")) } dl.NodeDeploymentID, err = d.deployer.Deploy( @@ -132,7 +132,7 @@ func (d *DeploymentDeployer) Deploy(ctx context.Context, dl *workloads.Deploymen d.tfPluginClient.State.StoreContractIDs(dl.NodeID, dl.ContractID) } - return err + return d.tfPluginClient.sentry.error(err) } // BatchDeploy deploys multiple deployments using the deployer @@ -144,13 +144,13 @@ func (d *DeploymentDeployer) BatchDeploy(ctx context.Context, dls []*workloads.D multiErr = multierror.Append(multiErr, fmt.Errorf("invalid deployments: %w", err)) } - newDeployments, err := d.GenerateVersionlessDeployments(ctx, dls) + newDeployments, err := d.generateVersionlessDeployments(ctx, dls) if err != nil { multiErr = multierror.Append(multiErr, fmt.Errorf("could not generate grid deployments: %w", err)) } if len(newDeployments) == 0 { - return errors.Wrap(multiErr, "failed to generate the grid deployments") + return d.tfPluginClient.sentry.error(errors.Wrap(multiErr, "failed to generate the grid deployments")) } newDls, err := d.deployer.BatchDeploy(ctx, newDeployments, newDeploymentsSolutionProvider) @@ -166,18 +166,18 @@ func (d *DeploymentDeployer) BatchDeploy(ctx context.Context, dls []*workloads.D } } - return multiErr + return d.tfPluginClient.sentry.error(multiErr) } // Cancel cancels deployments func (d *DeploymentDeployer) Cancel(ctx context.Context, dl *workloads.Deployment) error { if err := d.Validate(ctx, []*workloads.Deployment{dl}); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } err := d.deployer.Cancel(ctx, dl.ContractID) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } // update state @@ -374,11 +374,11 @@ func (d *DeploymentDeployer) syncContract(dl *workloads.Deployment) error { func (d *DeploymentDeployer) Sync(ctx context.Context, dl *workloads.Deployment) error { err := d.syncContract(dl) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } currentDeployments, err := d.deployer.GetDeployments(ctx, dl.NodeDeploymentID) if err != nil { - return errors.Wrap(err, "failed to get deployments to update local state") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to get deployments to update local state")) } deployment := currentDeployments[dl.NodeID] diff --git a/grid-client/deployer/deployment_deployer_test.go b/grid-client/deployer/deployment_deployer_test.go index 458bcca3..4c475c6d 100644 --- a/grid-client/deployer/deployment_deployer_test.go +++ b/grid-client/deployer/deployment_deployer_test.go @@ -353,7 +353,7 @@ func TestDeploymentDeployerDeploy(t *testing.T) { return nil }).AnyTimes() - dls, err := d.GenerateVersionlessDeployments(context.Background(), []*workloads.Deployment{&dl}) + dls, err := d.generateVersionlessDeployments(context.Background(), []*workloads.Deployment{&dl}) assert.NoError(t, err) assert.Equal(t, len(gridDl.Workloads), len(dls[dl.NodeID][0].Workloads)) @@ -528,7 +528,7 @@ func TestDeploymentDeployerSync(t *testing.T) { return nil }) - dls, err := d.GenerateVersionlessDeployments(context.Background(), []*workloads.Deployment{&dl}) + dls, err := d.generateVersionlessDeployments(context.Background(), []*workloads.Deployment{&dl}) assert.NoError(t, err) gridDl := dls[dl.NodeID][0] diff --git a/grid-client/deployer/gateway_fqdn_deployer.go b/grid-client/deployer/gateway_fqdn_deployer.go index f879171c..6128c781 100644 --- a/grid-client/deployer/gateway_fqdn_deployer.go +++ b/grid-client/deployer/gateway_fqdn_deployer.go @@ -30,32 +30,32 @@ func NewGatewayFqdnDeployer(tfPluginClient *TFPluginClient) GatewayFQDNDeployer func (d *GatewayFQDNDeployer) Validate(ctx context.Context, gw *workloads.GatewayFQDNProxy) error { sub := d.tfPluginClient.SubstrateConn if err := validateAccountBalanceForExtrinsics(sub, d.tfPluginClient.Identity); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } if err := gw.Validate(); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } nodeClient, err := d.tfPluginClient.NcPool.GetNodeClient(sub, gw.NodeID) if err != nil { - return errors.Wrapf(err, "failed to get node client with ID %d", gw.NodeID) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "failed to get node client with ID %d", gw.NodeID)) } cfg, err := nodeClient.NetworkGetPublicConfig(ctx) if err != nil { - return errors.Wrapf(err, "couldn't get node %d public config", gw.NodeID) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "couldn't get node %d public config", gw.NodeID)) } if cfg.IPv4.IP == nil { - return errors.Errorf("node %d doesn't contain a public IP in its public config", gw.NodeID) + return d.tfPluginClient.sentry.error(errors.Errorf("node %d doesn't contain a public IP in its public config", gw.NodeID)) } - return client.AreNodesUp(ctx, sub, []uint32{gw.NodeID}, d.tfPluginClient.NcPool) + return d.tfPluginClient.sentry.error(client.AreNodesUp(ctx, sub, []uint32{gw.NodeID}, d.tfPluginClient.NcPool)) } // GenerateVersionlessDeployments generates deployments for gatewayFqdn deployer without versions -func (d *GatewayFQDNDeployer) GenerateVersionlessDeployments(ctx context.Context, gw *workloads.GatewayFQDNProxy) (map[uint32]zosTypes.Deployment, error) { +func (d *GatewayFQDNDeployer) generateVersionlessDeployments(ctx context.Context, gw *workloads.GatewayFQDNProxy) (map[uint32]zosTypes.Deployment, error) { deployments := make(map[uint32]zosTypes.Deployment) var err error @@ -74,12 +74,12 @@ func (d *GatewayFQDNDeployer) GenerateVersionlessDeployments(ctx context.Context // Deploy deploys the GatewayFQDN deployments using the deployer func (d *GatewayFQDNDeployer) Deploy(ctx context.Context, gw *workloads.GatewayFQDNProxy) error { if err := d.Validate(ctx, gw); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } - newDeployments, err := d.GenerateVersionlessDeployments(ctx, gw) + newDeployments, err := d.generateVersionlessDeployments(ctx, gw) if err != nil { - return errors.Wrap(err, "could not generate deployments data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not generate deployments data")) } // TODO: solution providers @@ -97,7 +97,7 @@ func (d *GatewayFQDNDeployer) Deploy(ctx context.Context, gw *workloads.GatewayF } } - return err + return d.tfPluginClient.sentry.error(err) } // BatchDeploy deploys multiple deployments using the deployer @@ -107,12 +107,12 @@ func (d *GatewayFQDNDeployer) BatchDeploy(ctx context.Context, gws []*workloads. for _, gw := range gws { if err := d.Validate(ctx, gw); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } - dls, err := d.GenerateVersionlessDeployments(ctx, gw) + dls, err := d.generateVersionlessDeployments(ctx, gw) if err != nil { - return errors.Wrap(err, "could not generate deployments data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not generate deployments data")) } for nodeID, dl := range dls { @@ -133,23 +133,23 @@ func (d *GatewayFQDNDeployer) BatchDeploy(ctx context.Context, gws []*workloads. // error is not returned immediately before updating state because of untracked failed deployments for _, gw := range gws { if err := d.updateStateFromDeployments(gw, newDls); err != nil { - return errors.Wrapf(err, "failed to update gateway fqdn '%s' state", gw.Name) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "failed to update gateway fqdn '%s' state", gw.Name)) } } - return err + return d.tfPluginClient.sentry.error(err) } // Cancel cancels a gateway deployment func (d *GatewayFQDNDeployer) Cancel(ctx context.Context, gw *workloads.GatewayFQDNProxy) (err error) { if err := d.Validate(ctx, gw); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } contractID := gw.NodeDeploymentID[gw.NodeID] err = d.deployer.Cancel(ctx, contractID) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } // update state @@ -198,12 +198,12 @@ func (d *GatewayFQDNDeployer) syncContracts(ctx context.Context, gw *workloads.G // Sync syncs the gateway deployments func (d *GatewayFQDNDeployer) Sync(ctx context.Context, gw *workloads.GatewayFQDNProxy) error { if err := d.syncContracts(ctx, gw); err != nil { - return errors.Wrap(err, "could not sync contracts") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not sync contracts")) } dls, err := d.deployer.GetDeployments(ctx, gw.NodeDeploymentID) if err != nil { - return errors.Wrap(err, "could not get deployment objects") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not get deployment objects")) } dl := dls[gw.NodeID] @@ -225,7 +225,7 @@ func (d *GatewayFQDNDeployer) Sync(ctx context.Context, gw *workloads.GatewayFQD gw.Network = gwWorkload.Network if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } } diff --git a/grid-client/deployer/gateway_fqdn_deployer_test.go b/grid-client/deployer/gateway_fqdn_deployer_test.go index 73f702c1..4a8a0b5a 100644 --- a/grid-client/deployer/gateway_fqdn_deployer_test.go +++ b/grid-client/deployer/gateway_fqdn_deployer_test.go @@ -126,7 +126,7 @@ func TestFQDNDeployer(t *testing.T) { }) t.Run("test generate", func(t *testing.T) { - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(context.Background(), &gw) assert.NoError(t, err) testDl := workloads.NewGridDeployment(twinID, 0, []zosTypes.Workload{ @@ -151,7 +151,7 @@ func TestFQDNDeployer(t *testing.T) { }) t.Run("test deploy", func(t *testing.T) { - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(context.Background(), &gw) assert.NoError(t, err) mockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl) @@ -175,7 +175,7 @@ func TestFQDNDeployer(t *testing.T) { gw.NodeDeploymentID = map[uint32]uint64{nodeID: contractID} - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(context.Background(), &gw) assert.NoError(t, err) mockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl) @@ -198,7 +198,7 @@ func TestFQDNDeployer(t *testing.T) { gw.NodeDeploymentID = map[uint32]uint64{nodeID: contractID} - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(context.Background(), &gw) assert.NoError(t, err) mockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl) @@ -316,7 +316,7 @@ func TestFQDNDeployer(t *testing.T) { gw.ContractID = contractID gw.NodeDeploymentID = map[uint32]uint64{nodeID: contractID} - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(context.Background(), &gw) assert.NoError(t, err) dl := dls[nodeID] @@ -346,7 +346,7 @@ func TestFQDNDeployer(t *testing.T) { gw.ContractID = contractID gw.NodeDeploymentID = map[uint32]uint64{nodeID: contractID} - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(context.Background(), &gw) assert.NoError(t, err) dl := dls[nodeID] diff --git a/grid-client/deployer/gateway_name_deployer.go b/grid-client/deployer/gateway_name_deployer.go index 706f28f2..24601eaa 100644 --- a/grid-client/deployer/gateway_name_deployer.go +++ b/grid-client/deployer/gateway_name_deployer.go @@ -31,18 +31,18 @@ func NewGatewayNameDeployer(tfPluginClient *TFPluginClient) GatewayNameDeployer func (d *GatewayNameDeployer) Validate(ctx context.Context, gw *workloads.GatewayNameProxy) error { sub := d.tfPluginClient.SubstrateConn if err := validateAccountBalanceForExtrinsics(sub, d.tfPluginClient.Identity); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } if err := gw.Validate(); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } - return client.AreNodesUp(ctx, sub, []uint32{gw.NodeID}, d.tfPluginClient.NcPool) + return d.tfPluginClient.sentry.error(client.AreNodesUp(ctx, sub, []uint32{gw.NodeID}, d.tfPluginClient.NcPool)) } -// GenerateVersionlessDeployments generates deployments for gateway name deployer without versions -func (d *GatewayNameDeployer) GenerateVersionlessDeployments(ctx context.Context, gw *workloads.GatewayNameProxy) (map[uint32]zosTypes.Deployment, error) { +// generateVersionlessDeployments generates deployments for gateway name deployer without versions +func (d *GatewayNameDeployer) generateVersionlessDeployments(gw *workloads.GatewayNameProxy) (map[uint32]zosTypes.Deployment, error) { deployments := make(map[uint32]zosTypes.Deployment) var err error @@ -61,24 +61,24 @@ func (d *GatewayNameDeployer) GenerateVersionlessDeployments(ctx context.Context // Deploy deploys the GatewayName deployments using the deployer func (d *GatewayNameDeployer) Deploy(ctx context.Context, gw *workloads.GatewayNameProxy) error { if err := d.Validate(ctx, gw); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } - newDeployments, err := d.GenerateVersionlessDeployments(ctx, gw) + newDeployments, err := d.generateVersionlessDeployments(gw) if err != nil { - return errors.Wrap(err, "could not generate deployments data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not generate deployments data")) } newDeploymentsSolutionProvider := make(map[uint32]*uint64) newDeploymentsSolutionProvider[gw.NodeID] = nil if err := d.InvalidateNameContract(ctx, gw); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } if gw.NameContractID == 0 { gw.NameContractID, err = d.tfPluginClient.SubstrateConn.CreateNameContract(d.tfPluginClient.Identity, gw.Name) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } } @@ -86,9 +86,9 @@ func (d *GatewayNameDeployer) Deploy(ctx context.Context, gw *workloads.GatewayN if err != nil { cancelErr := d.tfPluginClient.SubstrateConn.CancelContract(d.tfPluginClient.Identity, gw.NameContractID) if cancelErr != nil { - return fmt.Errorf("failed to deploy gateway name %v, failed to cancel gateway name contract %v", err, cancelErr) + return d.tfPluginClient.sentry.error(fmt.Errorf("failed to deploy gateway name %v, failed to cancel gateway name contract %v", err, cancelErr)) } - return errors.Wrapf(err, "failed to deploy gateway name id: %v", gw.NodeDeploymentID) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "failed to deploy gateway name id: %v", gw.NodeDeploymentID)) } // update state // error is not returned immediately before updating state because of untracked failed deployments @@ -99,7 +99,7 @@ func (d *GatewayNameDeployer) Deploy(ctx context.Context, gw *workloads.GatewayN } } - return err + return d.tfPluginClient.sentry.error(err) } // BatchDeploy deploys multiple deployments using the deployer @@ -109,21 +109,21 @@ func (d *GatewayNameDeployer) BatchDeploy(ctx context.Context, gws []*workloads. for _, gw := range gws { if err := d.Validate(ctx, gw); err != nil { - return err + return d.tfPluginClient.sentry.error(d.tfPluginClient.sentry.error(err)) } - dls, err := d.GenerateVersionlessDeployments(ctx, gw) + dls, err := d.generateVersionlessDeployments(gw) if err != nil { - return errors.Wrap(err, "could not generate deployments data") + return d.tfPluginClient.sentry.error(d.tfPluginClient.sentry.error(errors.Wrap(err, "could not generate deployments data"))) } if err := d.InvalidateNameContract(ctx, gw); err != nil { - return err + return d.tfPluginClient.sentry.error(d.tfPluginClient.sentry.error(err)) } if gw.NameContractID == 0 { gw.NameContractID, err = d.tfPluginClient.SubstrateConn.CreateNameContract(d.tfPluginClient.Identity, gw.Name) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } } @@ -145,11 +145,11 @@ func (d *GatewayNameDeployer) BatchDeploy(ctx context.Context, gws []*workloads. // error is not returned immediately before updating state because of untracked failed deployments for _, gw := range gws { if err := d.updateStateFromDeployments(gw, newDls); err != nil { - return errors.Wrapf(err, "failed to update gateway fqdn '%s' state", gw.Name) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "failed to update gateway fqdn '%s' state", gw.Name)) } } - return err + return d.tfPluginClient.sentry.error(err) } // Cancel cancels the gatewayName deployment @@ -157,7 +157,7 @@ func (d *GatewayNameDeployer) Cancel(ctx context.Context, gw *workloads.GatewayN contractID := gw.NodeDeploymentID[gw.NodeID] err = d.deployer.Cancel(ctx, contractID) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } gw.ContractID = 0 @@ -166,7 +166,7 @@ func (d *GatewayNameDeployer) Cancel(ctx context.Context, gw *workloads.GatewayN if gw.NameContractID != 0 { if err := d.tfPluginClient.SubstrateConn.EnsureContractCanceled(d.tfPluginClient.Identity, gw.NameContractID); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } gw.NameContractID = 0 } @@ -213,7 +213,7 @@ func (d *GatewayNameDeployer) InvalidateNameContract(ctx context.Context, gw *wo return } -func (d *GatewayNameDeployer) syncContracts(ctx context.Context, gw *workloads.GatewayNameProxy) (err error) { +func (d *GatewayNameDeployer) syncContracts(gw *workloads.GatewayNameProxy) (err error) { if err := d.tfPluginClient.SubstrateConn.DeleteInvalidContracts(gw.NodeDeploymentID); err != nil { return err } @@ -233,12 +233,12 @@ func (d *GatewayNameDeployer) syncContracts(ctx context.Context, gw *workloads.G // Sync syncs the gateway deployments func (d *GatewayNameDeployer) Sync(ctx context.Context, gw *workloads.GatewayNameProxy) (err error) { - if err := d.syncContracts(ctx, gw); err != nil { - return errors.Wrap(err, "could not sync contracts") + if err := d.syncContracts(gw); err != nil { + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not sync contracts")) } dls, err := d.deployer.GetDeployments(ctx, gw.NodeDeploymentID) if err != nil { - return errors.Wrap(err, "could not get deployment objects") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not get deployment objects")) } dl := dls[gw.NodeID] wl, _ := dl.Get(gw.Name) @@ -260,7 +260,7 @@ func (d *GatewayNameDeployer) Sync(ctx context.Context, gw *workloads.GatewayNam gw.Network = gwWorkload.Network if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } } return nil diff --git a/grid-client/deployer/gateway_name_deployer_test.go b/grid-client/deployer/gateway_name_deployer_test.go index ad6823cd..21b10450 100644 --- a/grid-client/deployer/gateway_name_deployer_test.go +++ b/grid-client/deployer/gateway_name_deployer_test.go @@ -106,7 +106,7 @@ func TestNameDeployer(t *testing.T) { }) t.Run("test generate", func(t *testing.T) { - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(&gw) assert.NoError(t, err) testDl := workloads.NewGridDeployment(twinID, 0, []zosTypes.Workload{ @@ -131,7 +131,7 @@ func TestNameDeployer(t *testing.T) { }) t.Run("test deploy", func(t *testing.T) { - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(&gw) assert.NoError(t, err) mockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl) @@ -161,7 +161,7 @@ func TestNameDeployer(t *testing.T) { gw.NameContractID = nameContractID gw.NodeDeploymentID = map[uint32]uint64{nodeID: contractID} - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(&gw) assert.NoError(t, err) mockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl) @@ -189,7 +189,7 @@ func TestNameDeployer(t *testing.T) { gw.NameContractID = nameContractID gw.NodeDeploymentID = map[uint32]uint64{nodeID: contractID} - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(&gw) assert.NoError(t, err) mockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl) @@ -292,7 +292,7 @@ func TestNameDeployer(t *testing.T) { gw.NameContractID, ).Return(true, nil) - err := d.syncContracts(context.Background(), &gw) + err := d.syncContracts(&gw) assert.NoError(t, err) assert.Equal(t, gw.NodeDeploymentID, map[uint32]uint64{nodeID: contractID}) assert.Equal(t, gw.ContractID, contractID) @@ -313,7 +313,7 @@ func TestNameDeployer(t *testing.T) { gw.NameContractID, ).Return(false, nil) - err := d.syncContracts(context.Background(), &gw) + err := d.syncContracts(&gw) assert.NoError(t, err) assert.Equal(t, gw.NodeDeploymentID, map[uint32]uint64{}) assert.Equal(t, gw.NameContractID, uint64(0)) @@ -329,7 +329,7 @@ func TestNameDeployer(t *testing.T) { gw.NodeDeploymentID, ).Return(errors.New("error")) - err := d.syncContracts(context.Background(), &gw) + err := d.syncContracts(&gw) assert.Error(t, err) assert.Equal(t, gw.NodeDeploymentID, map[uint32]uint64{nodeID: contractID}) assert.Equal(t, gw.NameContractID, nameContractID) @@ -341,7 +341,7 @@ func TestNameDeployer(t *testing.T) { gw.NameContractID = nameContractID gw.NodeDeploymentID = map[uint32]uint64{nodeID: contractID} - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(&gw) assert.NoError(t, err) dl := dls[nodeID] @@ -378,7 +378,7 @@ func TestNameDeployer(t *testing.T) { gw.ContractID = contractID gw.NodeDeploymentID = map[uint32]uint64{nodeID: contractID} - dls, err := d.GenerateVersionlessDeployments(context.Background(), &gw) + dls, err := d.generateVersionlessDeployments(&gw) assert.NoError(t, err) dl := dls[nodeID] // state is deleted diff --git a/grid-client/deployer/k8s_deployer.go b/grid-client/deployer/k8s_deployer.go index b1136a7d..bf4ecb74 100644 --- a/grid-client/deployer/k8s_deployer.go +++ b/grid-client/deployer/k8s_deployer.go @@ -38,15 +38,15 @@ func (d *K8sDeployer) Validate(ctx context.Context, k8sCluster *workloads.K8sClu sub := d.tfPluginClient.SubstrateConn if err := validateAccountBalanceForExtrinsics(sub, d.tfPluginClient.Identity); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } if err := d.tfPluginClient.State.AssignNodesIPRange(k8sCluster); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } if err := k8sCluster.Validate(); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } // validate cluster nodes @@ -57,11 +57,11 @@ func (d *K8sDeployer) Validate(ctx context.Context, k8sCluster *workloads.K8sClu nodes = append(nodes, worker.NodeID) } } - return client.AreNodesUp(ctx, sub, nodes, d.tfPluginClient.NcPool) + return d.tfPluginClient.sentry.error(client.AreNodesUp(ctx, sub, nodes, d.tfPluginClient.NcPool)) } -// GenerateVersionlessDeployments generates a new deployment without a version -func (d *K8sDeployer) GenerateVersionlessDeployments(ctx context.Context, k8sCluster *workloads.K8sCluster) (map[uint32]zosTypes.Deployment, error) { +// generateVersionlessDeployments generates a new deployment without a version +func (d *K8sDeployer) generateVersionlessDeployments(k8sCluster *workloads.K8sCluster) (map[uint32]zosTypes.Deployment, error) { err := d.assignNodesIPs(k8sCluster) if err != nil { return nil, errors.Wrap(err, "failed to assign node ips") @@ -95,23 +95,23 @@ func (d *K8sDeployer) GenerateVersionlessDeployments(ctx context.Context, k8sClu // Deploy deploys a k8s cluster deployment func (d *K8sDeployer) Deploy(ctx context.Context, k8sCluster *workloads.K8sCluster) error { if err := d.tfPluginClient.State.AssignNodesIPRange(k8sCluster); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } err := k8sCluster.InvalidateBrokenAttributes(d.tfPluginClient.SubstrateConn) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } assignNodesFlistsAndEntryPoints(k8sCluster) if err := d.Validate(ctx, k8sCluster); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } - newDeployments, err := d.GenerateVersionlessDeployments(ctx, k8sCluster) + newDeployments, err := d.generateVersionlessDeployments(k8sCluster) if err != nil { - return errors.Wrap(err, "could not generate k8s grid deployments") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not generate k8s grid deployments")) } newDeploymentsSolutionProvider := make(map[uint32]*uint64) @@ -138,23 +138,23 @@ func (d *K8sDeployer) BatchDeploy(ctx context.Context, k8sClusters []*workloads. for _, k8sCluster := range k8sClusters { if err := d.tfPluginClient.State.AssignNodesIPRange(k8sCluster); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } err := k8sCluster.InvalidateBrokenAttributes(d.tfPluginClient.SubstrateConn) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } assignNodesFlistsAndEntryPoints(k8sCluster) if err := d.Validate(ctx, k8sCluster); err != nil { - return err + return d.tfPluginClient.sentry.error(err) } - dls, err := d.GenerateVersionlessDeployments(ctx, k8sCluster) + dls, err := d.generateVersionlessDeployments(k8sCluster) if err != nil { - return errors.Wrap(err, "could not generate k8s grid deployments") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not generate k8s grid deployments")) } for nodeID, dl := range dls { @@ -175,11 +175,11 @@ func (d *K8sDeployer) BatchDeploy(ctx context.Context, k8sClusters []*workloads. // error is not returned immediately before updating state because of untracked failed deployments for _, k8sCluster := range k8sClusters { if err := d.updateStateFromDeployments(k8sCluster, newDls); err != nil { - return errors.Wrapf(err, "failed to update cluster with master name '%s' state", k8sCluster.Master.Name) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "failed to update cluster with master name '%s' state", k8sCluster.Master.Name)) } } - return err + return d.tfPluginClient.sentry.error(err) } // Cancel cancels a k8s cluster deployment @@ -188,7 +188,7 @@ func (d *K8sDeployer) Cancel(ctx context.Context, k8sCluster *workloads.K8sClust if k8sCluster.Master.NodeID == nodeID { err = d.deployer.Cancel(ctx, contractID) if err != nil { - return errors.Wrapf(err, "could not cancel master %s, contract %d", k8sCluster.Master.Name, contractID) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "could not cancel master %s, contract %d", k8sCluster.Master.Name, contractID)) } d.tfPluginClient.State.CurrentNodeDeployments[nodeID] = workloads.Delete(d.tfPluginClient.State.CurrentNodeDeployments[nodeID], contractID) delete(k8sCluster.NodeDeploymentID, nodeID) @@ -198,7 +198,7 @@ func (d *K8sDeployer) Cancel(ctx context.Context, k8sCluster *workloads.K8sClust if worker.NodeID == nodeID { err = d.deployer.Cancel(ctx, contractID) if err != nil { - return errors.Wrapf(err, "could not cancel worker %s, contract %d", worker.Name, contractID) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "could not cancel worker %s, contract %d", worker.Name, contractID)) } d.tfPluginClient.State.CurrentNodeDeployments[nodeID] = workloads.Delete(d.tfPluginClient.State.CurrentNodeDeployments[nodeID], contractID) delete(k8sCluster.NodeDeploymentID, nodeID) @@ -248,11 +248,11 @@ func (d *K8sDeployer) updateStateFromDeployments(k8sCluster *workloads.K8sCluste // UpdateFromRemote update a k8s cluster func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workloads.K8sCluster) error { if err := d.removeDeletedContracts(k8sCluster); err != nil { - return errors.Wrap(err, "failed to remove deleted contracts") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to remove deleted contracts")) } currentDeployments, err := d.deployer.GetDeployments(ctx, k8sCluster.NodeDeploymentID) if err != nil { - return errors.Wrap(err, "failed to fetch remote deployments") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to fetch remote deployments")) } zerolog.Debug().Msg("calling updateFromRemote") @@ -306,18 +306,18 @@ func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workload workloadObj[w.Name] = *w.Workload3() } else if w.Type == zosTypes.PublicIPType { - d := zos.PublicIPResult{} + ipResult := zos.PublicIPResult{} if err := json.Unmarshal(w.Result.Data, &d); err != nil { - return errors.Wrap(err, "failed to load public ip data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to load public ip data")) } - publicIPs[w.Name] = d.IP.String() - publicIP6s[w.Name] = d.IPv6.String() + publicIPs[w.Name] = ipResult.IP.String() + publicIP6s[w.Name] = ipResult.IPv6.String() } else if w.Type == zosTypes.ZMountType { - d, err := w.Workload3().WorkloadData() + wl, err := w.Workload3().WorkloadData() if err != nil { - return errors.Wrap(err, "failed to load disk data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to load disk data")) } - diskSize[w.Name] = uint64(d.(*zos.ZMount).Size) / zosTypes.Gigabyte + diskSize[w.Name] = uint64(wl.(*zos.ZMount).Size) / zosTypes.Gigabyte } } } @@ -344,7 +344,7 @@ func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workload m, err := workloads.NewK8sNodeFromWorkload(masterWorkload, masterNodeID, masterDiskSize, masterIP, masterIP6) if err != nil { - return errors.Wrap(err, "failed to get master node from workload") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to get master node from workload")) } k8sCluster.Master = &m } @@ -364,7 +364,7 @@ func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workload workerDiskSize := workloadDiskSize[w.Name] w, err := workloads.NewK8sNodeFromWorkload(workerWorkload, workerNodeID, workerDiskSize, workerIP, workerIP6) if err != nil { - return errors.Wrap(err, "failed to get worker data from workload") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to get worker data from workload")) } workers = append(workers, w) } @@ -379,7 +379,7 @@ func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workload workerDiskSize := workloadDiskSize[name] w, err := workloads.NewK8sNodeFromWorkload(workerWorkload, workerNodeID, workerDiskSize, workerIP, workerIP6) if err != nil { - return errors.Wrap(err, "failed to get worker data from workload") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to get worker data from workload")) } workers = append(workers, w) } @@ -389,7 +389,7 @@ func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workload enc.SetIndent("", " ") err = enc.Encode(k8sCluster) if err != nil { - return errors.Wrap(err, "failed to encode k8s deployer") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to encode k8s deployer")) } return nil diff --git a/grid-client/deployer/k8s_deployer_test.go b/grid-client/deployer/k8s_deployer_test.go index 0b4bfe12..e749c64f 100644 --- a/grid-client/deployer/k8s_deployer_test.go +++ b/grid-client/deployer/k8s_deployer_test.go @@ -162,7 +162,7 @@ func TestK8sDeployer(t *testing.T) { err = d.tfPluginClient.State.AssignNodesIPRange(&k8sCluster) assert.NoError(t, err) - dls, err := d.GenerateVersionlessDeployments(context.Background(), &k8sCluster) + dls, err := d.generateVersionlessDeployments(&k8sCluster) assert.NoError(t, err) nodeWorkloads := make(map[uint32][]gridtypes.Workload) @@ -190,7 +190,7 @@ func TestK8sDeployer(t *testing.T) { err = d.tfPluginClient.State.AssignNodesIPRange(&k8sCluster) assert.NoError(t, err) - dls, err := d.GenerateVersionlessDeployments(context.Background(), &k8sCluster) + dls, err := d.generateVersionlessDeployments(&k8sCluster) assert.NoError(t, err) k8sMockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl, d) @@ -217,7 +217,7 @@ func TestK8sDeployer(t *testing.T) { err = d.tfPluginClient.State.AssignNodesIPRange(&k8sCluster) assert.NoError(t, err) - dls, err := d.GenerateVersionlessDeployments(context.Background(), &k8sCluster) + dls, err := d.generateVersionlessDeployments(&k8sCluster) assert.NoError(t, err) k8sMockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl, d) @@ -254,7 +254,7 @@ func TestK8sDeployer(t *testing.T) { err = d.tfPluginClient.State.AssignNodesIPRange(&k8sCluster) assert.NoError(t, err) - dls, err := d.GenerateVersionlessDeployments(context.Background(), &k8sCluster) + dls, err := d.generateVersionlessDeployments(&k8sCluster) assert.NoError(t, err) k8sMockValidation(d.tfPluginClient.Identity, cl, sub, ncPool, proxyCl, d) diff --git a/grid-client/deployer/network_deployer.go b/grid-client/deployer/network_deployer.go index cc8ce4e0..0b42127f 100644 --- a/grid-client/deployer/network_deployer.go +++ b/grid-client/deployer/network_deployer.go @@ -35,7 +35,7 @@ func (d *NetworkDeployer) Validate(ctx context.Context, networks []workloads.Net var multiErr error if err := validateAccountBalanceForExtrinsics(sub, d.tfPluginClient.Identity); err != nil { - return nil, err + return nil, d.tfPluginClient.sentry.error(err) } filteredZNets := make([]workloads.Network, 0) @@ -54,11 +54,11 @@ func (d *NetworkDeployer) Validate(ctx context.Context, networks []workloads.Net filteredZNets = append(filteredZNets, znet) } - return filteredZNets, multiErr + return filteredZNets, d.tfPluginClient.sentry.error(multiErr) } -// GenerateVersionlessDeployments generates deployments for network deployer without versions. -func (d *NetworkDeployer) GenerateVersionlessDeployments(ctx context.Context, zNets []workloads.Network) (map[uint32][]zos.Deployment, error) { +// generateVersionlessDeployments generates deployments for network deployer without versions. +func (d *NetworkDeployer) generateVersionlessDeployments(ctx context.Context, zNets []workloads.Network) (map[uint32][]zos.Deployment, error) { deployments := make(map[uint32][]zos.Deployment) endpoints := make(map[uint32]net.IP) nodeUsedPorts := make(map[uint32][]uint16) @@ -90,12 +90,12 @@ func (d *NetworkDeployer) GenerateVersionlessDeployments(ctx context.Context, zN func (d *NetworkDeployer) Deploy(ctx context.Context, znet workloads.Network) error { zNets, err := d.Validate(ctx, []workloads.Network{znet}) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } - nodeDeployments, err := d.GenerateVersionlessDeployments(ctx, zNets) + nodeDeployments, err := d.generateVersionlessDeployments(ctx, zNets) if err != nil { - return errors.Wrap(err, "could not generate deployments data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not generate deployments data")) } newDeployments := make(map[uint32]zos.Deployment) @@ -140,16 +140,16 @@ func (d *NetworkDeployer) Deploy(ctx context.Context, znet workloads.Network) er } if err != nil { - return errors.Wrapf(err, "could not deploy network %s", znet.GetName()) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "could not deploy network %s", znet.GetName())) } dls, err := d.deployer.GetDeployments(ctx, znet.GetNodeDeploymentID()) if err != nil { - return errors.Wrap(err, "failed to get deployment objects") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to get deployment objects")) } if err := znet.ReadNodesConfig(ctx, dls); err != nil { - return errors.Wrap(err, "could not read node's data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not read node's data")) } return nil @@ -163,15 +163,15 @@ func (d *NetworkDeployer) BatchDeploy(ctx context.Context, zNets []workloads.Net multiErr = multierror.Append(multiErr, err) } if len(filteredZNets) == 0 { - return multiErr + return d.tfPluginClient.sentry.error(multiErr) } - newDeployments, err := d.GenerateVersionlessDeployments(ctx, filteredZNets) + newDeployments, err := d.generateVersionlessDeployments(ctx, filteredZNets) if err != nil { multiErr = multierror.Append(multiErr, err) } if len(newDeployments) == 0 { - return multiErr + return d.tfPluginClient.sentry.error(multiErr) } newDls, err := d.deployer.BatchDeploy(ctx, newDeployments, make(map[uint32][]*uint64)) @@ -188,24 +188,24 @@ func (d *NetworkDeployer) BatchDeploy(ctx context.Context, zNets []workloads.Net // error is not returned immediately before updating state because of untracked failed deployments for _, znet := range zNets { if err := d.updateStateFromDeployments(ctx, znet, newDls, update); err != nil { - return errors.Wrapf(err, "failed to update network '%s' state", znet.GetName()) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "failed to update network '%s' state", znet.GetName())) } } - return multiErr + return d.tfPluginClient.sentry.error(multiErr) } // Cancel cancels all the deployments func (d *NetworkDeployer) Cancel(ctx context.Context, znet workloads.Network) error { err := validateAccountBalanceForExtrinsics(d.tfPluginClient.SubstrateConn, d.tfPluginClient.Identity) if err != nil { - return err + return d.tfPluginClient.sentry.error(err) } for nodeID, contractID := range znet.GetNodeDeploymentID() { err = d.deployer.Cancel(ctx, contractID) if err != nil { - return errors.Wrapf(err, "could not cancel network %s, contract %d", znet.GetName(), contractID) + return d.tfPluginClient.sentry.error(errors.Wrapf(err, "could not cancel network %s, contract %d", znet.GetName(), contractID)) } znetDeploymentsIDs := znet.GetNodeDeploymentID() delete(znetDeploymentsIDs, nodeID) @@ -218,11 +218,11 @@ func (d *NetworkDeployer) Cancel(ctx context.Context, znet workloads.Network) er dls, err := d.deployer.GetDeployments(ctx, znet.GetNodeDeploymentID()) if err != nil { - return errors.Wrap(err, "failed to get deployment objects") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to get deployment objects")) } if err := znet.ReadNodesConfig(ctx, dls); err != nil { - return errors.Wrap(err, "could not read node's data") + return d.tfPluginClient.sentry.error(errors.Wrap(err, "could not read node's data")) } return nil @@ -241,7 +241,7 @@ func (d *NetworkDeployer) BatchCancel(ctx context.Context, znets []workloads.Net } err := d.tfPluginClient.BatchCancelContract(contracts) if err != nil { - return fmt.Errorf("failed to cancel contracts: %w", err) + return d.tfPluginClient.sentry.error(fmt.Errorf("failed to cancel contracts: %w", err)) } for _, znet := range znets { for nodeID, contractID := range znet.GetNodeDeploymentID() { diff --git a/grid-client/deployer/network_deployer_test.go b/grid-client/deployer/network_deployer_test.go index e94f3c1a..fb07f9ff 100644 --- a/grid-client/deployer/network_deployer_test.go +++ b/grid-client/deployer/network_deployer_test.go @@ -110,7 +110,7 @@ func TestNetworkDeployer(t *testing.T) { Return(client.NewNodeClient(twinID, cl, d.tfPluginClient.RMBTimeout), nil). AnyTimes() - dls, err := d.GenerateVersionlessDeployments(context.Background(), []workloads.Network{&znet}) + dls, err := d.generateVersionlessDeployments(context.Background(), []workloads.Network{&znet}) assert.NoError(t, err) externalIP := "" diff --git a/grid-client/deployer/node_filter.go b/grid-client/deployer/node_filter.go index 5bf03371..38491470 100644 --- a/grid-client/deployer/node_filter.go +++ b/grid-client/deployer/node_filter.go @@ -51,7 +51,7 @@ func FilterNodes(ctx context.Context, tfPlugin TFPluginClient, options types.Nod requestedPages = requestedPagesPerIteration totalPagesCount, err = getPagesCount(ctx, tfPlugin, options, limit) if err != nil { - return []types.Node{}, err + return []types.Node{}, tfPlugin.sentry.error(err) } } @@ -103,7 +103,7 @@ func FilterNodes(ctx context.Context, tfPlugin TFPluginClient, options types.Nod } if errs != nil { - return []types.Node{}, errors.Errorf("could not find enough nodes, found errors: %v", errs) + return []types.Node{}, tfPlugin.sentry.error(errors.Errorf("could not find enough nodes, found errors: %v", errs)) } opts, err := serializeOptions(options) @@ -199,7 +199,7 @@ func GetPublicNode(ctx context.Context, tfPlugin TFPluginClient, preferredNodes nil, nil) if err != nil { - return 0, err + return 0, tfPlugin.sentry.error(err) } // force add preferred nodes diff --git a/grid-client/deployer/sentry.go b/grid-client/deployer/sentry.go new file mode 100644 index 00000000..5660b60c --- /dev/null +++ b/grid-client/deployer/sentry.go @@ -0,0 +1,45 @@ +package deployer + +import ( + "time" + + "github.com/getsentry/sentry-go" +) + +type gridSentry struct { + *sentryInfo +} + +type sentryInfo struct { + twinID uint32 + network string +} + +func initSentry(twinID uint32, network string) (gridSentry, error) { + // Flush buffered events before the program terminates. + defer sentry.Flush(5 * time.Second) + + return gridSentry{ + sentryInfo: &sentryInfo{twinID: twinID, network: network}, + }, sentry.Init(sentry.ClientOptions{ + Dsn: SentryDSN[network], + Environment: network, + Debug: true, + // Set TracesSampleRate to 1.0 to capture 100% + // of transactions for performance monitoring. + // We recommend adjusting this value in production, + TracesSampleRate: 1.0, + }) +} + +func (s *gridSentry) error(err error) error { + sentry.WithScope(func(scope *sentry.Scope) { + scope.SetContext("user", map[string]interface{}{ + "twin": s.twinID, + "network": s.network, + }) + }) + sentry.CaptureException(err) + + return err +} diff --git a/grid-client/deployer/stacks.go b/grid-client/deployer/stacks.go index 5bd9e73c..58478d93 100644 --- a/grid-client/deployer/stacks.go +++ b/grid-client/deployer/stacks.go @@ -100,4 +100,11 @@ var ( QaNetwork: "https://kyc.qa.grid.tf", MainNetwork: "https://kyc.grid.tf", } + + SentryDSN = map[string]string{ + DevNetwork: "https://af8a73b8282edc62c5b8bfa22da50acb@dev.sentry.grid.tf/4", + TestNetwork: "https://af8a73b8282edc62c5b8bfa22da50acb@dev.sentry.grid.tf/4", + QaNetwork: "https://af8a73b8282edc62c5b8bfa22da50acb@dev.sentry.grid.tf/4", + MainNetwork: "", + } ) diff --git a/grid-client/deployer/tf_plugin_client.go b/grid-client/deployer/tf_plugin_client.go index 627d4f93..71c53ea9 100644 --- a/grid-client/deployer/tf_plugin_client.go +++ b/grid-client/deployer/tf_plugin_client.go @@ -66,6 +66,8 @@ type TFPluginClient struct { Calculator calculator.Calculator cancelRelayContext context.CancelFunc + + sentry gridSentry } type pluginCfg struct { @@ -289,6 +291,12 @@ func NewTFPluginClient( return TFPluginClient{}, errors.Wrapf(err, "only verified users can deploy, please visit https://dashboard.grid.tf/ to verify your account") } + gridSentry, err := initSentry(twinID, cfg.network) + if err != nil { + return TFPluginClient{}, errors.Wrap(err, "sentry init failed") + } + tfPluginClient.sentry = gridSentry + tfPluginClient.useRmbProxy = true // if tfPluginClient.useRmbProxy sessionID := generateSessionID() diff --git a/grid-client/go.mod b/grid-client/go.mod index 5f749a88..10ee407b 100644 --- a/grid-client/go.mod +++ b/grid-client/go.mod @@ -7,6 +7,7 @@ require ( github.com/cenkalti/backoff/v4 v4.3.0 github.com/centrifuge/go-substrate-rpc-client/v4 v4.0.12 github.com/cosmos/go-bip39 v1.0.0 + github.com/getsentry/sentry-go v0.29.1 github.com/go-redis/redis v6.15.9+incompatible github.com/golang/mock v1.6.0 github.com/gorilla/schema v1.4.1 @@ -23,6 +24,7 @@ require ( golang.org/x/crypto v0.28.0 golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa golang.org/x/sync v0.8.0 + golang.org/x/text v0.19.0 // indirect; indirect) golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200609130330-bd2cb7843e1b ) @@ -49,7 +51,6 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect - github.com/nxadm/tail v1.4.11 // indirect github.com/pierrec/xxHash v0.1.5 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/rs/cors v1.10.1 // indirect @@ -60,6 +61,8 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) +require gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect + replace github.com/threefoldtech/tfgrid-sdk-go/grid-proxy => ../grid-proxy replace github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go => ../rmb-sdk-go diff --git a/grid-client/go.sum b/grid-client/go.sum index c42e1814..88f23637 100644 --- a/grid-client/go.sum +++ b/grid-client/go.sum @@ -33,6 +33,10 @@ github.com/ethereum/go-ethereum v1.11.6 h1:2VF8Mf7XiSUfmoNOy3D+ocfl9Qu8baQBrCNbo github.com/ethereum/go-ethereum v1.11.6/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA= +github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= @@ -100,6 +104,8 @@ github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -171,7 +177,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= diff --git a/gridify/go.mod b/gridify/go.mod index ffd99987..e3232f8a 100644 --- a/gridify/go.mod +++ b/gridify/go.mod @@ -32,6 +32,7 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/ethereum/go-ethereum v1.11.6 // indirect + github.com/getsentry/sentry-go v0.29.1 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/go-stack/stack v1.8.1 // indirect @@ -72,6 +73,7 @@ require ( golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200609130330-bd2cb7843e1b // indirect gonum.org/v1/gonum v0.15.0 // indirect diff --git a/gridify/go.sum b/gridify/go.sum index 69664449..53676ec1 100644 --- a/gridify/go.sum +++ b/gridify/go.sum @@ -54,8 +54,12 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/ethereum/go-ethereum v1.11.6 h1:2VF8Mf7XiSUfmoNOy3D+ocfl9Qu8baQBrCNbo2CXQ8E= github.com/ethereum/go-ethereum v1.11.6/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y= +github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA= +github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0= github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE= github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8= +github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk= +github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= @@ -136,6 +140,8 @@ github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/monitoring-bot/go.mod b/monitoring-bot/go.mod index fe90d533..fb83199d 100644 --- a/monitoring-bot/go.mod +++ b/monitoring-bot/go.mod @@ -43,6 +43,7 @@ require ( github.com/holiman/uint256 v1.2.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jbenet/go-base58 v0.0.0-20150317085156-6237cf65f3a6 // indirect + github.com/klauspost/compress v1.17.7 // indirect github.com/manucorporat/sse v0.0.0-20160126180136-ee05b128a739 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -59,7 +60,7 @@ require ( github.com/stellar/go-xdr v0.0.0-20230919160922-6c7b68458206 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/tklauser/numcpus v0.6.0 // indirect - github.com/valyala/fasthttp v1.40.0 // indirect + github.com/valyala/fasthttp v1.52.0 // indirect github.com/vedhavyas/go-subkey v1.0.3 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect diff --git a/monitoring-bot/go.sum b/monitoring-bot/go.sum index 91f8203a..3945eb33 100644 --- a/monitoring-bot/go.sum +++ b/monitoring-bot/go.sum @@ -2,8 +2,8 @@ github.com/ChainSafe/go-schnorrkel v1.1.0 h1:rZ6EU+CZFCjB4sHUE1jIu8VDoB/wRKZxoe1 github.com/ChainSafe/go-schnorrkel v1.1.0/go.mod h1:ABkENxiP+cvjFiByMIZ9LYbRoNNLeBLiakC1XeTFxfE= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= -github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo= github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k= github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU= @@ -89,9 +89,8 @@ github.com/jarcoal/httpmock v0.0.0-20161210151336-4442edb3db31 h1:Aw95BEvxJ3K6o9 github.com/jarcoal/httpmock v0.0.0-20161210151336-4442edb3db31/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4= github.com/jbenet/go-base58 v0.0.0-20150317085156-6237cf65f3a6 h1:4zOlv2my+vf98jT1nQt4bT/yKWUImevYPJ2H344CloE= github.com/jbenet/go-base58 v0.0.0-20150317085156-6237cf65f3a6/go.mod h1:r/8JmuR0qjuCiEhAolkfvdZgmPiHTnJaG0UXCSeR1Zo= -github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -166,9 +165,8 @@ github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYm github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.40.0 h1:CRq/00MfruPGFLTQKY8b+8SfdK60TxNztjRMnH0t1Yc= -github.com/valyala/fasthttp v1.40.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= -github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/valyala/fasthttp v1.52.0 h1:wqBQpxH71XW0e2g+Og4dzQM8pk34aFYlA1Ga8db7gU0= +github.com/valyala/fasthttp v1.52.0/go.mod h1:hf5C4QnVMkNXMspnsUlfM3WitlgYflyhHYoKol/szxQ= github.com/vedhavyas/go-subkey v1.0.3 h1:iKR33BB/akKmcR2PMlXPBeeODjWLM90EL98OrOGs8CA= github.com/vedhavyas/go-subkey v1.0.3/go.mod h1:CloUaFQSSTdWnINfBRFjVMkWXZANW+nd8+TI5jYcl6Y= github.com/xdrpp/goxdr v0.1.1 h1:E1B2c6E8eYhOVyd7yEpOyopzTPirUeF6mVOfXfGyJyc= @@ -189,23 +187,15 @@ github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPR github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -214,14 +204,9 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= diff --git a/tfrobot/go.mod b/tfrobot/go.mod index 77d7bc2c..506d3143 100644 --- a/tfrobot/go.mod +++ b/tfrobot/go.mod @@ -33,6 +33,7 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/ethereum/go-ethereum v1.11.6 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/getsentry/sentry-go v0.29.1 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-stack/stack v1.8.1 // indirect diff --git a/tfrobot/go.sum b/tfrobot/go.sum index f46d9ada..dae307dc 100644 --- a/tfrobot/go.sum +++ b/tfrobot/go.sum @@ -35,6 +35,10 @@ github.com/ethereum/go-ethereum v1.11.6 h1:2VF8Mf7XiSUfmoNOy3D+ocfl9Qu8baQBrCNbo github.com/ethereum/go-ethereum v1.11.6/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA= +github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0= +github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk= +github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= @@ -106,6 +110,8 @@ github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaG github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/user-contracts-mon/go.mod b/user-contracts-mon/go.mod index d466f1c5..14684393 100644 --- a/user-contracts-mon/go.mod +++ b/user-contracts-mon/go.mod @@ -21,6 +21,7 @@ require ( github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/ethereum/go-ethereum v1.11.6 // indirect + github.com/getsentry/sentry-go v0.29.1 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/gomodule/redigo v2.0.0+incompatible // indirect @@ -49,6 +50,7 @@ require ( golang.org/x/crypto v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200609130330-bd2cb7843e1b // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/protobuf v1.34.1 // indirect diff --git a/user-contracts-mon/go.sum b/user-contracts-mon/go.sum index e9bc6520..9097f2c4 100644 --- a/user-contracts-mon/go.sum +++ b/user-contracts-mon/go.sum @@ -31,6 +31,10 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnN github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/ethereum/go-ethereum v1.11.6 h1:2VF8Mf7XiSUfmoNOy3D+ocfl9Qu8baQBrCNbo2CXQ8E= github.com/ethereum/go-ethereum v1.11.6/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y= +github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA= +github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0= +github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk= +github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= @@ -90,6 +94,8 @@ github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaG github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -151,6 +157,8 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.zx2c4.com/wireguard v0.0.20200121/go.mod h1:P2HsVp8SKwZEufsnezXZA4GRX/T49/HlU7DGuelXsU4=