Checking isHeadless from displayDevice
import com.snowplowanalytics.snowplow.tracker.events.Unstructured;
import com.snowplowanalytics.snowplow.tracker.payload.SelfDescribingJson;
import org.lwjgl.opengl.GL11;
+import org.terasology.context.Context;
+import org.terasology.engine.subsystem.DisplayDevice;
+import org.terasology.registry.CoreRegistry;
import org.terasology.telemetry.TelemetryCategory;
import org.terasology.telemetry.TelemetryField;
public class SystemContextMetric extends Metric {
public static final String SCHEMA_OS = "iglu:org.terasology/systemContext/jsonschema/1-0-0";
+ private boolean isHeadless;
+ private Context context;
@TelemetryField
private String osName;
@@ -79,9 +84,14 @@ public SystemContextMetric() {
javaVersion = System.getProperty("java.version");
jvmName = System.getProperty("java.vm.name");
jvmVersion = System.getProperty("java.vm.version");
+ context = CoreRegistry.get(Context.class);
+ DisplayDevice display = context.get(DisplayDevice.class);
+ isHeadless = display.isHeadless();
+ if (!isHeadless) {
openGLVendor = GL11.glGetString(GL11.GL_VENDOR);
openGLVersion = GL11.glGetString(GL11.GL_VERSION);
openGLRenderer = GL11.glGetString(GL11.GL_RENDERER);
+ }
processorNumbers = Runtime.getRuntime().availableProcessors();
memoryMaxByte = Runtime.getRuntime().maxMemory();
}
