-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrades to Spark 3.4/JRE 17 and fixes all high/critical CVEs #226
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,24 @@ | |
# args override it (Ex. 2020-10-31) | ||
set -eu | ||
|
||
exec java ${JAVA_OPTS} -Djava.io.tmpdir=/tmp -cp classes zipkin2.dependencies.ZipkinDependenciesJob $@ | ||
# Spark 3.4 module config from: | ||
# https://github.com/apache/spark/blob/branch-3.4/launcher/src/main/java/org/apache/spark/launcher/JavaModuleOptions.java#L29 | ||
exec java ${JAVA_OPTS} -Djava.io.tmpdir=/tmp \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
-XX:+IgnoreUnrecognizedVMOptions \ | ||
--add-opens=java.base/java.lang=ALL-UNNAMED \ | ||
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED \ | ||
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \ | ||
--add-opens=java.base/java.io=ALL-UNNAMED \ | ||
--add-opens=java.base/java.net=ALL-UNNAMED \ | ||
--add-opens=java.base/java.nio=ALL-UNNAMED \ | ||
--add-opens=java.base/java.util=ALL-UNNAMED \ | ||
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED \ | ||
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED \ | ||
--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED \ | ||
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED \ | ||
--add-opens=java.base/sun.nio.cs=ALL-UNNAMED \ | ||
--add-opens=java.base/sun.security.action=ALL-UNNAMED \ | ||
--add-opens=java.base/sun.util.calendar=ALL-UNNAMED \ | ||
--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED \ | ||
-Djdk.reflect.useDirectMethodHandle=false \ | ||
-cp classes zipkin2.dependencies.ZipkinDependenciesJob $@ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,6 +154,9 @@ private static String getSystemPropertyAsFileResource(String key) { | |
df.setTimeZone(TimeZone.getTimeZone("UTC")); | ||
this.dateStamp = df.format(new Date(builder.day)); | ||
this.conf = new SparkConf(true).setMaster(builder.sparkMaster).setAppName(getClass().getName()); | ||
if (builder.sparkMaster.startsWith("local[")) { | ||
conf.set("spark.driver.bindAddress", "127.0.0.1"); | ||
} | ||
if (builder.jars != null) conf.setJars(builder.jars); | ||
if (builder.username != null) conf.set(ES_NET_HTTP_AUTH_USER, builder.username); | ||
if (builder.password != null) conf.set(ES_NET_HTTP_AUTH_PASS, builder.password); | ||
|
@@ -167,33 +170,27 @@ private static String getSystemPropertyAsFileResource(String key) { | |
} | ||
|
||
public void run() { | ||
run( | ||
index + "-span-" + dateStamp, | ||
index + "-dependency-" + dateStamp, | ||
SpanBytesDecoder.JSON_V2); | ||
|
||
log.info("Done"); | ||
} | ||
String spanResource = index + "-span-" + dateStamp; | ||
String dependencyLinkResource = index + "-dependency-" + dateStamp; | ||
SpanBytesDecoder decoder = SpanBytesDecoder.JSON_V2; | ||
|
||
void run(String spanResource, String dependencyLinkResource, SpanBytesDecoder decoder) { | ||
log.info("Processing spans from {}", spanResource); | ||
JavaSparkContext sc = new JavaSparkContext(conf); | ||
try { | ||
JavaRDD<Map<String, Object>> links = | ||
JavaEsSpark.esJsonRDD(sc, spanResource) | ||
.groupBy(JSON_TRACE_ID) | ||
.flatMapValues(new TraceIdAndJsonToDependencyLinks(logInitializer, decoder)) | ||
.values() | ||
.mapToPair((PairFunction<DependencyLink, Tuple2<String, String>, DependencyLink>) l -> | ||
new Tuple2<>(new Tuple2<>(l.parent(), l.child()), l)) | ||
.reduceByKey((l, r) -> DependencyLink.newBuilder() | ||
.parent(l.parent()) | ||
.child(l.child()) | ||
.callCount(l.callCount() + r.callCount()) | ||
.errorCount(l.errorCount() + r.errorCount()) | ||
.build()) | ||
.values() | ||
.map(DEPENDENCY_LINK_JSON); | ||
JavaRDD<Map<String, Object>> links; | ||
try (JavaSparkContext sc = new JavaSparkContext(conf)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is just polish as we can use try/resources with some of the drivers |
||
links = JavaEsSpark.esJsonRDD(sc, spanResource) | ||
.groupBy(JSON_TRACE_ID) | ||
.flatMapValues(new TraceIdAndJsonToDependencyLinks(logInitializer, decoder)) | ||
.values() | ||
.mapToPair((PairFunction<DependencyLink, Tuple2<String, String>, DependencyLink>) l -> | ||
new Tuple2<>(new Tuple2<>(l.parent(), l.child()), l)) | ||
.reduceByKey((l, r) -> DependencyLink.newBuilder() | ||
.parent(l.parent()) | ||
.child(l.child()) | ||
.callCount(l.callCount() + r.callCount()) | ||
.errorCount(l.errorCount() + r.errorCount()) | ||
.build()) | ||
.values() | ||
.map(DEPENDENCY_LINK_JSON); | ||
|
||
if (links.isEmpty()) { | ||
log.info("No dependency links could be processed from spans in index {}", spanResource); | ||
|
@@ -204,9 +201,9 @@ void run(String spanResource, String dependencyLinkResource, SpanBytesDecoder de | |
dependencyLinkResource, | ||
Collections.singletonMap("es.mapping.id", "id")); // allows overwriting the link | ||
} | ||
} finally { | ||
sc.stop(); | ||
} | ||
|
||
log.info("Done"); | ||
} | ||
|
||
/** | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Set everything to be logged to the console | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is also spark 3.4 thing (log4j 2 not 1.2 config) |
||
appenders=console | ||
appender.console.type=Console | ||
appender.console.name=STDOUT | ||
appender.console.layout.type=PatternLayout | ||
appender.console.layout.pattern=%d{ABSOLUTE} %-5p [%t] %C{2} (%F:%L) - %m%n | ||
|
||
rootLogger.level=warn | ||
rootLogger.appenderRefs=stdout | ||
rootLogger.appenderRef.stdout.ref=STDOUT | ||
|
||
# Make sure basic status is logged for all backends | ||
logger.zipkin2.name = zipkin2.dependencies | ||
logger.zipkin2.level = info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a spark 3.4 thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically it tries to detect with the hostname, which isn't needed for local mode anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it is worth looking into, but
InetAddress.getLocalHost().getHostAddress()
may be more reliable option (fe if the host uses IPv6 only).