Skip to content

Commit

Permalink
cr fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyaug committed Sep 7, 2023
1 parent 76e1092 commit 73e0056
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/main/java/io/lakefs/iceberg/LakeFSReporter.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.lakefs.iceberg;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
import java.net.URI;
import java.util.Base64;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
Expand All @@ -14,10 +14,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.URI;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;

public class LakeFSReporter {
private URI lakeFSEndpoint;
Expand All @@ -41,7 +40,7 @@ public void logOp(String op) {
SimpleHttpRequest request = generateRequest(reportMap);
httpClient.execute(request, null);
} catch (Throwable ignored) {
logger.warn("Failed to report operation", ignored);
logger.warn("Failed to report operation", ignored);
}
}

Expand All @@ -55,15 +54,9 @@ private SimpleHttpRequest generateRequest(Map<String, Object> body) throws JsonP
}

private String prepareRequestBody(Map<String, Object> requestMap) throws JsonProcessingException {
Map<String, Map<String, Object>[]> statisticsRequest = new HashMap<String, Map<String, Object>[]>() {
{
put("events", new Map[]{requestMap});
}
};
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.writeValueAsString(statisticsRequest);
return new ObjectMapper().writeValueAsString(ImmutableMap.of("events", new Map[] { requestMap }));
}

private String generateBasicAuthHeader(Configuration hadoopConfig) {
String key = hadoopConfig.get("fs.s3a.access.key");
String secret = hadoopConfig.get("fs.s3a.secret.key");
Expand Down

0 comments on commit 73e0056

Please sign in to comment.