mirror of https://github.com/apache/druid.git
Merge branch 'master' of github.com:metamx/druid
This commit is contained in:
commit
8783007eb1
|
@ -53,4 +53,20 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -168,7 +168,15 @@
|
|||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -104,6 +104,14 @@
|
|||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
|
@ -71,4 +71,20 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -101,6 +101,17 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
|
|
|
@ -160,4 +160,20 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -116,4 +116,20 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -55,4 +55,19 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
3
pom.xml
3
pom.xml
|
@ -41,6 +41,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<metamx.java-util.version>0.25.0</metamx.java-util.version>
|
||||
<apache.curator.version>2.1.0-incubating</apache.curator.version>
|
||||
<druid.api.version>0.1.3</druid.api.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
|
@ -65,7 +66,7 @@
|
|||
<dependency>
|
||||
<groupId>io.druid</groupId>
|
||||
<artifactId>druid-api</artifactId>
|
||||
<version>0.1.3</version>
|
||||
<version>${druid.api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Compile Scope -->
|
||||
|
|
|
@ -133,6 +133,14 @@
|
|||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
|
@ -66,4 +66,19 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -220,8 +220,6 @@
|
|||
<artifactId>caliper</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -235,6 +233,14 @@
|
|||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.antlr</groupId>
|
||||
|
|
|
@ -20,10 +20,16 @@
|
|||
package io.druid.server;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.inject.Injector;
|
||||
import io.druid.initialization.DruidModule;
|
||||
import io.druid.initialization.Initialization;
|
||||
import io.druid.server.initialization.ExtensionsConfig;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -33,20 +39,60 @@ public class StatusResource
|
|||
@GET
|
||||
@Produces("application/json")
|
||||
public Status doGet()
|
||||
{
|
||||
return getStatus();
|
||||
}
|
||||
|
||||
public static Status getStatus()
|
||||
{
|
||||
return new Status(
|
||||
StatusResource.class.getPackage().getImplementationVersion(),
|
||||
Initialization.class.getPackage().getImplementationVersion(),
|
||||
getExtensionVersions(),
|
||||
new Memory(Runtime.getRuntime())
|
||||
);
|
||||
}
|
||||
|
||||
public static class Status {
|
||||
/**
|
||||
* Load the unique extensions and return their implementation-versions
|
||||
*
|
||||
* @return map of extensions loaded with their respective implementation versions.
|
||||
*/
|
||||
private static List<ModuleVersion> getExtensionVersions()
|
||||
{
|
||||
final Injector injector = Initialization.makeStartupInjector();
|
||||
final ExtensionsConfig config = injector.getInstance(ExtensionsConfig.class);
|
||||
final List<DruidModule> druidModules = Initialization.getFromExtensions(config, DruidModule.class);
|
||||
|
||||
List<ModuleVersion> moduleVersions = new ArrayList<>();
|
||||
for (DruidModule module : druidModules) {
|
||||
|
||||
String artifact = module.getClass().getPackage().getImplementationTitle();
|
||||
String version = module.getClass().getPackage().getImplementationVersion();
|
||||
|
||||
ModuleVersion moduleVersion;
|
||||
if (artifact != null) {
|
||||
moduleVersion = new ModuleVersion(module.getClass().getCanonicalName(), artifact, version);
|
||||
} else {
|
||||
moduleVersion = new ModuleVersion(module.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
moduleVersions.add(moduleVersion);
|
||||
}
|
||||
return moduleVersions;
|
||||
}
|
||||
|
||||
public static class Status
|
||||
{
|
||||
final String version;
|
||||
final List<ModuleVersion> modules;
|
||||
final Memory memory;
|
||||
|
||||
public Status(String version, Memory memory)
|
||||
public Status(
|
||||
String version, List<ModuleVersion> modules, Memory memory
|
||||
)
|
||||
{
|
||||
this.version = version;
|
||||
this.modules = modules;
|
||||
this.memory = memory;
|
||||
}
|
||||
|
||||
|
@ -56,20 +102,94 @@ public class StatusResource
|
|||
return version;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public List<ModuleVersion> getModules()
|
||||
{
|
||||
return modules;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public Memory getMemory()
|
||||
{
|
||||
return memory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
final String NL = "\n";
|
||||
StringBuilder output = new StringBuilder();
|
||||
output.append(String.format("Druid version - %s", version)).append(NL).append(NL);
|
||||
|
||||
if (modules.size() > 0) {
|
||||
output.append("Registered Druid Modules").append(NL);
|
||||
} else {
|
||||
output.append("No Druid Modules loaded !");
|
||||
}
|
||||
|
||||
for (ModuleVersion moduleVersion : modules) {
|
||||
output.append(moduleVersion).append(NL);
|
||||
}
|
||||
return output.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Memory {
|
||||
public static class ModuleVersion
|
||||
{
|
||||
final String name;
|
||||
final String artifact;
|
||||
final String version;
|
||||
|
||||
public ModuleVersion(String name)
|
||||
{
|
||||
this(name, "", "");
|
||||
}
|
||||
|
||||
public ModuleVersion(String name, String artifact, String version)
|
||||
{
|
||||
this.name = name;
|
||||
this.artifact = artifact;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public String getArtifact()
|
||||
{
|
||||
return artifact;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
if (artifact.isEmpty()) {
|
||||
return String.format(" - %s ", name);
|
||||
} else {
|
||||
return String.format(" - %s (%s-%s)", name, artifact, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class Memory
|
||||
{
|
||||
final long maxMemory;
|
||||
final long totalMemory;
|
||||
final long freeMemory;
|
||||
final long usedMemory;
|
||||
|
||||
public Memory(Runtime runtime) {
|
||||
public Memory(Runtime runtime)
|
||||
{
|
||||
maxMemory = runtime.maxMemory();
|
||||
totalMemory = runtime.totalMemory();
|
||||
freeMemory = runtime.freeMemory();
|
||||
|
@ -99,5 +219,6 @@ public class StatusResource
|
|||
{
|
||||
return usedMemory;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div>
|
||||
<h2>Druid Version: ${pom.version} Druid API Version: ${druid.api.version}</h2>
|
||||
</div>
|
||||
<div>
|
||||
<a href="view.html">View Information about the Cluster</a>
|
||||
</div>
|
||||
|
|
|
@ -51,8 +51,20 @@
|
|||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
|
|
|
@ -27,6 +27,8 @@ import io.druid.cli.convert.ConvertProperties;
|
|||
import io.druid.cli.validate.DruidJsonValidator;
|
||||
import io.druid.initialization.Initialization;
|
||||
import io.druid.server.initialization.ExtensionsConfig;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -41,7 +43,7 @@ public class Main
|
|||
|
||||
builder.withDescription("Druid command-line runner.")
|
||||
.withDefaultCommand(Help.class)
|
||||
.withCommands(Help.class);
|
||||
.withCommands(Help.class, Version.class);
|
||||
|
||||
builder.withGroup("server")
|
||||
.withDescription("Run one of the Druid server types.")
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Druid - a distributed column store.
|
||||
* Copyright (C) 2012, 2013 Metamarkets Group Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package io.druid.cli;
|
||||
|
||||
import io.airlift.command.Command;
|
||||
import io.druid.server.StatusResource;
|
||||
|
||||
@Command(
|
||||
name = "version",
|
||||
description = "Returns Druid version information"
|
||||
)
|
||||
public class Version implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
System.out.println(StatusResource.getStatus());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue