Skip to content

Commit

Permalink
Ninja fix for error trace overload
Browse files Browse the repository at this point in the history
JMX connection attempts get interrupted under normal conditions in many cases and we don't want to log those errors.
Optimize the cluster screen for better handling of refreshes
  • Loading branch information
adejanovski committed Feb 17, 2018
1 parent 6f3f3fa commit bd17578
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ protected JmxProxy connect(Optional<RepairStatusHandler> handler, String host, i
}
return JMX_CONNECTIONS.get(host);
} catch (RuntimeException ex) {
LOG.error("Failed creating a new JMX connection to {}", host, ex);
// unpack any exception behind JmxConnectionProvider.apply(..)
if (ex.getCause() instanceof InterruptedException) {
throw (InterruptedException) ex.getCause();
} else {
LOG.error("Failed creating a new JMX connection to {}", host, ex);
}
if (ex.getCause() instanceof ReaperException) {
throw (ReaperException) ex.getCause();
Expand Down
4 changes: 2 additions & 2 deletions src/server/src/main/resources/assets/deps.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/server/src/main/resources/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<script type="text/javascript" src="deps.js?c99772e306937c5ae093"></script><script type="text/javascript" src="index.js?c99772e306937c5ae093"></script></head>
<script type="text/javascript" src="deps.js?5a83b48202def71a92cd"></script><script type="text/javascript" src="index.js?5a83b48202def71a92cd"></script></head>

<body>

Expand Down
6 changes: 3 additions & 3 deletions src/server/src/main/resources/assets/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/server/src/main/resources/assets/repair.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<script type="text/javascript" src="deps.js?c99772e306937c5ae093"></script><script type="text/javascript" src="repair.js?c99772e306937c5ae093"></script></head>
<script type="text/javascript" src="deps.js?5a83b48202def71a92cd"></script><script type="text/javascript" src="repair.js?5a83b48202def71a92cd"></script></head>

<body>

Expand Down
2 changes: 1 addition & 1 deletion src/server/src/main/resources/assets/repair.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/server/src/main/resources/assets/schedules.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<script type="text/javascript" src="deps.js?c99772e306937c5ae093"></script><script type="text/javascript" src="schedules.js?c99772e306937c5ae093"></script></head>
<script type="text/javascript" src="deps.js?5a83b48202def71a92cd"></script><script type="text/javascript" src="schedules.js?5a83b48202def71a92cd"></script></head>

<body>

Expand Down
2 changes: 1 addition & 1 deletion src/server/src/main/resources/assets/schedules.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/server/src/main/resources/assets/segments.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<script type="text/javascript" src="deps.js?c99772e306937c5ae093"></script><script type="text/javascript" src="segments.js?c99772e306937c5ae093"></script></head>
<script type="text/javascript" src="deps.js?5a83b48202def71a92cd"></script><script type="text/javascript" src="segments.js?5a83b48202def71a92cd"></script></head>

<body>

Expand Down
77 changes: 54 additions & 23 deletions src/ui/app/jsx/cluster-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const NodeStatus = React.createClass({
},

getInitialState() {
return { showModal: false };
return { showModal: false};
},

close() {
Expand Down Expand Up @@ -84,19 +84,25 @@ const NodeStatus = React.createClass({
const Cluster = React.createClass({

propTypes: {
name: React.PropTypes.string.isRequired
name: React.PropTypes.string.isRequired,
clusterFilter: React.PropTypes.string.isRequired
},

getInitialState: function() {
const isDev = window.top.location.pathname.includes('webpack-dev-server');
const URL_PREFIX = isDev ? 'http://127.0.0.1:8080' : '';
return {clusterStatus: {}, clusterStatuses: null, urlPrefix: URL_PREFIX , nbNodes: 0, nodesDown:0};
return {clusterStatus: {},
clusterStatuses: null,
urlPrefix: URL_PREFIX ,
nbNodes: 0,
nodesDown:0,
refreshing: true,
nodes_status: null
};
},

componentWillMount: function() {
this._refreshClusterStatus();
this.setState({clusterStatuses: setInterval(this._refreshClusterStatus, 10000)});
console.log("Path " + window.location.pathname);
},

_refreshClusterStatus: function() {
Expand All @@ -105,7 +111,19 @@ const Cluster = React.createClass({
method: 'GET',
component: this,
complete: function(data) {
this.component.setState({clusterStatus: $.parseJSON(data.responseText)});
console.log(this.component.props.name + " complete.")
this.component.setState({clusterStatuses: setTimeout(this.component._refreshClusterStatus, 30000),
clusterStatus: $.parseJSON(data.responseText)});

if(this.component.state.clusterStatus.nodes_status){
this.component.setState({nodes_status: this.component.state.clusterStatus.nodes_status});
}
console.log(this.component.props.name + " : Next attempt in 30s.")
},
error: function(data) {
console.log(this.component.props.name + " complete.")
this.component.setState({clusterStatuses: setTimeout(this.component._refreshClusterStatus, 30000)});

}
});
},
Expand All @@ -126,13 +144,13 @@ const Cluster = React.createClass({
marginBottom: "0.25em"
}

let datacenters=<div className="clusterLoader"></div>

let datacenters = "";
let runningRepairs = 0;

let repairProgress = "";
let totalLoad = 0;
if(this.state.clusterStatus.nodes_status){

if (this.state.clusterStatus.repair_runs) {
runningRepairs = this.state.clusterStatus.repair_runs.reduce(function(previousValue, repairRun){
return previousValue + (repairRun.state=='RUNNING' ? 1: 0);
}, 0);;
Expand All @@ -143,25 +161,39 @@ const Cluster = React.createClass({
label={repairRun.keyspace_name}
key={repairRun.id}/>
)

datacenters = Object.keys(this.state.clusterStatus.nodes_status.endpointStates[0].endpoints).sort().map(dc =>
<Datacenter datacenter={this.state.clusterStatus.nodes_status.endpointStates[0].endpoints[dc]}
datacenterName={dc}
nbDatacenters={Object.keys(this.state.clusterStatus.nodes_status.endpointStates[0].endpoints).length}
clusterName={this.props.name} key={this.props.name + '-' + dc}
totalLoad={this.state.clusterStatus.nodes_status.endpointStates[0].totalLoad}/>
)

totalLoad = this.state.clusterStatus.nodes_status.endpointStates[0].totalLoad;
}

if(this.state.nodes_status != null) {
datacenters = Object.keys(this.state.nodes_status.endpointStates[0].endpoints).sort().map(dc =>
<Datacenter datacenter={this.state.nodes_status.endpointStates[0].endpoints[dc]}
datacenterName={dc}
nbDatacenters={Object.keys(this.state.nodes_status.endpointStates[0].endpoints).length}
clusterName={this.props.name} key={this.props.name + '-' + dc}
totalLoad={this.state.nodes_status.endpointStates[0].totalLoad}/>
)
totalLoad = this.state.nodes_status.endpointStates[0].totalLoad;
}
else {
datacenters = <div className="clusterLoader"></div>
}

let runningRepairsBadge = <span className="label label-default">{runningRepairs}</span>;
if(runningRepairs > 0) {
runningRepairsBadge = <span className="label label-success">{runningRepairs}</span>;
}

let clusterDisplayStyle = {
display: "none"
}

if(this.props.name.includes(this.props.clusterFilter)) {
clusterDisplayStyle = {
display: "block"
}
}

return (
<div className="panel panel-default">
<div className="panel panel-default" style={clusterDisplayStyle}>
<div className="panel-body">
<div className="row">
<div className="col-lg-2"><a href={'repair.html?currentCluster=' + this.props.name}><h4>{this.props.name} <span className="badge">{humanFileSize(totalLoad,1024)}</span></h4></a><div>Running repairs : {runningRepairsBadge}<br/>{repairProgress}</div>
Expand Down Expand Up @@ -341,9 +373,8 @@ const clusterList = React.createClass({

render: function() {

const rows = this.state.clusterNames.filter(cluster => cluster.includes(this.state.clusterFilter))
.sort().map(name =>
<Cluster name={name} key={name} deleteSubject={this.props.deleteSubject} getClusterStatus={this.props.getClusterStatus} getClusterSubject={this.props.getClusterSubject}/>);
const rows = this.state.clusterNames.sort().map(name =>
<Cluster name={name} key={name} deleteSubject={this.props.deleteSubject} getClusterStatus={this.props.getClusterStatus} getClusterSubject={this.props.getClusterSubject} clusterFilter={this.state.clusterFilter}/>);

let table = null;
if(rows.length == 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/ui/app/jsx/navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const NavBar = React.createClass({
</div>
</div>
<div className="col-lg-4">
<span className="navbar-brand" style={floatRight}><Button href="https://github.com/thelastpickle/cassandra-reaper/issues/new?body=**Spotted on 1.1.0-SNAPSHOT (ea1a0a0)**" bsStyle="warning" bsSize="xsmall">Report a bug</Button>
<span className="navbar-brand" style={floatRight}><Button href="https://github.com/thelastpickle/cassandra-reaper/issues/new?body=**Spotted on 1.1.0-SNAPSHOT (00a3fd0)**" bsStyle="warning" bsSize="xsmall">Report a bug</Button>
</span>
</div>
<Modal show={this.state.showModal} onHide={this.close}>
Expand All @@ -42,9 +42,9 @@ const NavBar = React.createClass({
</Modal.Header>
<Modal.Body>
<h4>Git commit :</h4>
<p><a href="https://github.com/thelastpickle/cassandra-reaper/commit/ea1a0a0" target="_blank">https://github.com/thelastpickle/cassandra-reaper/commit/ea1a0a0</a></p>
<p><a href="https://github.com/thelastpickle/cassandra-reaper/commit/00a3fd0" target="_blank">https://github.com/thelastpickle/cassandra-reaper/commit/00a3fd0</a></p>
<h4>Build date :</h4>
<p>2018-02-12 13:25:08</p>
<p>2018-02-17 23:17:08</p>
</Modal.Body>
<Modal.Footer>
<Button onClick={this.close}>Close</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/app/jsx/repair-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const repairForm = React.createClass({
getInitialState: function() {
const isDev = window.top.location.pathname.includes('webpack-dev-server');
const URL_PREFIX = isDev ? 'http://127.0.0.1:8080' : '';

return {
addRepairResultMsg: null, clusterNames: [], submitEnabled: false,
clusterName: this.props.currentCluster!="all"?this.props.currentCluster:this.props.clusterNames[0], keyspace: "", tables: "", owner: null, segments: null,
Expand Down

0 comments on commit bd17578

Please sign in to comment.