cmd/uplink: Enable telemetry on ctx

Change-Id: I26ffbbb72b9f2ca71b629ba12637c74c2aa072c3
This commit is contained in:
Isaac Hess 2020-03-11 06:45:38 -06:00 committed by Isaac Hess
parent 202b12d210
commit 8e274a5ce4
12 changed files with 28 additions and 19 deletions

View File

@ -9,7 +9,6 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
)
func init() {
@ -27,7 +26,7 @@ func catMain(cmd *cobra.Command, args []string) (err error) {
return fmt.Errorf("no object specified for copy")
}
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
src, err := fpath.New(args[0])
if err != nil {

View File

@ -4,8 +4,14 @@
package cmd
import (
"context"
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/cfgstruct"
"storj.io/storj/pkg/process"
"storj.io/uplink/telemetry"
)
func getConfDir() string {
@ -14,3 +20,8 @@ func getConfDir() string {
}
return fpath.ApplicationDir("storj", "uplink")
}
func withTelemetry(cmd *cobra.Command) (context.Context, context.CancelFunc) {
ctx, _ := process.Ctx(cmd)
return telemetry.Enable(ctx)
}

View File

@ -18,7 +18,6 @@ import (
"github.com/zeebo/errs"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
"storj.io/uplink"
)
@ -300,7 +299,7 @@ func copyMain(cmd *cobra.Command, args []string) (err error) {
return fmt.Errorf("no destination specified")
}
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
src, err := fpath.New(args[0])
if err != nil {

View File

@ -12,7 +12,6 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
"storj.io/uplink"
)
@ -35,7 +34,7 @@ func init() {
}
func list(cmd *cobra.Command, args []string) error {
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
project, err := cfg.getProject(ctx, *lsEncryptedFlag)
if err != nil {

View File

@ -9,7 +9,6 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
)
func init() {
@ -22,7 +21,7 @@ func init() {
}
func makeBucket(cmd *cobra.Command, args []string) error {
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
if len(args) == 0 {
return fmt.Errorf("no bucket specified for creation")

View File

@ -10,7 +10,6 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
)
func init() {
@ -39,7 +38,7 @@ func metaGetMain(cmd *cobra.Command, args []string) (err error) {
return fmt.Errorf("too many arguments")
}
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
src, err := fpath.New(path)
if err != nil {

View File

@ -9,7 +9,6 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
)
func init() {
@ -27,7 +26,7 @@ func putMain(cmd *cobra.Command, args []string) (err error) {
return fmt.Errorf("no object specified for copy")
}
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
dst, err := fpath.New(args[0])
if err != nil {

View File

@ -9,7 +9,6 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
)
func init() {
@ -22,7 +21,7 @@ func init() {
}
func deleteBucket(cmd *cobra.Command, args []string) error {
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
if len(args) == 0 {
return fmt.Errorf("no bucket specified for deletion")

View File

@ -9,7 +9,6 @@ import (
"github.com/spf13/cobra"
"storj.io/common/fpath"
"storj.io/storj/pkg/process"
)
var (
@ -28,7 +27,7 @@ func init() {
}
func deleteObject(cmd *cobra.Command, args []string) error {
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
if len(args) == 0 {
return fmt.Errorf("no object specified for deletion")

View File

@ -39,7 +39,7 @@ func init() {
}
func cmdSetup(cmd *cobra.Command, args []string) (err error) {
ctx, _ := process.Ctx(cmd)
ctx, _ := withTelemetry(cmd)
if cmd.Flag("access").Changed {
return ErrAccessFlag

4
go.mod
View File

@ -53,7 +53,7 @@ require (
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
google.golang.org/grpc v1.27.1
gopkg.in/yaml.v2 v2.2.4
storj.io/common v0.0.0-20200303092706-429875361e5d
storj.io/common v0.0.0-20200310192634-b730fe7e2fd5
storj.io/drpc v0.0.8
storj.io/uplink v1.0.0-rc.3
storj.io/uplink v1.0.0-rc.5.0.20200311190324-aee82d3f05aa
)

6
go.sum
View File

@ -392,6 +392,8 @@ github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583 h1:SZPG5w7Qxq7bMcM
github.com/yuin/gopher-lua v0.0.0-20190206043414-8bfc7677f583/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
github.com/zeebo/admission/v2 v2.0.0 h1:220NPZzKmyfklysKFO95L7E2Gt5NwlxTWGE14VP8heE=
github.com/zeebo/admission/v2 v2.0.0/go.mod h1:gSeHGelDHW7Vq6UyJo2boeSt/6Dsnqpisv0i4YZSOyM=
github.com/zeebo/admission/v3 v3.0.1 h1:/IWg2jLhfjBOUhhdKcbweSzcY3QlbbE57sqvU72EpqA=
github.com/zeebo/admission/v3 v3.0.1/go.mod h1:BP3isIv9qa2A7ugEratNq1dnl2oZRXaQUGdU7WXKtbw=
github.com/zeebo/assert v0.0.0-20181109011804-10f827ce2ed6 h1:bs7mSHVrLRQHxqWcm0hyez0sA23YuXb8Pwnq5NhyZ8A=
github.com/zeebo/assert v0.0.0-20181109011804-10f827ce2ed6/go.mod h1:yssERNPivllc1yU3BvpjYI5BUW+zglcz6QWqeVRL5t0=
github.com/zeebo/assert v1.0.0/go.mod h1:yssERNPivllc1yU3BvpjYI5BUW+zglcz6QWqeVRL5t0=
@ -619,6 +621,8 @@ storj.io/common v0.0.0-20200227094229-a07042157dcb/go.mod h1:c9228xUKEg/sqWSOiVL
storj.io/common v0.0.0-20200303092706-429875361e5d h1:TNUV5+Nc77VV0nRpDWXsGEnxopsyOBknO6vMtrUiRbU=
storj.io/common v0.0.0-20200303092706-429875361e5d/go.mod h1:c9228xUKEg/sqWSOiVLoKQ3DiUqm1WrUAd9autjYfQc=
storj.io/common v0.0.0-20200305112941-134b7e1ea4a4 h1:nXJIJl7dS8jDPJJ19Olcc9SDUA/NyK/4QcVxb1mEUgQ=
storj.io/common v0.0.0-20200310192634-b730fe7e2fd5 h1:xrZpp2TpXmHcgtdG4rSlX0U7iyO9flCAfDbS0+wqUdY=
storj.io/common v0.0.0-20200310192634-b730fe7e2fd5/go.mod h1:I0QTs7z1rI+ZEN95GGY2LKMzP5OZqu0Udga3WhyQfO0=
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ=
storj.io/drpc v0.0.8 h1:wu68cMmtoT0vSWIAZz29RpJkWdi4o0S8BIrLslpH5FQ=
storj.io/drpc v0.0.8/go.mod h1:v39uWro/EbXXk+gNnrM9FQuVVS2zUBWBfeduydgeXUA=
@ -630,3 +634,5 @@ storj.io/uplink v1.0.0-rc.2.0.20200303125047-a419cb9a6a56 h1:8kKEdwZKOuTHjRlwYYI
storj.io/uplink v1.0.0-rc.2.0.20200303125047-a419cb9a6a56/go.mod h1:vLSVPdd45bPN3ewdHQrfdWhCniE1YSQw++LnP9cZR2g=
storj.io/uplink v1.0.0-rc.3 h1:AqqF22oMTi1UgFfA9i8t/UWDdn8KLsyuPJBGMRLIWzA=
storj.io/uplink v1.0.0-rc.3/go.mod h1:vLSVPdd45bPN3ewdHQrfdWhCniE1YSQw++LnP9cZR2g=
storj.io/uplink v1.0.0-rc.5.0.20200311190324-aee82d3f05aa h1:6xFNi+wpqS6b4UvoIRGiW8HKGBBaCm24IhJB0fJR068=
storj.io/uplink v1.0.0-rc.5.0.20200311190324-aee82d3f05aa/go.mod h1:jfS0ET7V9w5Dbenzve3yyDAkfC7W98Kb+zIfZeAgO8E=