You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@helix.apache.org by brandtg <gi...@git.apache.org> on 2015/03/28 17:59:18 UTC

[GitHub] helix pull request: A user interface for viewing and administering...

GitHub user brandtg opened a pull request:

    https://github.com/apache/helix/pull/21

    A user interface for viewing and administering clusters

    See README.md in patch for more details

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/brandtg/helix master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/helix/pull/21.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #21
    
----
commit 6cbafef0351e9957b18c6fcbfe60ad1b4c8de94f
Author: Greg Brandt <br...@gmail.com>
Date:   2015-03-28T16:56:14Z

    A user interface for viewing and administering clusters

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on the pull request:

    https://github.com/apache/helix/pull/21#issuecomment-87272042
  
    Minor comments, otherwise this is awesome!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by brandtg <gi...@git.apache.org>.
Github user brandtg commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27347855
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/api/IdealStateSpec.java ---
    @@ -0,0 +1,94 @@
    +package org.apache.helix.ui.api;
    +
    +import org.apache.helix.model.IdealState;
    +
    +import java.util.List;
    +
    +public class IdealStateSpec {
    --- End diff --
    
    Yeah... I have mixed thoughts on this kind of stuff (if you're writing a schema to be used only in a Java project, why not just write the pojo). But IntelliJ generates everything faster than it takes to really think about it, so usually just do that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by brandtg <gi...@git.apache.org>.
Github user brandtg commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27347803
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/HelixUIApplication.java ---
    @@ -0,0 +1,74 @@
    +package org.apache.helix.ui;
    +
    +import com.google.common.collect.ImmutableMap;
    +import io.dropwizard.Application;
    +import io.dropwizard.assets.AssetsBundle;
    +import io.dropwizard.setup.Bootstrap;
    +import io.dropwizard.setup.Environment;
    +import io.dropwizard.views.ViewBundle;
    +import org.apache.helix.ui.health.ClusterConnectionHealthCheck;
    +import org.apache.helix.ui.resource.AdminResource;
    +import org.apache.helix.ui.resource.DashboardResource;
    +import org.apache.helix.ui.resource.VisualizerResource;
    +import org.apache.helix.ui.task.ClearClientCache;
    +import org.apache.helix.ui.task.ClearDataCacheTask;
    +import org.apache.helix.ui.util.ClientCache;
    +import org.apache.helix.ui.util.DataCache;
    +import org.apache.helix.ui.util.ZkAddressValidator;
    +import org.eclipse.jetty.util.component.AbstractLifeCycle;
    +import org.eclipse.jetty.util.component.LifeCycle;
    +
    +public class HelixUIApplication extends Application<HelixUIApplicationConfiguration> {
    +    @Override
    +    public String getName() {
    +        return "helix-ui";
    --- End diff --
    
    Will do.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by brandtg <gi...@git.apache.org>.
Github user brandtg commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27347802
  
    --- Diff: helix-ui/README.md ---
    @@ -0,0 +1,77 @@
    +# helix-ui
    +
    +After building the project from the root directory (i.e. `./build`), find the
    +`helix-ui-${version}.jar` artifact in this module's `target` directory.
    +
    +To run the UI server in read-only mode with no configuration, execute the
    +following commands:
    +
    +```
    +java -jar helix-ui-${version}.jar server
    +```
    +
    +Navigate to `http://localhost:8080/dashboard` to get started. At this page,
    +enter a ZooKeeper address, e.g. "localhost:2181,localhost:2182" or
    +"some-machine:2181/chroot", to get started.
    +
    +The following shows using the dashboard to view the end state of MyResource in
    +the Quick Start, in tabular form:
    +
    +![Quick Start End Table](doc/quickstart-end-table.png)
    --- End diff --
    
    If a resource is in FULL_AUTO, you'd probably see the instance name changing in the tabular view for each resource, and you'd probably see the partitions move among the instance circles in the graphical view.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27346617
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/HelixUIApplication.java ---
    @@ -0,0 +1,74 @@
    +package org.apache.helix.ui;
    +
    +import com.google.common.collect.ImmutableMap;
    +import io.dropwizard.Application;
    +import io.dropwizard.assets.AssetsBundle;
    +import io.dropwizard.setup.Bootstrap;
    +import io.dropwizard.setup.Environment;
    +import io.dropwizard.views.ViewBundle;
    +import org.apache.helix.ui.health.ClusterConnectionHealthCheck;
    +import org.apache.helix.ui.resource.AdminResource;
    +import org.apache.helix.ui.resource.DashboardResource;
    +import org.apache.helix.ui.resource.VisualizerResource;
    +import org.apache.helix.ui.task.ClearClientCache;
    +import org.apache.helix.ui.task.ClearDataCacheTask;
    +import org.apache.helix.ui.util.ClientCache;
    +import org.apache.helix.ui.util.DataCache;
    +import org.apache.helix.ui.util.ZkAddressValidator;
    +import org.eclipse.jetty.util.component.AbstractLifeCycle;
    +import org.eclipse.jetty.util.component.LifeCycle;
    +
    +public class HelixUIApplication extends Application<HelixUIApplicationConfiguration> {
    +    @Override
    +    public String getName() {
    +        return "helix-ui";
    --- End diff --
    
    nit: Indent 2 spaces instead of 4.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27347872
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/api/ResourceSpec.java ---
    @@ -0,0 +1,31 @@
    +package org.apache.helix.ui.api;
    +
    +public class ResourceSpec extends ClusterSpec {
    +    private final String resourceName;
    +
    +    public ResourceSpec(String zkAddress, String clusterName, String resourceName) {
    +        super(zkAddress, clusterName);
    +        this.resourceName = resourceName;
    +    }
    +
    +    public String getResourceName() {
    +        return resourceName;
    +    }
    +
    +    @Override
    +    public boolean equals(Object o) {
    +        if (!(o instanceof ResourceSpec)) {
    +            return false;
    +        }
    +        ResourceSpec c = (ResourceSpec) o;
    +        return getZkAddress().equals(c.getZkAddress())
    +                && getClusterName().equals(c.getClusterName())
    +                && resourceName.equals(c.getResourceName());
    +    }
    +
    +    @Override
    +    public int hashCode() {
    +        return super.hashCode() + 27 * resourceName.hashCode();
    --- End diff --
    
    It lets you avoid doing things like adding constants like 27, but I agree it's not a huge issue here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27346600
  
    --- Diff: helix-ui/README.md ---
    @@ -0,0 +1,77 @@
    +# helix-ui
    +
    +After building the project from the root directory (i.e. `./build`), find the
    +`helix-ui-${version}.jar` artifact in this module's `target` directory.
    +
    +To run the UI server in read-only mode with no configuration, execute the
    +following commands:
    +
    +```
    +java -jar helix-ui-${version}.jar server
    +```
    +
    +Navigate to `http://localhost:8080/dashboard` to get started. At this page,
    +enter a ZooKeeper address, e.g. "localhost:2181,localhost:2182" or
    +"some-machine:2181/chroot", to get started.
    +
    +The following shows using the dashboard to view the end state of MyResource in
    +the Quick Start, in tabular form:
    +
    +![Quick Start End Table](doc/quickstart-end-table.png)
    --- End diff --
    
    How does this look when the resource is configured in FULL_AUTO mode?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27346715
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/api/ResourceSpec.java ---
    @@ -0,0 +1,31 @@
    +package org.apache.helix.ui.api;
    +
    +public class ResourceSpec extends ClusterSpec {
    +    private final String resourceName;
    +
    +    public ResourceSpec(String zkAddress, String clusterName, String resourceName) {
    +        super(zkAddress, clusterName);
    +        this.resourceName = resourceName;
    +    }
    +
    +    public String getResourceName() {
    +        return resourceName;
    +    }
    +
    +    @Override
    +    public boolean equals(Object o) {
    +        if (!(o instanceof ResourceSpec)) {
    +            return false;
    +        }
    +        ResourceSpec c = (ResourceSpec) o;
    +        return getZkAddress().equals(c.getZkAddress())
    +                && getClusterName().equals(c.getClusterName())
    +                && resourceName.equals(c.getResourceName());
    +    }
    +
    +    @Override
    +    public int hashCode() {
    +        return super.hashCode() + 27 * resourceName.hashCode();
    --- End diff --
    
    Why not something like Guava's `Objects.hashCode`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by brandtg <gi...@git.apache.org>.
Github user brandtg commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27347827
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/api/ResourceSpec.java ---
    @@ -0,0 +1,31 @@
    +package org.apache.helix.ui.api;
    +
    +public class ResourceSpec extends ClusterSpec {
    +    private final String resourceName;
    +
    +    public ResourceSpec(String zkAddress, String clusterName, String resourceName) {
    +        super(zkAddress, clusterName);
    +        this.resourceName = resourceName;
    +    }
    +
    +    public String getResourceName() {
    +        return resourceName;
    +    }
    +
    +    @Override
    +    public boolean equals(Object o) {
    +        if (!(o instanceof ResourceSpec)) {
    +            return false;
    +        }
    +        ResourceSpec c = (ResourceSpec) o;
    +        return getZkAddress().equals(c.getZkAddress())
    +                && getClusterName().equals(c.getClusterName())
    +                && resourceName.equals(c.getResourceName());
    +    }
    +
    +    @Override
    +    public int hashCode() {
    +        return super.hashCode() + 27 * resourceName.hashCode();
    --- End diff --
    
    Probably a good idea, but I didn't know about it while writing this. Do you think this should be changed? I don't know if it really matters in this case because we're not putting a million of them in a HashMap or anything.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by brandtg <gi...@git.apache.org>.
Github user brandtg commented on the pull request:

    https://github.com/apache/helix/pull/21#issuecomment-87312379
  
    Done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27347876
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/api/IdealStateSpec.java ---
    @@ -0,0 +1,94 @@
    +package org.apache.helix.ui.api;
    +
    +import org.apache.helix.model.IdealState;
    +
    +import java.util.List;
    +
    +public class IdealStateSpec {
    --- End diff --
    
    Sure, makes sense.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on the pull request:

    https://github.com/apache/helix/pull/21#issuecomment-87331941
  
    Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by brandtg <gi...@git.apache.org>.
Github user brandtg commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27347780
  
    --- Diff: helix-ui/README.md ---
    @@ -0,0 +1,77 @@
    +# helix-ui
    --- End diff --
    
    Will do.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by brandtg <gi...@git.apache.org>.
Github user brandtg commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27347808
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/util/DataCache.java ---
    @@ -0,0 +1,188 @@
    +package org.apache.helix.ui.util;
    +
    +import com.google.common.cache.CacheBuilder;
    +import com.google.common.cache.CacheLoader;
    +import com.google.common.cache.LoadingCache;
    +import org.apache.helix.manager.zk.ZkClient;
    +import org.apache.helix.model.HelixConfigScope;
    +import org.apache.helix.model.InstanceConfig;
    +import org.apache.helix.model.builder.HelixConfigScopeBuilder;
    +import org.apache.helix.tools.ClusterSetup;
    +import org.apache.helix.ui.api.*;
    +
    +import java.util.*;
    +import java.util.concurrent.TimeUnit;
    +
    +public class DataCache {
    --- End diff --
    
    Thanks haha


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27346589
  
    --- Diff: helix-ui/README.md ---
    @@ -0,0 +1,77 @@
    +# helix-ui
    --- End diff --
    
    All files need to start with the Apache license header.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on the pull request:

    https://github.com/apache/helix/pull/21#issuecomment-87291842
  
    Can you run `mvn -Prat -DskipTests` inside helix-ui? Once that passes, I think this is good to merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27346681
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/api/IdealStateSpec.java ---
    @@ -0,0 +1,94 @@
    +package org.apache.helix.ui.api;
    +
    +import org.apache.helix.model.IdealState;
    +
    +import java.util.List;
    +
    +public class IdealStateSpec {
    --- End diff --
    
    jsonschema2pojo (or similar) would be useful for classes like this, but not a big deal.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/helix/pull/21


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] helix pull request: A user interface for viewing and administering...

Posted by kanakb <gi...@git.apache.org>.
Github user kanakb commented on a diff in the pull request:

    https://github.com/apache/helix/pull/21#discussion_r27346747
  
    --- Diff: helix-ui/src/main/java/org/apache/helix/ui/util/DataCache.java ---
    @@ -0,0 +1,188 @@
    +package org.apache.helix.ui.util;
    +
    +import com.google.common.cache.CacheBuilder;
    +import com.google.common.cache.CacheLoader;
    +import com.google.common.cache.LoadingCache;
    +import org.apache.helix.manager.zk.ZkClient;
    +import org.apache.helix.model.HelixConfigScope;
    +import org.apache.helix.model.InstanceConfig;
    +import org.apache.helix.model.builder.HelixConfigScopeBuilder;
    +import org.apache.helix.tools.ClusterSetup;
    +import org.apache.helix.ui.api.*;
    +
    +import java.util.*;
    +import java.util.concurrent.TimeUnit;
    +
    +public class DataCache {
    --- End diff --
    
    Nice use of `LoadingCache`s.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---