GoogleCloudPlatform / GoogleCloudPlatform/opentelemetry-operations-java

getAttribute fetches data from http://metadata.google.internal/computeMetadata/v1/ without a timeout

オープン
#421 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
78
フォーク
39
平均マージ
14分
マージ済み PR(30日)
1

説明

`detectSupportedPlatform` tries to fetch data from a URL. This can take a long time on hosts that do not have access to that host:

1. `detectSupportedPlatform` calls `isRunningOnGcp()`: https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/blob/ee8c19280e6970ce8902f043bc7a4592acc4a091/detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detection/GCPPlatformDetector.java#L45
2. `isRunningOnGcp()` calls `GcpMetadataConfig#getProjectId()`
3. `GcpMetadataConfig#getProjectId()` calls `getAttribute(String)`
4. `getAttribute` tries to fetch data from http://metadata.google.internal/computeMetadata/v1/

The latter can potentially block for a long time. Would it maybe be better to add a timeout to that call?

Background: https://github.com/googleapis/java-spanner-jdbc/issues/2250

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。