-
Notifications
You must be signed in to change notification settings - Fork 81
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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).