oracle / oci-java-sdk

Oracle Cloud Infrastructure SDK for Java
https://cloud.oracle.com/cloud-infrastructure
Other
192 stars 152 forks source link

Wrong endpoint configured for MonitoringClient.postMetricData() #585

Open ben5311 opened 3 months ago

ben5311 commented 3 months ago

In the OCI Java SDK (and also in the oci CLI tool), the incorrect endpoint for the Monitoring operation PostMetricData is configured. Therefore, I always get a 404 Not Found error when I call MonitoringClient.postMetricData().

I am using latest OCI Java SDK version com.oracle.oci.sdk:oci-java-sdk-monitoring:3.38.0.

Error returned by PostMetricData operation in Monitoring service.(404, NotAuthorizedOrNotFound, false) Authorization failed or requested resource not found. (opc-request-id: 06418A9859954B53BBCE490EC4CBF06A/30AFF4B43339BA03E6480142EEDEA340/E68006EF501653D8D58A0529E9F18718)
Timestamp: 2024-03-29T20:52:13.602Z
Client version: Oracle-JavaSDK/3.38.0
Request Endpoint: https://telemetry.eu-frankfurt-1.oraclecloud.com/20180401/metrics
Troubleshooting Tips: See https://docs.oracle.com/en-us/iaas/Content/API/References/apierrors.htm#apierrors_404__404_notauthorizedornotfound for more information about resolving this error
Also see https://docs.oracle.com/iaas/api/#/en/monitoring/20180401/MetricData/PostMetricData for details on this operation's requirements.

As described in the PostMetricData API docs, a different endpoint must be used for this specific operation.

Incorrect endpoint: https://telemetry.eu-frankfurt-1.oraclecloud.com Correct endpoint: https://telemetry-ingestion.eu-frankfurt-1.oraclecloud.com

When I manually override the endpoint using MonitoringClient.setEndpoint(), it works without any issues.

I think the endpoint should be fixed both in the Java SDK and the oci CLI tool.