百度智能云

All Product Document

          Cloud Monitor

          Dimension Value TopN Query Interface

          API description

          This API retrieves the TopN dimension values for a specified metric under certain dimensions associated with a cloud product instance.

          Request parameters

          Name Types Description Required or not Parameter location
          userId String User ID Yes Body
          scope String Cloud product identifier. For values, refer to [Cloud Product Identifier List](BCM/Cloud Product Monitor List/Cloud Product Monitor Object Type List.md) Yes Body
          region String Region identifier. For values, refer to [Region List](BCM/API Reference/Service domain.md) Yes Body
          metricName String Monitor Metric Yes Body
          statistics String Statistic method type. Optional values: average, maximum, minimum, sum, sampleCount. Yes Body
          dimensions Map<String, String> Instance dimensions and metric dimensions, instance dimensions: Instance ID or parent instance ID (required); metric dimensions: Dimensions carried by the monitoring metric (optional) Yes Body
          labels Set<String> Metric dimensions to be sorted Yes Body
          startTime String Monitor data start time, refer to [Date and Time](BCM/API Reference/General Description.md), in UTC format Yes Body
          endTime String Monitor data end time, refer to [Date and Time](BCM/API Reference/General Description.md), expressed in UTC date Yes Body
          order String Sorting method, optional values top (descending), bottom (ascending), default top No Body
          topNum int Number of topNum items retained after sorting, default: 10, maximum: 1000 No Body

          Parameter explanation

          • For concepts like Scope, Metric, Statistic, and Dimension, refer to [Core Concepts](BCM/Product Description/Core concepts.md).

          Response parameters

          Name Types Description
          requestId String Request identifier ID
          topDatas List<TopData> Sorted list of dimension values

          TopData

          Name Types Description
          order int Ranking
          dimensions List<Dimension> Dimension Information

          Dimension

          Name Types Description
          name String Dimension name
          value String Dimension value

          Request example

          request := &model.TsdbDimensionTopQuery{
          		UserID: "453bf9********************9090dc",
          		Region: "bj",
          		Scope:  "BCE_NAT",
          		Dimensions: map[string]string{
          			"NatId": "nat-bm1******vf8",
          		},
          		MetricName: "ConnNumber",
          		Statistics: "average",
          		StartTime:  "2024-04-27T07:10:01Z",
          		EndTime:    "2024-04-27T07:20:01Z",
          		Labels: []string{
          			"FixIp",
          		},
          	}
          	response, err := bcmClient.GetMetricDimensionTop(request)

          Response example

          {
                "requestId": "34faaba47566446c9ba32cd1d2bf082b",
                "topDatas": [
                      {
                            "order": 1,
                            "dimensions": [
                                  {
                                        "name": "FixIp",
                                        "value": "192.168.0.16"
                                  }
                            ]
                      },
                      {
                            "order": 2,
                            "dimensions": [
                                  {
                                        "name": "FixIp",
                                        "value": "192.168.0.15"
                                  }
                            ]
                      }
                ]
          }
          Previous
          Dimension Value TopN and Monitoring Data Query Interface
          Next
          Initialization