[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335254646
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-checks.tsx
 ##
 @@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import axios from 'axios';
+
+import { pluralIfNeeded, queryDruidSql } from '../../utils';
+import { deepGet } from '../../utils/object-change';
+import { postToSampler } from '../../utils/sampler';
+
+export interface CheckControls {
+  addSuggestion: (message: string) => void;
+  addIssue: (message: string) => void;
+  terminateChecks: () => void;
+}
+
+export interface DoctorCheck {
+  name: string;
+  check: (controls: CheckControls) => Promise;
+}
+
+const RUNTIME_PROPERTIES_ALL_NODES_MUST_AGREE_ON: string[] = [
+  'user.timezone',
+  'druid.zk.service.host',
+];
+
+const RUNTIME_PROPERTIES_ALL_NODES_SHOULD_AGREE_ON: string[] = 
['java.version'];
+
+// In the future (when we can query other nodes) is will also be cool to check:
+// 'druid.storage.type' <=> historicals, overlords, mm
+// 'druid.indexer.logs.type' <=> overlord, mm, + peons
+
+const RUNTIME_PROPERTIES_MASTER_NODES_SHOULD_AGREE_ON: string[] = [
+  'druid.metadata.storage.type', // overlord + coordinator
+  'druid.metadata.storage.connector.connectURI',
+];
+
+export const DOCTOR_CHECKS: DoctorCheck[] = [
+  // -
+  // Self (router) checks
+  // -
+  {
+name: 'Verify own status',
+check: async controls => {
+  // Make sure that the router responds to /status and gives some valid 
info back
+  let status: any;
+  try {
+status = (await axios.get(`/status`)).data;
+  } catch (e) {
+controls.addIssue(
+  `Did not get a /status response, is the cluster running? Got: 
${e.message}`,
+);
+controls.terminateChecks();
+return;
+  }
+
+  if (typeof status.version !== 'string') {
+controls.addIssue('Could not get a valid /status response.');
+  }
+},
+  },
+  {
+name: 'Verify own runtime properties',
+check: async controls => {
+  // Make sure that everything in /status/properties is above board
+  let properties: Record;
+  try {
+properties = (await axios.get(`/status/properties`)).data;
+  } catch (e) {
+controls.addIssue('Did not get a /status/properties response, 
something must be broken.');
 
 Review comment:
   "from the Router"?
   
   Also, "something must be broken" isn't adding much. If we have any 
speculation about why this might happen, add it here, otherwise I think we 
don't have much to say.
   
   Btw, I'd suggest checking for an unauthorized response and translate that 
into something like "You are not authorized to access the XXX API." (for every 
case where the response is generated). This way it'll degrade nicely for secure 
clusters.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335255062
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-checks.tsx
 ##
 @@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import axios from 'axios';
+
+import { pluralIfNeeded, queryDruidSql } from '../../utils';
+import { deepGet } from '../../utils/object-change';
+import { postToSampler } from '../../utils/sampler';
+
+export interface CheckControls {
+  addSuggestion: (message: string) => void;
+  addIssue: (message: string) => void;
+  terminateChecks: () => void;
+}
+
+export interface DoctorCheck {
+  name: string;
+  check: (controls: CheckControls) => Promise;
+}
+
+const RUNTIME_PROPERTIES_ALL_NODES_MUST_AGREE_ON: string[] = [
+  'user.timezone',
+  'druid.zk.service.host',
+];
+
+const RUNTIME_PROPERTIES_ALL_NODES_SHOULD_AGREE_ON: string[] = 
['java.version'];
+
+// In the future (when we can query other nodes) is will also be cool to check:
+// 'druid.storage.type' <=> historicals, overlords, mm
+// 'druid.indexer.logs.type' <=> overlord, mm, + peons
+
+const RUNTIME_PROPERTIES_MASTER_NODES_SHOULD_AGREE_ON: string[] = [
+  'druid.metadata.storage.type', // overlord + coordinator
+  'druid.metadata.storage.connector.connectURI',
+];
+
+export const DOCTOR_CHECKS: DoctorCheck[] = [
+  // -
+  // Self (router) checks
+  // -
+  {
+name: 'Verify own status',
+check: async controls => {
+  // Make sure that the router responds to /status and gives some valid 
info back
+  let status: any;
+  try {
+status = (await axios.get(`/status`)).data;
+  } catch (e) {
+controls.addIssue(
+  `Did not get a /status response, is the cluster running? Got: 
${e.message}`,
+);
+controls.terminateChecks();
+return;
+  }
+
+  if (typeof status.version !== 'string') {
+controls.addIssue('Could not get a valid /status response.');
+  }
+},
+  },
+  {
+name: 'Verify own runtime properties',
+check: async controls => {
+  // Make sure that everything in /status/properties is above board
+  let properties: Record;
+  try {
+properties = (await axios.get(`/status/properties`)).data;
+  } catch (e) {
+controls.addIssue('Did not get a /status/properties response, 
something must be broken.');
+return;
+  }
+
+  // Check that the management proxy is on, it really should be for 
someone to access the console in the first place but everything could happen
+  if (properties['druid.router.managementProxy.enabled'] !== 'true') {
+controls.addIssue(
+  `The router's "druid.router.managementProxy.enabled" is not reported 
as "true" that is unusual.`,
+);
+  }
+
+  // Check that the underlying Java is Java 8 the only officially 
supported Java version at the moment.
+  if (
+properties['java.runtime.version'] &&
+!properties['java.runtime.version'].startsWith('1.8')
+  ) {
+controls.addSuggestion(
+  `It looks like are running Java 
${properties['java.runtime.version']}, Druid only officially supports Java 
1.8.x`,
 
 Review comment:
   `java.specification.version` may be easier to parse. (startsWith 1.8 is a 
little brittle, what happens when 1.80 is out )
   
   A period seems more grammatical to me here (vs. a comma).


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335256239
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-checks.tsx
 ##
 @@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import axios from 'axios';
+
+import { pluralIfNeeded, queryDruidSql } from '../../utils';
+import { deepGet } from '../../utils/object-change';
+import { postToSampler } from '../../utils/sampler';
+
+export interface CheckControls {
+  addSuggestion: (message: string) => void;
+  addIssue: (message: string) => void;
+  terminateChecks: () => void;
+}
+
+export interface DoctorCheck {
+  name: string;
+  check: (controls: CheckControls) => Promise;
+}
+
+const RUNTIME_PROPERTIES_ALL_NODES_MUST_AGREE_ON: string[] = [
+  'user.timezone',
+  'druid.zk.service.host',
+];
+
+const RUNTIME_PROPERTIES_ALL_NODES_SHOULD_AGREE_ON: string[] = 
['java.version'];
+
+// In the future (when we can query other nodes) is will also be cool to check:
+// 'druid.storage.type' <=> historicals, overlords, mm
+// 'druid.indexer.logs.type' <=> overlord, mm, + peons
+
+const RUNTIME_PROPERTIES_MASTER_NODES_SHOULD_AGREE_ON: string[] = [
+  'druid.metadata.storage.type', // overlord + coordinator
+  'druid.metadata.storage.connector.connectURI',
+];
+
+export const DOCTOR_CHECKS: DoctorCheck[] = [
+  // -
+  // Self (router) checks
+  // -
+  {
+name: 'Verify own status',
+check: async controls => {
+  // Make sure that the router responds to /status and gives some valid 
info back
+  let status: any;
+  try {
+status = (await axios.get(`/status`)).data;
+  } catch (e) {
+controls.addIssue(
+  `Did not get a /status response, is the cluster running? Got: 
${e.message}`,
+);
+controls.terminateChecks();
+return;
+  }
+
+  if (typeof status.version !== 'string') {
+controls.addIssue('Could not get a valid /status response.');
+  }
+},
+  },
+  {
+name: 'Verify own runtime properties',
+check: async controls => {
+  // Make sure that everything in /status/properties is above board
+  let properties: Record;
+  try {
+properties = (await axios.get(`/status/properties`)).data;
+  } catch (e) {
+controls.addIssue('Did not get a /status/properties response, 
something must be broken.');
+return;
+  }
+
+  // Check that the management proxy is on, it really should be for 
someone to access the console in the first place but everything could happen
+  if (properties['druid.router.managementProxy.enabled'] !== 'true') {
+controls.addIssue(
+  `The router's "druid.router.managementProxy.enabled" is not reported 
as "true" that is unusual.`,
+);
+  }
+
+  // Check that the underlying Java is Java 8 the only officially 
supported Java version at the moment.
+  if (
+properties['java.runtime.version'] &&
+!properties['java.runtime.version'].startsWith('1.8')
+  ) {
+controls.addSuggestion(
+  `It looks like are running Java 
${properties['java.runtime.version']}, Druid only officially supports Java 
1.8.x`,
+);
+  }
+
+  // Check that "user.timezone"
+  if (properties['user.timezone'] && properties['user.timezone'] !== 
'UTC') {
+controls.addSuggestion(
+  `It looks like "user.timezone" is set to 
${properties['user.timezone']}, it is recommended to set this to "UTC"`,
+);
+  }
+},
+  },
+
+  // -
+  // Coordinator and Overlord
+  // -
+  {
+name: 'Verify the Coordinator and Overlord status',
+check: async controls => {
+  // Make sure that everything in Coordinator's /status is good
+  let myStatus: any;
+  try {
+myStatus = (await axios.get(`/status`)).data;
+  } catch {
+return;
+  }
+
+  let coordinatorStatus: any;
+  try {
+coordinatorStatus = (await 
axios.get(`/proxy/coordinator/status`)).data;
+

[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335252556
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-dialog.tsx
 ##
 @@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Button, Callout, Classes, Dialog, Intent } from '@blueprintjs/core';
+import { IconNames } from '@blueprintjs/icons';
+import React from 'react';
+
+import { delay, pluralIfNeeded } from '../../utils';
+
+import { DOCTOR_CHECKS } from './doctor-checks';
+
+import './doctor-dialog.scss';
+
+interface Diagnosis {
+  type: 'suggestion' | 'issue';
+  check: string;
+  message: string;
+}
+
+export interface DoctorDialogProps {
+  onClose: () => void;
+}
+
+export interface DoctorDialogState {
+  currentCheckIndex?: number;
+  diagnoses?: Diagnosis[];
+  earlyTermination?: string;
+}
+
+export class DoctorDialog extends React.PureComponent {
+  private mounted = false;
+
+  constructor(props: DoctorDialogProps, context: any) {
+super(props, context);
+this.state = {};
+  }
+
+  componentDidMount(): void {
+this.mounted = true;
+  }
+
+  componentWillUnmount(): void {
+this.mounted = false;
+  }
+
+  async doChecks() {
+this.setState({ currentCheckIndex: 0, diagnoses: [] });
+
+const addToDiagnoses = (diagnosis: Diagnosis) => {
+  if (!this.mounted) return;
+  this.setState(oldState => ({
+diagnoses: (oldState.diagnoses || []).concat(diagnosis),
+  }));
+};
+
+for (let i = 0; i < DOCTOR_CHECKS.length; i++) {
+  if (!this.mounted) return;
+  this.setState({ currentCheckIndex: i });
+  const check = DOCTOR_CHECKS[i];
+  let terminateChecks = false;
+
+  // Slow down a bit so that the user can read the test name
+  await delay(500);
+
+  if (!this.mounted) return;
+  try {
+await check.check({
+  addSuggestion: (message: string) => {
+addToDiagnoses({
+  type: 'suggestion',
+  check: check.name,
+  message,
+});
+  },
+  addIssue: (message: string) => {
+addToDiagnoses({
+  type: 'issue',
+  check: check.name,
+  message,
+});
+  },
+  terminateChecks: () => {
+if (!this.mounted) return;
+this.setState({
+  earlyTermination: `${check.name} early terminated the check 
suite`,
+});
+terminateChecks = true;
+  },
+});
+  } catch (e) {
+addToDiagnoses({
+  type: 'issue',
+  check: check.name,
+  message: `${check.name} encountered an unhandled exception`,
 
 Review comment:
   What might cause this? (Anyone that sees it will be left scratching their 
heads, maybe we can help them out a bit)


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335254173
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-checks.tsx
 ##
 @@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import axios from 'axios';
+
+import { pluralIfNeeded, queryDruidSql } from '../../utils';
+import { deepGet } from '../../utils/object-change';
+import { postToSampler } from '../../utils/sampler';
+
+export interface CheckControls {
+  addSuggestion: (message: string) => void;
+  addIssue: (message: string) => void;
+  terminateChecks: () => void;
+}
+
+export interface DoctorCheck {
+  name: string;
+  check: (controls: CheckControls) => Promise;
+}
+
+const RUNTIME_PROPERTIES_ALL_NODES_MUST_AGREE_ON: string[] = [
+  'user.timezone',
+  'druid.zk.service.host',
+];
+
+const RUNTIME_PROPERTIES_ALL_NODES_SHOULD_AGREE_ON: string[] = 
['java.version'];
+
+// In the future (when we can query other nodes) is will also be cool to check:
+// 'druid.storage.type' <=> historicals, overlords, mm
+// 'druid.indexer.logs.type' <=> overlord, mm, + peons
+
+const RUNTIME_PROPERTIES_MASTER_NODES_SHOULD_AGREE_ON: string[] = [
+  'druid.metadata.storage.type', // overlord + coordinator
+  'druid.metadata.storage.connector.connectURI',
+];
+
+export const DOCTOR_CHECKS: DoctorCheck[] = [
+  // -
+  // Self (router) checks
+  // -
+  {
+name: 'Verify own status',
+check: async controls => {
+  // Make sure that the router responds to /status and gives some valid 
info back
+  let status: any;
+  try {
+status = (await axios.get(`/status`)).data;
+  } catch (e) {
+controls.addIssue(
+  `Did not get a /status response, is the cluster running? Got: 
${e.message}`,
 
 Review comment:
   How about using "Router" not "cluster" here.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335253407
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-dialog.tsx
 ##
 @@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Button, Callout, Classes, Dialog, Intent } from '@blueprintjs/core';
+import { IconNames } from '@blueprintjs/icons';
+import React from 'react';
+
+import { delay, pluralIfNeeded } from '../../utils';
+
+import { DOCTOR_CHECKS } from './doctor-checks';
+
+import './doctor-dialog.scss';
+
+interface Diagnosis {
+  type: 'suggestion' | 'issue';
+  check: string;
+  message: string;
+}
+
+export interface DoctorDialogProps {
+  onClose: () => void;
+}
+
+export interface DoctorDialogState {
+  currentCheckIndex?: number;
+  diagnoses?: Diagnosis[];
+  earlyTermination?: string;
+}
+
+export class DoctorDialog extends React.PureComponent {
+  private mounted = false;
+
+  constructor(props: DoctorDialogProps, context: any) {
+super(props, context);
+this.state = {};
+  }
+
+  componentDidMount(): void {
+this.mounted = true;
+  }
+
+  componentWillUnmount(): void {
+this.mounted = false;
+  }
+
+  async doChecks() {
+this.setState({ currentCheckIndex: 0, diagnoses: [] });
+
+const addToDiagnoses = (diagnosis: Diagnosis) => {
+  if (!this.mounted) return;
+  this.setState(oldState => ({
+diagnoses: (oldState.diagnoses || []).concat(diagnosis),
+  }));
+};
+
+for (let i = 0; i < DOCTOR_CHECKS.length; i++) {
+  if (!this.mounted) return;
+  this.setState({ currentCheckIndex: i });
+  const check = DOCTOR_CHECKS[i];
+  let terminateChecks = false;
+
+  // Slow down a bit so that the user can read the test name
+  await delay(500);
+
+  if (!this.mounted) return;
+  try {
+await check.check({
 
 Review comment:
   Does anything get printed for checks that find no issues? Should it?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335252958
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-dialog.tsx
 ##
 @@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Button, Callout, Classes, Dialog, Intent } from '@blueprintjs/core';
+import { IconNames } from '@blueprintjs/icons';
+import React from 'react';
+
+import { delay, pluralIfNeeded } from '../../utils';
+
+import { DOCTOR_CHECKS } from './doctor-checks';
+
+import './doctor-dialog.scss';
+
+interface Diagnosis {
+  type: 'suggestion' | 'issue';
+  check: string;
+  message: string;
+}
+
+export interface DoctorDialogProps {
+  onClose: () => void;
+}
+
+export interface DoctorDialogState {
+  currentCheckIndex?: number;
+  diagnoses?: Diagnosis[];
+  earlyTermination?: string;
+}
+
+export class DoctorDialog extends React.PureComponent {
+  private mounted = false;
+
+  constructor(props: DoctorDialogProps, context: any) {
+super(props, context);
+this.state = {};
+  }
+
+  componentDidMount(): void {
+this.mounted = true;
+  }
+
+  componentWillUnmount(): void {
+this.mounted = false;
+  }
+
+  async doChecks() {
+this.setState({ currentCheckIndex: 0, diagnoses: [] });
+
+const addToDiagnoses = (diagnosis: Diagnosis) => {
+  if (!this.mounted) return;
+  this.setState(oldState => ({
+diagnoses: (oldState.diagnoses || []).concat(diagnosis),
+  }));
+};
+
+for (let i = 0; i < DOCTOR_CHECKS.length; i++) {
+  if (!this.mounted) return;
+  this.setState({ currentCheckIndex: i });
+  const check = DOCTOR_CHECKS[i];
+  let terminateChecks = false;
+
+  // Slow down a bit so that the user can read the test name
+  await delay(500);
 
 Review comment:
   Is this so they appear slowly and look like they are really working hard?
   
   If so, lol.
   
   Also, I dunno, maybe don't do it. Assuming it's milliseconds, 500ms is a 
long time.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335252410
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-dialog.tsx
 ##
 @@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Button, Callout, Classes, Dialog, Intent } from '@blueprintjs/core';
+import { IconNames } from '@blueprintjs/icons';
+import React from 'react';
+
+import { delay, pluralIfNeeded } from '../../utils';
+
+import { DOCTOR_CHECKS } from './doctor-checks';
+
+import './doctor-dialog.scss';
+
+interface Diagnosis {
+  type: 'suggestion' | 'issue';
+  check: string;
+  message: string;
+}
+
+export interface DoctorDialogProps {
+  onClose: () => void;
+}
+
+export interface DoctorDialogState {
+  currentCheckIndex?: number;
+  diagnoses?: Diagnosis[];
+  earlyTermination?: string;
+}
+
+export class DoctorDialog extends React.PureComponent {
+  private mounted = false;
+
+  constructor(props: DoctorDialogProps, context: any) {
+super(props, context);
+this.state = {};
+  }
+
+  componentDidMount(): void {
+this.mounted = true;
+  }
+
+  componentWillUnmount(): void {
+this.mounted = false;
+  }
+
+  async doChecks() {
+this.setState({ currentCheckIndex: 0, diagnoses: [] });
+
+const addToDiagnoses = (diagnosis: Diagnosis) => {
+  if (!this.mounted) return;
+  this.setState(oldState => ({
+diagnoses: (oldState.diagnoses || []).concat(diagnosis),
+  }));
+};
+
+for (let i = 0; i < DOCTOR_CHECKS.length; i++) {
+  if (!this.mounted) return;
+  this.setState({ currentCheckIndex: i });
+  const check = DOCTOR_CHECKS[i];
+  let terminateChecks = false;
+
+  // Slow down a bit so that the user can read the test name
+  await delay(500);
+
+  if (!this.mounted) return;
+  try {
+await check.check({
+  addSuggestion: (message: string) => {
+addToDiagnoses({
+  type: 'suggestion',
+  check: check.name,
+  message,
+});
+  },
+  addIssue: (message: string) => {
+addToDiagnoses({
+  type: 'issue',
+  check: check.name,
+  message,
+});
+  },
+  terminateChecks: () => {
+if (!this.mounted) return;
+this.setState({
+  earlyTermination: `${check.name} early terminated the check 
suite`,
 
 Review comment:
   This line made the screenshot confusing to me (I had a moment like, what 
does "Verify own status early terminated" mean? We want to verify that the 
status has early terminated?).
   
   Maybe be more explicit that the check name is part of the message. Also, 
what does it mean when a check early terminated the check suite? Is it because 
the check found a problem? Or because it couldn't run at all? (This should be 
obvious through the message)


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335253927
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-checks.tsx
 ##
 @@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import axios from 'axios';
+
+import { pluralIfNeeded, queryDruidSql } from '../../utils';
+import { deepGet } from '../../utils/object-change';
+import { postToSampler } from '../../utils/sampler';
+
+export interface CheckControls {
+  addSuggestion: (message: string) => void;
+  addIssue: (message: string) => void;
+  terminateChecks: () => void;
+}
+
+export interface DoctorCheck {
+  name: string;
+  check: (controls: CheckControls) => Promise;
+}
+
+const RUNTIME_PROPERTIES_ALL_NODES_MUST_AGREE_ON: string[] = [
+  'user.timezone',
+  'druid.zk.service.host',
+];
+
+const RUNTIME_PROPERTIES_ALL_NODES_SHOULD_AGREE_ON: string[] = 
['java.version'];
 
 Review comment:
   This could be too aggressive. It's fine if different servers have different 
java versions, and would be normal if you're rolling a java upgrade through 
your servers, or if you just simply aren't fastidious about keeping them all at 
exactly the same version. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335255846
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-checks.tsx
 ##
 @@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import axios from 'axios';
+
+import { pluralIfNeeded, queryDruidSql } from '../../utils';
+import { deepGet } from '../../utils/object-change';
+import { postToSampler } from '../../utils/sampler';
+
+export interface CheckControls {
+  addSuggestion: (message: string) => void;
+  addIssue: (message: string) => void;
+  terminateChecks: () => void;
+}
+
+export interface DoctorCheck {
+  name: string;
+  check: (controls: CheckControls) => Promise;
+}
+
+const RUNTIME_PROPERTIES_ALL_NODES_MUST_AGREE_ON: string[] = [
+  'user.timezone',
+  'druid.zk.service.host',
+];
+
+const RUNTIME_PROPERTIES_ALL_NODES_SHOULD_AGREE_ON: string[] = 
['java.version'];
+
+// In the future (when we can query other nodes) is will also be cool to check:
+// 'druid.storage.type' <=> historicals, overlords, mm
+// 'druid.indexer.logs.type' <=> overlord, mm, + peons
+
+const RUNTIME_PROPERTIES_MASTER_NODES_SHOULD_AGREE_ON: string[] = [
+  'druid.metadata.storage.type', // overlord + coordinator
+  'druid.metadata.storage.connector.connectURI',
+];
+
+export const DOCTOR_CHECKS: DoctorCheck[] = [
+  // -
+  // Self (router) checks
+  // -
+  {
+name: 'Verify own status',
+check: async controls => {
+  // Make sure that the router responds to /status and gives some valid 
info back
+  let status: any;
+  try {
+status = (await axios.get(`/status`)).data;
+  } catch (e) {
+controls.addIssue(
+  `Did not get a /status response, is the cluster running? Got: 
${e.message}`,
+);
+controls.terminateChecks();
+return;
+  }
+
+  if (typeof status.version !== 'string') {
+controls.addIssue('Could not get a valid /status response.');
+  }
+},
+  },
+  {
+name: 'Verify own runtime properties',
+check: async controls => {
+  // Make sure that everything in /status/properties is above board
+  let properties: Record;
+  try {
+properties = (await axios.get(`/status/properties`)).data;
+  } catch (e) {
+controls.addIssue('Did not get a /status/properties response, 
something must be broken.');
+return;
+  }
+
+  // Check that the management proxy is on, it really should be for 
someone to access the console in the first place but everything could happen
+  if (properties['druid.router.managementProxy.enabled'] !== 'true') {
+controls.addIssue(
+  `The router's "druid.router.managementProxy.enabled" is not reported 
as "true" that is unusual.`,
+);
+  }
+
+  // Check that the underlying Java is Java 8 the only officially 
supported Java version at the moment.
+  if (
+properties['java.runtime.version'] &&
+!properties['java.runtime.version'].startsWith('1.8')
+  ) {
+controls.addSuggestion(
+  `It looks like are running Java 
${properties['java.runtime.version']}, Druid only officially supports Java 
1.8.x`,
+);
+  }
+
+  // Check that "user.timezone"
+  if (properties['user.timezone'] && properties['user.timezone'] !== 
'UTC') {
+controls.addSuggestion(
+  `It looks like "user.timezone" is set to 
${properties['user.timezone']}, it is recommended to set this to "UTC"`,
+);
+  }
+},
+  },
+
+  // -
+  // Coordinator and Overlord
+  // -
+  {
+name: 'Verify the Coordinator and Overlord status',
+check: async controls => {
+  // Make sure that everything in Coordinator's /status is good
+  let myStatus: any;
+  try {
+myStatus = (await axios.get(`/status`)).data;
+  } catch {
+return;
+  }
+
+  let coordinatorStatus: any;
+  try {
+coordinatorStatus = (await 
axios.get(`/proxy/coordinator/status`)).data;
+

[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335254221
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-checks.tsx
 ##
 @@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import axios from 'axios';
+
+import { pluralIfNeeded, queryDruidSql } from '../../utils';
+import { deepGet } from '../../utils/object-change';
+import { postToSampler } from '../../utils/sampler';
+
+export interface CheckControls {
+  addSuggestion: (message: string) => void;
+  addIssue: (message: string) => void;
+  terminateChecks: () => void;
+}
+
+export interface DoctorCheck {
+  name: string;
+  check: (controls: CheckControls) => Promise;
+}
+
+const RUNTIME_PROPERTIES_ALL_NODES_MUST_AGREE_ON: string[] = [
+  'user.timezone',
+  'druid.zk.service.host',
+];
+
+const RUNTIME_PROPERTIES_ALL_NODES_SHOULD_AGREE_ON: string[] = 
['java.version'];
+
+// In the future (when we can query other nodes) is will also be cool to check:
+// 'druid.storage.type' <=> historicals, overlords, mm
+// 'druid.indexer.logs.type' <=> overlord, mm, + peons
+
+const RUNTIME_PROPERTIES_MASTER_NODES_SHOULD_AGREE_ON: string[] = [
+  'druid.metadata.storage.type', // overlord + coordinator
+  'druid.metadata.storage.connector.connectURI',
+];
+
+export const DOCTOR_CHECKS: DoctorCheck[] = [
+  // -
+  // Self (router) checks
+  // -
+  {
+name: 'Verify own status',
+check: async controls => {
+  // Make sure that the router responds to /status and gives some valid 
info back
+  let status: any;
+  try {
+status = (await axios.get(`/status`)).data;
+  } catch (e) {
+controls.addIssue(
+  `Did not get a /status response, is the cluster running? Got: 
${e.message}`,
+);
+controls.terminateChecks();
+return;
+  }
+
+  if (typeof status.version !== 'string') {
+controls.addIssue('Could not get a valid /status response.');
 
 Review comment:
   "from the Router"?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org



[GitHub] [incubator-druid] gianm commented on a change in pull request #8672: Druid Doctor

2019-10-15 Thread GitBox
gianm commented on a change in pull request #8672: Druid Doctor
URL: https://github.com/apache/incubator-druid/pull/8672#discussion_r335254944
 
 

 ##
 File path: web-console/src/dialogs/doctor-dialog/doctor-checks.tsx
 ##
 @@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import axios from 'axios';
+
+import { pluralIfNeeded, queryDruidSql } from '../../utils';
+import { deepGet } from '../../utils/object-change';
+import { postToSampler } from '../../utils/sampler';
+
+export interface CheckControls {
+  addSuggestion: (message: string) => void;
+  addIssue: (message: string) => void;
+  terminateChecks: () => void;
+}
+
+export interface DoctorCheck {
+  name: string;
+  check: (controls: CheckControls) => Promise;
+}
+
+const RUNTIME_PROPERTIES_ALL_NODES_MUST_AGREE_ON: string[] = [
+  'user.timezone',
+  'druid.zk.service.host',
+];
+
+const RUNTIME_PROPERTIES_ALL_NODES_SHOULD_AGREE_ON: string[] = 
['java.version'];
+
+// In the future (when we can query other nodes) is will also be cool to check:
+// 'druid.storage.type' <=> historicals, overlords, mm
+// 'druid.indexer.logs.type' <=> overlord, mm, + peons
+
+const RUNTIME_PROPERTIES_MASTER_NODES_SHOULD_AGREE_ON: string[] = [
+  'druid.metadata.storage.type', // overlord + coordinator
+  'druid.metadata.storage.connector.connectURI',
+];
+
+export const DOCTOR_CHECKS: DoctorCheck[] = [
+  // -
+  // Self (router) checks
+  // -
+  {
+name: 'Verify own status',
+check: async controls => {
+  // Make sure that the router responds to /status and gives some valid 
info back
+  let status: any;
+  try {
+status = (await axios.get(`/status`)).data;
+  } catch (e) {
+controls.addIssue(
+  `Did not get a /status response, is the cluster running? Got: 
${e.message}`,
+);
+controls.terminateChecks();
+return;
+  }
+
+  if (typeof status.version !== 'string') {
+controls.addIssue('Could not get a valid /status response.');
+  }
+},
+  },
+  {
+name: 'Verify own runtime properties',
+check: async controls => {
+  // Make sure that everything in /status/properties is above board
+  let properties: Record;
+  try {
+properties = (await axios.get(`/status/properties`)).data;
+  } catch (e) {
+controls.addIssue('Did not get a /status/properties response, 
something must be broken.');
+return;
+  }
+
+  // Check that the management proxy is on, it really should be for 
someone to access the console in the first place but everything could happen
+  if (properties['druid.router.managementProxy.enabled'] !== 'true') {
+controls.addIssue(
+  `The router's "druid.router.managementProxy.enabled" is not reported 
as "true" that is unusual.`,
 
 Review comment:
   I would go with different language, like telling the user that we recommend 
setting this property in order for Coordinator / Overlord APIs to be accessible 
through the Router (and therefore the web console).
   
   The general idea is we should give people some hints about why each check is 
there and what they should do about them if issues are found.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org