Return-Path: X-Original-To: apmail-ambari-dev-archive@www.apache.org Delivered-To: apmail-ambari-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 29A9010AA1 for ; Mon, 17 Nov 2014 20:01:43 +0000 (UTC) Received: (qmail 2328 invoked by uid 500); 17 Nov 2014 20:01:43 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 2289 invoked by uid 500); 17 Nov 2014 20:01:43 -0000 Mailing-List: contact dev-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ambari.apache.org Delivered-To: mailing list dev@ambari.apache.org Received: (qmail 2275 invoked by uid 99); 17 Nov 2014 20:01:42 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Nov 2014 20:01:42 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 0F1B711674E; Mon, 17 Nov 2014 20:01:42 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============7741198567424270351==" MIME-Version: 1.0 Subject: Re: Review Request 28123: Alert Groups REST Endpoint Should Support Associated Definitions From: "Tom Beerbower" To: "Nate Cole" , "Tom Beerbower" Cc: "Jonathan Hurley" , "Ambari" Date: Mon, 17 Nov 2014 20:01:42 -0000 Message-ID: <20141117200142.24717.98274@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org Auto-Submitted: auto-generated Sender: "Tom Beerbower" X-ReviewGroup: Ambari X-ReviewRequest-URL: https://reviews.apache.org/r/28123/ X-Sender: "Tom Beerbower" References: <20141117181717.24716.94885@reviews.apache.org> In-Reply-To: <20141117181717.24716.94885@reviews.apache.org> Reply-To: "Tom Beerbower" X-ReviewRequest-Repository: ambari --===============7741198567424270351== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/28123/#review61779 ----------------------------------------------------------- Did you consider making alert definitions a sub-resource of alert groups? So, http://localhost:8080/api/v1/clusters/c1/alert_groups/1/alert_definitions ... would get all the alert definitions for a specific alert group. And, http://localhost:8080/api/v1/clusters/c1/alert_groups?fields=alert_definitions ... would get all the alert definitions for all alert groups. The advantage of using a sub-resource instead of property is that the sub-resource is easier to query. For example if you wanted to get only the enabled alert definitions for an alert group, you could do this with sub-resources ... http://localhost:8080/api/v1/clusters/c1/alert_groups/1/alert_definitions?AlertDefinition/enabled=true Or if you don't want to return all the fields of the definitions ... http://localhost:8080/api/v1/clusters/c1/alert_groups/1/alert_definitions?fields=AlertDefinition/label With a property you have to get all or none. ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java I think that this check would fail if the caller asked for '?fields=AlertGroup', which should include evertything in that category. You could instead use BaseProvider.isPropertyRequested(String propertyId, Set requestedIds). - Tom Beerbower On Nov. 17, 2014, 6:17 p.m., Jonathan Hurley wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/28123/ > ----------------------------------------------------------- > > (Updated Nov. 17, 2014, 6:17 p.m.) > > > Review request for Ambari, Nate Cole and Tom Beerbower. > > > Bugs: AMBARI-8352 > https://issues.apache.org/jira/browse/AMBARI-8352 > > > Repository: ambari > > > Description > ------- > > When requesting a collection of alert groups via {{api/v1/clusters/c1/alert_groups}}, the alert definitions that are associated with that group should be a field that is also returned. > > ``` > http://localhost:8080/api/v1/clusters/c1/alert_groups?fields=AlertGroup/definitions > { > "href" : "http://localhost:8080/api/v1/clusters/c1/alert_groups?fields=AlertGroup/definitions", > "items" : [ > { > "href" : "http://localhost:8080/api/v1/clusters/c1/alert_groups/1", > "AlertGroup" : { > "cluster_name" : "c1", > "definitions" : [ > { > "name" : "ganglia_monitor_mapreduce_history_server", > "label" : "Ganglia History Server Process Monitor", > "enabled" : true, > "service_name" : "GANGLIA", > "component_name" : "GANGLIA_SERVER", > "id" : 1 > }, > { > "name" : "ganglia_monitor_yarn_resourcemanager", > "label" : "Ganglia ResourceManager Process Monitor", > "enabled" : true, > "service_name" : "GANGLIA", > "component_name" : "GANGLIA_SERVER", > "id" : 2 > }, > { > "name" : "ganglia_monitor_hdfs_namenode", > "label" : "Ganglia NameNode Process Monitor", > "enabled" : true, > "service_name" : "GANGLIA", > "component_name" : "GANGLIA_SERVER", > "id" : 3 > }, > { > "name" : "ganglia_monitor_hbase_master", > "label" : "Ganglia HBase Master Process Monitor", > "enabled" : true, > "service_name" : "GANGLIA", > "component_name" : "GANGLIA_SERVER", > "id" : 4 > }, > { > "name" : "ganglia_server_process", > "label" : "Ganglia Server Process", > "enabled" : true, > "service_name" : "GANGLIA", > "component_name" : "GANGLIA_SERVER", > "id" : 5 > } > ], > "id" : 1, > "name" : "GANGLIA" > } > } > ] > } > ``` > > > Diffs > ----- > > ambari-server/src/main/java/org/apache/ambari/server/controller/AlertDefinitionResponse.java 26e2f24 > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java 0c2fb72 > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProviderTest.java 1c85aeb > > Diff: https://reviews.apache.org/r/28123/diff/ > > > Testing > ------- > > New tests added; mvn clean test > > > Thanks, > > Jonathan Hurley > > --===============7741198567424270351==--