Skip to content

[resourcedetectionprocessor/oraclecloud] Error Handling Enhancements#43386

Merged
atoulme merged 12 commits intoopen-telemetry:mainfrom
geekdave:rdp-oraclecloud-fixes
Nov 23, 2025
Merged

[resourcedetectionprocessor/oraclecloud] Error Handling Enhancements#43386
atoulme merged 12 commits intoopen-telemetry:mainfrom
geekdave:rdp-oraclecloud-fixes

Conversation

@geekdave
Copy link
Copy Markdown
Contributor

@geekdave geekdave commented Oct 9, 2025

Description

This PR improves the reliability and correctness of the Oracle Cloud resource detector in the Resource Detection Processor. Previously, the detector did not differentiate between running off Oracle Cloud ("not platform") and on Oracle Cloud with metadata fetch issues, potentially resulting in silent loss of resource attributes.

Key improvements:

  • A fast probe (HEAD request) is now used to detect if the collector is running on Oracle Cloud before attempting a full metadata fetch.
  • If not running on Oracle Cloud, the detector returns an empty resource and no error, and also emits a debug-level log to indicate what happened.
  • If running on Oracle Cloud but metadata fetch fails, the detector logs and propagates an error.
  • Unit tests are refactored to reliably mock platform detection for both on-platform, and off-platform cases
  • User documentation is updated to clearly explain the new error-handling, detection flow, and rationale.

Link to tracking issue

Fixes #42794

Testing

Added new unit tests that:

  • Test the fast-probe fail case (should return empty resource, no error)
  • Test the probe-succeed/metadata-fail case (should signal error)
  • Cover both positive and negative scenarios with a probe mock helper
  • Test that required bearer token auth header is set

Local Deployment

Checked for graceful warning message by deploying on local workstation (not OKE) and correctly getting this warning:

2025-11-10T19:52:49.282Z	
debug	
oraclecloud/oraclecloud.go:48	
Oracle Cloud platform probe failed – not running on Oracle Cloud. Returning empty resource.

OKE Deployment

Deployed on OKE, and confirmed above warning did NOT show up. Rather got confirmation from base detector implementation:

2025-11-10T08:50:48.329Z	
info	
internal/resourcedetection.go:188	
detected resource information	
{"resource": {"service.instance.id": "****", "service.name": "dave-custom-otelcol", 
"service.version": "v1"}, "otelcol.component.id": "resourcedetection/oraclecloud", 
"otelcol.component.kind": "processor", "otelcol.pipeline.id": "metrics", 
"otelcol.signal": "metrics", "resource": {"cloud.availability_zone":"aOft:PHX-AD-1",
"cloud.platform":"oracle_cloud_oke","cloud.provider":"oracle_cloud",
"cloud.region":"us-phoenix-1","host.id":"ocid1.instance.****","
host.name":"oke-****","host.type":"VM.Standard.E4.Flex",
"k8s.cluster.name":"dave-cluster-4"}}

Documentation

  • Updated the "Oracle Cloud Infrastructure (OCI) metadata" section in processor/resourcedetectionprocessor/README.md to include the new detection and error-handling strategy.
  • Added in-code comments explaining test strategies and the probe override mechanism.
  • A new .chloggen entry summarizes these changes for the next release.

@geekdave geekdave force-pushed the rdp-oraclecloud-fixes branch from fafdd41 to b5c49eb Compare October 22, 2025 19:01
@geekdave geekdave force-pushed the rdp-oraclecloud-fixes branch from b5c49eb to 78e31a4 Compare November 2, 2025 06:31
@geekdave geekdave force-pushed the rdp-oraclecloud-fixes branch from 78e31a4 to 8a1ec58 Compare November 10, 2025 08:33
@geekdave geekdave changed the title Oracle Cloud Resource Detector – Error Handling Enhancements [resourcedetectionprocessor/oraclecloud] Error Handling Enhancements Nov 10, 2025
Copy link
Copy Markdown
Contributor

@atoulme atoulme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Codeowners please review

@atoulme atoulme merged commit 8878742 into open-telemetry:main Nov 23, 2025
210 checks passed
@github-actions github-actions Bot added this to the next release milestone Nov 23, 2025
@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented Nov 23, 2025

Thank you for your contribution @geekdave! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Oracle Cloud Resource Detector – Error Handling Enhancements

4 participants