Skip to content

Commit

Permalink
fix(interactive): Do not use otel java agent to reduce export size (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
siyuan0322 authored May 13, 2024
1 parent 65eb976 commit 9908dc9
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/graphscope-store/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ data:
export LOG_NAME=graphscope-store
export GROOT_CONF_FILE=/etc/groot/groot.config
export OTEL_SDK_DISABLED={{ not .Values.otel.enabled }}
{{- if .Values.otel.enabled }}
export JAVA_TOOL_OPTIONS="-javaagent:/home/graphscope/opentelemetry-javaagent.jar"
export OTEL_SERVICE_NAME="compiler"
export OTEL_TRACES_SAMPLER={{ .Values.otel.traces.sampler.name }}
export OTEL_TRACES_SAMPLER_ARG={{ .Values.otel.traces.sampler.arg }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public static void main(String[] args) throws Exception {
}

String configFile = args[0];

System.out.println("Config is:");
System.out.println(Utils.readFileAsString(configFile));
UniConfig properties = UniConfig.fromFile(configFile);

odps = SessionState.get().getOdps();
Expand Down Expand Up @@ -183,7 +186,7 @@ public static void main(String[] args) throws Exception {
throw new IOException(e);
}

String _tmp = properties.getProperty(DataLoadConfig.LOAD_AFTER_BUILD, "false");
String _tmp = properties.getProperty(DataLoadConfig.LOAD_AFTER_BUILD, "true");
boolean loadAfterBuild = Utils.parseBoolean(_tmp);
if (loadAfterBuild) {
fullQualifiedDataPath = fullQualifiedDataPath + uniquePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
Expand Down Expand Up @@ -314,4 +316,10 @@ public static Long transferDateToTimeStamp(String dateStr, String dateFormatStr)
return null;
}
}

public static String readFileAsString(String fileName) throws Exception {
String data = "";
data = new String(Files.readAllBytes(Paths.get(fileName)));
return data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ public String getProperty(String key, String defaultValue) {
}

public static UniConfig fromProperties(String file) throws IOException {
Properties properties = new Properties();
try (InputStream is = new FileInputStream(file)) {
properties.load(is);
return fromInputStream(is);
}
}

public static UniConfig fromInputStream(InputStream in) throws IOException {
Properties properties = new Properties();
properties.load(in);
HashMap<String, String> retMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
retMap.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.alibaba.graphscope.groot.dataload.unified;

import com.alibaba.graphscope.groot.common.config.DataLoadConfig;
import com.alibaba.graphscope.groot.dataload.databuild.Utils;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
Expand All @@ -19,15 +21,33 @@ public void serializeRoundTrip() throws IOException {
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
mapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
InputStream in =
UniConfig uniConfig;
try (InputStream in =
Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream("unified_dataloading.yaml");
UniConfig uniConfig = mapper.readValue(in, UniConfig.class);
.getResourceAsStream("unified_dataloading.yaml")) {
uniConfig = mapper.readValue(in, UniConfig.class);
}
System.out.println(uniConfig);
System.out.println("----------------------------------------------");
String out = mapper.writeValueAsString(uniConfig);
System.out.println(out);
Assert.assertEquals(0, 0);
}

@Test
public void inICompatibilityTest() throws IOException {
InputStream in =
Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream("loading_config_odps.ini");

UniConfig properties = UniConfig.fromInputStream(in);
String s = properties.getProperty(DataLoadConfig.LOAD_AFTER_BUILD);
Assert.assertTrue(Utils.parseBoolean(s));
s = properties.getProperty(DataLoadConfig.GRAPH_ENDPOINT);
Assert.assertEquals(s, "1.2.3.4:55556");
s = properties.getProperty(DataLoadConfig.PRIMARY_VIP_SERVER_DOMAIN);
Assert.assertEquals(s, "demo-grpc-vipserver");
}
}

0 comments on commit 9908dc9

Please sign in to comment.