Skip to content
Permalink
Browse files
AMBARI-23142 - Add AMS Metrics publisher to Infra Solr (#556)
  • Loading branch information
kasakrisz authored and oleewere committed Apr 5, 2018
1 parent 62113cb commit 7182775daf6cd8d85179a44306bf626f9735de10
Showing 1 changed file with 57 additions and 0 deletions.
@@ -342,6 +342,20 @@ define([
);
};

// Infra Solr Calls
var getSolrCoreData = function(target) {
var instanceId = typeof target.templatedCluster == 'undefined' ? '' : '&instanceId=' + target.templatedCluster;
var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sCoreMetric + metricTransform + instanceId
+ metricAggregator + '&appId=ambari-infra-solr&startTime=' + from + '&endTime=' + to + precision + seriesAggregator }).then(
allHostMetricsData(target)
);
};

// Druid calls.
var getDruidData = function(target) {
var instanceId = typeof target.templatedCluster == 'undefined' ? '' : '&instanceId=' + target.templatedCluster;
@@ -459,6 +473,23 @@ define([
});
}

//Templatized Dashboard for Infra Solr Cores
if (templateSrv.variables[0].query === "infra_solr_core") {
var allCores = templateSrv.variables.filter(function(variable) { return variable.query === "infra_solr_core";});
var selectedCores = (_.isEmpty(allCores)) ? "" : allCores[0].options.filter(function(core)
{ return core.selected; }).map(function(coreName) { return coreName.value; });
selectedCores = templateSrv._values.Cores.lastIndexOf('}') > 0 ? templateSrv._values.Cores.slice(1,-1) :
templateSrv._values.Cores;
var selectedCore= selectedCores.split(',');
_.forEach(selectedCore, function(processCore) {
metricsPromises.push(_.map(options.targets, function(target) {
target.sCore = processCore;
target.sCoreMetric = target.metric.replace('*', target.sCore);
return getSolrCoreData(target);
}));
});
}

//Templatized Dashboard for Storm Topologies
if (templateSrv.variables[0].query === "topologies" && !templateSrv.variables[1]) {
var allTopologies = templateSrv.variables.filter(function(variable) { return variable.query === "topologies";});
@@ -678,6 +709,32 @@ define([
});
});
}

var cores = [];
//Templated Variables for Infra Solr Cores
if (interpolated === "infra_solr_core") {
return this.initMetricAppidMapping()
.then(function () {
var solrMetrics = allMetrics["ambari-infra-solr"];
var extractCores = solrMetrics.filter(/./.test.bind(new
RegExp("^infra.solr.core.", 'g')));
_.map(extractCores, function (core) {
// Core naming convention is infra.solr.core.<collection_name>.<shard>.<replica>.<metric_name>
// coreName should be <collection_name>.<shard>.<replica>
core = core.split('.');
var coreName = core.slice(3,6).join(".");
if (cores.indexOf(coreName) < 0) {
cores.push(coreName);
}
});
return _.map(cores, function (cores) {
return {
text: cores
};
});
});
}

var topologies = {};
//Templated Variables for Storm Topologies
if(interpolated === "topologies") {

0 comments on commit 7182775

Please sign in to comment.