Line 18 of the code has the following:
monitoring_client = oci.monitoring.MonitoringClient(config)
When I run that code (with my own values), it fails with a 404 error. After a bunch of troubleshooting, I figured out that the code in that example is wrong. You actually need to explicitly define the client with service_endpoint like I have below:
monitoring_client = oci.monitoring.MonitoringClient(config,service_endpoint="https://telemetry-ingestion.us-phoenix-1.oraclecloud.com")
When I run that, it works just fine. Maybe this is expected behavior, but if that’s the case, the documentation is really unclear and the example is wrong.
There is a defect with the post_metric_data function of the python SDK for the monitoring client class. https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/api/monitoring/client/oci.monitoring.MonitoringClient.html#oci.monitoring.MonitoringClient.post_metric_data
In the example provided by Oracle it gives this code: post_metric_data.py (oracle.com)
Line 18 of the code has the following: monitoring_client = oci.monitoring.MonitoringClient(config)
When I run that code (with my own values), it fails with a 404 error. After a bunch of troubleshooting, I figured out that the code in that example is wrong. You actually need to explicitly define the client with service_endpoint like I have below: monitoring_client = oci.monitoring.MonitoringClient(config,service_endpoint="https://telemetry-ingestion.us-phoenix-1.oraclecloud.com")
When I run that, it works just fine. Maybe this is expected behavior, but if that’s the case, the documentation is really unclear and the example is wrong.