GoogleCloudPlatform / GoogleCloudPlatform/opentelemetry-operations-java
getAttribute fetches data from http://metadata.google.internal/computeMetadata/v1/ without a timeout
- 主要语言
- Java
- 星标
- 78
- 派生
- 39
- 平均合并
- 14 分钟
- 30 天内合并 PR
- 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
贡献指南
调研方向
Start with detectors/resources-support/src/main/java/com/google/cloud/opentelemetry/detection/GCPPlatformDetector.java at detectSupportedPlatform, then trace isRunningOnGcp(), GcpMetadataConfig#getProjectId(), and getAttribute(String). Check the existing detector tests, if present, and verify that probing metadata on an unavailable host is bounded by a timeout without breaking GCP detection.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- cloud
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100