oracle / oracle/oci-python-sdk
post_metric_data method of MonitoringClient class uses wrong endpoint
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 474
- Forks
- 321
- Avg merge
- 23m
- Merged PRs (30d)
- 4
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MonitoringClient.post_metric_data entry point and compare its endpoint selection with the linked post_metric_data.py example. Reproduce the 404 using the default client, then verify the explicitly supplied telemetry-ingestion service_endpoint succeeds; done means the example and client behavior consistently target the correct endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100