Skip to content

Handle NumberFormatException when parsing numbers#2880

Merged
jack-berg merged 2 commits into
open-telemetry:mainfrom
jack-berg:guard-parselong-azure-functions
Jun 1, 2026
Merged

Handle NumberFormatException when parsing numbers#2880
jack-berg merged 2 commits into
open-telemetry:mainfrom
jack-berg:guard-parselong-azure-functions

Conversation

@jack-berg

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 27, 2026 20:53
@jack-berg
jack-berg requested a review from a team as a code owner May 27, 2026 20:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves robustness of cloud resource detection by preventing NumberFormatException from bubbling up when parsing numeric metadata/environment values in the GCP Cloud Run Job and Azure Functions resource providers.

Changes:

  • Catch NumberFormatException when parsing Cloud Run Job task index and Azure Functions memory limit, skipping the numeric attribute when malformed.
  • Add regression tests ensuring malformed numeric inputs do not set the corresponding attributes.
  • Minor cleanup in GCPResourceProviderTest to use static Mockito imports.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
gcp-resources/src/main/java/io/opentelemetry/contrib/gcp/resource/GCPResourceProvider.java Wrap Cloud Run Job task index parsing in try/catch and log on malformed values.
gcp-resources/src/test/java/io/opentelemetry/contrib/gcp/resource/GCPResourceProviderTest.java Add test for malformed Cloud Run Job task index; refactor Mockito usage via static imports.
azure-resources/src/main/java/io/opentelemetry/contrib/azure/resource/AzureFunctionsResourceProvider.java Wrap Azure Functions memory limit parsing in try/catch and log on malformed values.
azure-resources/src/test/java/io/opentelemetry/contrib/azure/resource/AzureFunctionsResourceProviderTest.java Add test for malformed Azure Functions memory limit.

@linux-foundation-easycla

linux-foundation-easycla Bot commented May 28, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@jack-berg
jack-berg force-pushed the guard-parselong-azure-functions branch from 237fb0a to 4931235 Compare May 28, 2026 13:03
@jack-berg
jack-berg added this pull request to the merge queue May 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 28, 2026
@jack-berg
jack-berg added this pull request to the merge queue Jun 1, 2026
Merged via the queue into open-telemetry:main with commit 5bb833b Jun 1, 2026
22 checks passed
@jack-berg
jack-berg deleted the guard-parselong-azure-functions branch June 1, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants