1

SummarizeMetricsData

final String compartment = "ocid1.compartment.oc1..aaaaaaaao6rwmdqqv5264k2hfnlvzlridxj2mhtz3mzycq526bybtxuiyygq";
final String namespace = "oci_computeagent";
final String query = "NetworksBytesOut[1m]{resourceId:ocid1.instance.oc1.eu-frankfurt-1.abtheljtx3jpe4ifo3bxwhfngxfcgu3clrivse3zpuzumasauvveu74xxh4q}.sum()";
final String profile = CONFIG_PROFILE_DEFAULT;

  final SummarizeMetricsDataRequest request =
                SummarizeMetricsDataRequest.builder()
                        .compartmentId(compartment)
                        .summarizeMetricsDataDetails(
                                SummarizeMetricsDataDetails.builder()
                                        .namespace(namespace)
                                        .query(query)
                                        .startTime(START)
                                        .endTime(UNTIL)
                                        .build())
                        .build();

我正在使用 Java SDK 来获取指标的数据点。

但得到以下异常。

Exception in thread "main" com.oracle.bmc.model.BmcException: (400, InvalidParameter, false) token recognition error at: ':'
NetworksBytesOut[1m]{resourceId:ocid1.instance.oc1.eu-frankfurt-1.abtheljtx3jpe4ifo3bxwhfngxfcgu3clrivse3zpuzumasauvveu74xxh4q}.sum()
(opc-request-id: FD8B823E39BA4C6787ADAA8C88C4831B/A3A7C538D3C290E4982C5875B700C788/C1A4F87CFA3E44B83585B3372579D324)
at com.oracle.bmc.http.internal.ResponseHelper.throwIfNotSuccessful(ResponseHelper.java:120)
at com.oracle.bmc.http.internal.ResponseConversionFunctionFactory$ValidatingParseResponseFunction.apply(ResponseConversionFunctionFactory.java:86)
at com.oracle.bmc.http.internal.ResponseConversionFunctionFactory$ValidatingParseResponseFunction.apply(ResponseConversionFunctionFactory.java:82)

有什么输入吗?我的想法是“查询”字符串不正确。但是文档告诉像下面这样构建查询。

{
"namespace": "oci_computeagent",
"query": "CpuUtilization[1m]{resourceId:<instance_OCID>}.max()",
"startTime": "2019-03-10T22:19:26.789Z",
"endTime": "2019-03-10T22:28:26.789Z"
}
4

1 回答 1

1

使用=而不是:. 像这样: metric[interval]{dimensionname="dimensionvalue"}.groupingfunction.statistic,请参阅此处的参考资料。

于 2019-07-05T05:50:27.260 回答