Skip to content

Commit

Permalink
openrewrite
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
Adrian Cole committed Apr 16, 2024
1 parent 298ba08 commit 767b0b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,15 @@ public void run() {
String fields = "s.trace_id, s.parent_id, s.id, a.a_key, a.endpoint_service_name, a.a_type";
if (hasTraceIdHigh) fields = "s.trace_id_high, " + fields;
String groupByFields = fields.replace("s.parent_id, ", "");
String linksQuery = String.format(
"select distinct %s "+
"from zipkin_spans s left outer join zipkin_annotations a on " +
" (s.trace_id = a.trace_id and s.id = a.span_id " +
" and a.a_key in ('lc', 'ca', 'cs', 'sa', 'sr', 'ma', 'ms', 'mr', 'error')) " +
"where s.start_ts between %s and %s group by %s",
fields, microsLower, microsUpper, groupByFields);
String linksQuery = (
"""
select distinct %s \
from zipkin_spans s left outer join zipkin_annotations a on \
(s.trace_id = a.trace_id and s.id = a.span_id \
and a.a_key in ('lc', 'ca', 'cs', 'sa', 'sr', 'ma', 'ms', 'mr', 'error')) \
where s.start_ts between %s and %s group by %s\
""").formatted(
fields, microsLower, microsUpper, groupByFields);

options.put("dbtable", "(" + linksQuery + ") as link_spans");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ MySQLStorage.Builder newStorageBuilder() {
final MariaDbDataSource dataSource;

try {
dataSource = new MariaDbDataSource(String.format(
"jdbc:mysql://%s:%s/zipkin?permitMysqlScheme&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8",
dataSource = new MariaDbDataSource(
"jdbc:mysql://%s:%s/zipkin?permitMysqlScheme&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8".formatted(
host(), port()));
dataSource.setUser("zipkin");
dataSource.setPassword("zipkin");
Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@

<main.basedir>${project.basedir}</main.basedir>

<!-- All source is Java 11+ -->
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- All source is Java 17+ -->
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<!-- We don't use animal-sniffer anymore as release obviates it.
See https://github.com/mojohaus/animal-sniffer/issues/62 -->
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.release>17</maven.compiler.release>

<maven.compiler.testSource>11</maven.compiler.testSource>
<maven.compiler.testTarget>11</maven.compiler.testTarget>
<maven.compiler.testSource>17</maven.compiler.testSource>
<maven.compiler.testTarget>17</maven.compiler.testTarget>
<!-- We don't use animal-sniffer anymore as release obviates it.
See https://github.com/mojohaus/animal-sniffer/issues/62 -->
<maven.compiler.testRelease>11</maven.compiler.testRelease>
<maven.compiler.testRelease>17</maven.compiler.testRelease>

<!-- 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 -->
Expand Down

0 comments on commit 767b0b3

Please sign in to comment.