oracle / oci-python-sdk

Oracle Cloud Infrastructure SDK for Python
https://cloud.oracle.com/cloud-infrastructure
Other
390 stars 281 forks source link

post_metric_data method of MonitoringClient class uses wrong endpoint #366

Open pastyGRB opened 3 years ago

pastyGRB commented 3 years ago

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.

jodoglevy commented 3 years ago

@pastyGRB thanks for reporting - we'll pass this feedback to the Monitoring service team to fix this

noprobsdk commented 7 months ago

This is still an issue..

Have to do the same fix.

@pastyGRB Thx! :)