线程 "main" com.oracle.bmc.model.BmcException 中的异常:(400,InvalidParameter,false)令牌识别错误位于:':'
Exception in thread "main" com.oracle.bmc.model.BmcException: (400, InvalidParameter, false) token recognition error at: ':'
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)
有什么意见吗?我的想法是 'query' 字符串不正确。但是文档告诉我们像下面这样构建查询。
{
"namespace": "oci_computeagent",
"query": "CpuUtilization[1m]{resourceId:<instance_OCID>}.max()",
"startTime": "2019-03-10T22:19:26.789Z",
"endTime": "2019-03-10T22:28:26.789Z"
}
使用 =
而不是 :
。
像这样:
metric[interval]{dimensionname="dimensionvalue"}.groupingfunction.statistic
,参见参考资料 here。
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)
有什么意见吗?我的想法是 'query' 字符串不正确。但是文档告诉我们像下面这样构建查询。
{
"namespace": "oci_computeagent",
"query": "CpuUtilization[1m]{resourceId:<instance_OCID>}.max()",
"startTime": "2019-03-10T22:19:26.789Z",
"endTime": "2019-03-10T22:28:26.789Z"
}
使用 =
而不是 :
。
像这样:
metric[interval]{dimensionname="dimensionvalue"}.groupingfunction.statistic
,参见参考资料 here。