阅读本文,您可以获取 Go SDK 上传数据监控的接口调用示例,实现快速开发。
调用接口前,请先完成 Go SDK 的安装及初始化操作。
本节为您介绍上传数据监控相关接口的功能和调用示例。
您可以调用 DescribeImageXUploadSuccessRateByTime 接口指定查询维度查询上传成功率及数据对应时间点。详细的参数说明可参见 DescribeImageXUploadSuccessRateByTime 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DescribeImageXUploadSuccessRateByTime(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DescribeImageXUploadSuccessRateByTimeBody{} resp, err := instance.DescribeImageXUploadSuccessRateByTime(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DescribeImageXUploadErrorCodeAll 接口指定查询维度查询错误码详细数据。详细的参数说明可参见 DescribeImageXUploadErrorCodeAll 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DescribeImageXUploadErrorCodeAll(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DescribeImageXUploadErrorCodeAllBody{} resp, err := instance.DescribeImageXUploadErrorCodeAll(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DescribeImageXUploadErrorCodeByTime 接口指定查询维度来获取上传数据中的错误码信息以及时序数据。详细的参数说明可参见 DescribeImageXUploadErrorCodeByTime 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DescribeImageXUploadErrorCodeByTime(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DescribeImageXUploadErrorCodeByTimeBody{} resp, err := instance.DescribeImageXUploadErrorCodeByTime(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DescribeImageXUploadCountByTime 接口指定查询维度来获取上传数据中的有效上传次数数据。详细的参数说明可参见 DescribeImageXUploadCountByTime 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DescribeImageXUploadCountByTime(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DescribeImageXUploadCountByTimeBody{} resp, err := instance.DescribeImageXUploadCountByTime(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DescribeImageXUploadFileSize 接口指定查询维度来获取上传数据中的上传文件大小数据。详细的参数说明可参见 DescribeImageXUploadFileSize 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DescribeImageXUploadFileSize(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DescribeImageXUploadFileSizeBody{} resp, err := instance.DescribeImageXUploadFileSize(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DescribeImageXUploadSpeed 接口指定查询维度来获取上传数据中的上传平均速度数据。详细的参数说明可参见 DescribeImageXUploadSpeed 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DescribeImageXUploadSpeed(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DescribeImageXUploadSpeedBody{} resp, err := instance.DescribeImageXUploadSpeed(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DescribeImageXUploadDuration 接口指定查询维度来获取上传数据中的上传平均耗时数据。详细的参数说明可参见 DescribeImageXUploadDuration 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DescribeImageXUploadDuration(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DescribeImageXUploadDurationBody{} resp, err := instance.DescribeImageXUploadDuration(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }
您可以调用 DescribeImageXUploadSegmentSpeedByTime 接口查询时间段和时间粒度获取 2.0 模式下的上传分片速度。详细的参数说明可参见 DescribeImageXUploadSegmentSpeedByTime 接口文档。
接口调用示例如下所示。
package imagex_test import ( "context" "encoding/json" "fmt" "testing" "github.com/volcengine/volc-sdk-golang/base" imagex "github.com/volcengine/volc-sdk-golang/service/imagex/v2" ) func Test_DescribeImageXUploadSegmentSpeedByTime(t *testing.T) { instance := imagex.NewInstance() instance.SetCredential(base.Credentials{ AccessKeyID: "ak", SecretAccessKey: "sk", }) param := &imagex.DescribeImageXUploadSegmentSpeedByTimeBody{} resp, err := instance.DescribeImageXUploadSegmentSpeedByTime(context.Background(), param) if err != nil { fmt.Printf("error %v", err) } else { t, _ := json.Marshal(resp) fmt.Printf("success %v", string(t)) } }