GoogleCloudPlatform / GoogleCloudPlatform/opentelemetry-operations-java

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

Đang mở
#421 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
78
Fork
39
Merge trung bình
14 phút
Pull request đã merge (30 ngày)
1

Mô tả

`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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
cloud
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.