You need to enable JavaScript to run this app.
导航
数据监控
最近更新时间:2024.02.02 10:28:48首次发布时间:2023.02.06 14:10:22

阅读本文,您可以获取 Go SDK 数据监控的接口调用示例,实现快速开发。

调用说明

  • 本文提供的接口调用示例均通过 AK 和 SK 初始化实例。
  • 接口的参数说明和错误码等信息可通过接口文档查看。

前提条件

调用接口前,请先完成 Go SDK 的安装及初始化操作。

调用示例

本节为您介绍数据监控相关接口的功能和调用示例。

查询边缘请求次数

您可以调用 DescribeImageXEdgeRequest 接口获取指定时间段的边缘请求次数。详细的参数说明可参见 DescribeImageXEdgeRequest 接口文档。

接口调用示例如下所示。

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_DescribeImageXEdgeRequest(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXEdgeRequestQuery{}

	resp, err := instance.DescribeImageXEdgeRequest(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}

查询边缘分发带宽用量

您可以调用 DescribeImageXEdgeRequestBandwidth 接口获取指定时间段的边缘分发带宽用量。详细的参数说明可参见 DescribeImageXEdgeRequestBandwidth 接口文档。

接口调用示例如下所示。

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_DescribeImageXEdgeRequestBandwidth(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXEdgeRequestBandwidthQuery{}

	resp, err := instance.DescribeImageXEdgeRequestBandwidth(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}

查询边缘分发流量用量

您可以调用 DescribeImageXEdgeRequestTraffic 接口获取指定时间段的边缘分发流量用量。详细的参数说明可参见 DescribeImageXEdgeRequestTraffic 接口文档。

接口调用示例如下所示。

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_DescribeImageXEdgeRequestTraffic(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXEdgeRequestTrafficQuery{}

	resp, err := instance.DescribeImageXEdgeRequestTraffic(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}

查询镜像回源带宽

您可以调用 DescribeImageXMirrorRequestBandwidth 接口获取指定时间段的镜像回源带宽。详细的参数说明可参见 DescribeImageXMirrorRequestBandwidth 接口文档。

接口调用示例如下所示。

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_DescribeImageXMirrorRequestBandwidth(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXMirrorRequestBandwidthBody{}

	resp, err := instance.DescribeImageXMirrorRequestBandwidth(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}

查询镜像回源流量

您可以调用 DescribeImageXMirrorRequestTraffic 接口获取指定时间段的镜像回源流量。详细的参数说明可参见 DescribeImageXMirrorRequestTraffic 接口文档。

接口调用示例如下所示。

具体示例如下所示:

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_DescribeImageXMirrorRequestTraffic(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXMirrorRequestTrafficBody{}

	resp, err := instance.DescribeImageXMirrorRequestTraffic(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}

查询镜像回源请求次时序数据

您可以调用 DescribeImageXMirrorRequestHttpCodeByTime 接口获取指定时间段的镜像回源请求次时序数据。详细的参数说明可参见 DescribeImageXMirrorRequestHttpCodeByTime 接口文档。

接口调用示例如下所示。

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_DescribeImageXMirrorRequestHTTPCodeByTime(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXMirrorRequestHTTPCodeByTimeBody{}

	resp, err := instance.DescribeImageXMirrorRequestHTTPCodeByTime(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}

查询镜像回源请求次域名明细数据

您可以调用 DescribeImageXMirrorRequestHttpCodeOverview 接口获取指定时间段的镜像回源请求次域名明细数据。详细的参数说明可参见 DescribeImageXMirrorRequestHttpCodeOverview 接口文档。

接口调用示例如下所示。

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_DescribeImageXMirrorRequestHTTPCodeOverview(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXMirrorRequestHTTPCodeOverviewBody{}

	resp, err := instance.DescribeImageXMirrorRequestHTTPCodeOverview(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}

查询边缘分发地区列表

您可以调用 DescribeImageXEdgeRequestRegions 接口获取指定时间段的边缘分发数据的地区列表。详细的参数说明可参见 DescribeImageXEdgeRequestRegions 接口文档。

接口调用示例如下所示。

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_DescribeImageXEdgeRequestRegions(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXEdgeRequestRegionsQuery{}

	resp, err := instance.DescribeImageXEdgeRequestRegions(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}

查询数据处理服务 QPS 用量

您可以调用 DescribeImageXServerQPSUsage 接口获取指定时间段的数据处理服务 QPS 用量。详细的参数说明可参见 DescribeImageXServerQPSUsage 接口文档。

接口调用示例如下所示。

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_DescribeImageXServerQPSUsage(t *testing.T) {
	instance := imagex.NewInstance()

	instance.SetCredential(base.Credentials{
		AccessKeyID:     "ak",
		SecretAccessKey: "sk",
	})

	param := &imagex.DescribeImageXServerQPSUsageQuery{}

	resp, err := instance.DescribeImageXServerQPSUsage(context.Background(), param)

	if err != nil {
		fmt.Printf("error %v", err)
	} else {
		t, _ := json.Marshal(resp)
		fmt.Printf("success %v", string(t))
	}
}