Skip to content

Commit

Permalink
Add Flink version to Garmadon logs (#236)
Browse files Browse the repository at this point in the history
Co-authored-by: Jean-Baptiste Catté <jb.catte@criteo.com>
  • Loading branch information
jbkt and Jean-Baptiste Catté authored Feb 28, 2025
1 parent 885b878 commit 4db8bf5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.criteo.hadoop.garmadon.agent.headers;

import com.criteo.hadoop.garmadon.jvm.utils.FlinkRuntime;
import com.criteo.hadoop.garmadon.jvm.utils.JavaRuntime;
import com.criteo.hadoop.garmadon.jvm.utils.SparkRuntime;
import com.criteo.hadoop.garmadon.schema.enums.Component;
Expand Down Expand Up @@ -80,11 +81,13 @@ private void setFrameworkComponent() {
case "org.apache.flink.yarn.entrypoint.YarnJobClusterEntrypoint":
case "org.apache.flink.yarn.entrypoint.YarnSessionClusterEntrypoint":
framework = Framework.FLINK;
frameworkVersion = FlinkRuntime.getVersion();
component = Component.APP_MASTER;
break;
case "org.apache.flink.yarn.YarnTaskManager":
case "org.apache.flink.yarn.YarnTaskExecutorRunner":
framework = Framework.FLINK;
frameworkVersion = FlinkRuntime.getVersion();
component = Component.TASK_MANAGER;
break;
// YARN
Expand Down
6 changes: 6 additions & 0 deletions jvm-statistics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,11 @@
<version>3.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime_2.12</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.criteo.hadoop.garmadon.jvm.utils;

import java.lang.reflect.Method;

public final class FlinkRuntime {
private static final String VERSION = computeVersion();

private FlinkRuntime() {
}

public static String getVersion() {
return VERSION;
}

static String computeVersion() {
try {
Class<?> clazz = Class.forName("org.apache.flink.runtime.util.EnvironmentInformation");
Method versionMethod = clazz.getDeclaredMethod("getVersion");
return (String) versionMethod.invoke(null);
} catch (Throwable e) {
return "unknown";
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.criteo.hadoop.garmadon.jvm.utils;

import junit.framework.TestCase;

import static org.assertj.core.api.Assertions.assertThat;

public class FlinkRuntimeTest extends TestCase {

public void test_get_version() {
assertThat(FlinkRuntime.getVersion()).isEqualTo("1.9.3");
}

}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<protobuf-dynamic.version>1.0.0</protobuf-dynamic.version>
<jackson.version>2.9.9</jackson.version>
<commons-io.version>2.6</commons-io.version>
<flink.version>1.6.4</flink.version>
<flink.version>1.9.3</flink.version>
<prestodb.version>0.217</prestodb.version>
<prestosql.version>315</prestosql.version>
<assertj.version>3.11.1</assertj.version>
Expand Down

0 comments on commit 4db8bf5

Please sign in to comment.