Skip to content

Commit

Permalink
Merge pull request #13 from saytoshivam/main
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurang-Patel authored Jun 14, 2022
2 parents 071ae99 + 587a9e9 commit 6920f1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.logicmonitor.resource.detectors.gcp.computeEngine;

import com.amazonaws.util.IOUtils;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.sdk.resources.Resource;
Expand Down Expand Up @@ -44,7 +45,7 @@ private static String getGcpResource(String key) {
URL url = new URL(key);
HttpURLConnection conn = (HttpURLConnection) (url.openConnection());
conn.setRequestProperty("Metadata-Flavor", "Google");
resource = new String(conn.getInputStream().readAllBytes(), StandardCharsets.UTF_8);
resource = new String(IOUtils.toByteArray(conn.getInputStream()), StandardCharsets.UTF_8);
conn.disconnect();
} catch (Exception e) {
logger.error("Exception:" + e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class LMComputeEngineResourceProviderTest {
@Test
public void ifKServiceIsNull() throws IOException {
Map<AttributeKey<?>, Object> expectedOutputSet =
new HashMap<>() {
new HashMap<AttributeKey<?>, Object>() {
{
put(ResourceAttributes.CLOUD_PROVIDER, "gcp");
put(ResourceAttributes.CLOUD_PLATFORM, "gcp_compute_engine");
Expand Down

0 comments on commit 6920f1a

Please sign in to comment.