use of org.platformlayer.metrics.model.MetricInfoCollection in project platformlayer by platformlayer.
the class MetricCollector method toMetricInfo.
public static MetricInfoCollection toMetricInfo(MetricConfig metricConfig) {
MetricInfoCollection metricInfo = new MetricInfoCollection();
populateMetricInfo(metricInfo, "", metricConfig);
return metricInfo;
}
use of org.platformlayer.metrics.model.MetricInfoCollection in project platformlayer by platformlayer.
the class MetricsResource method listMetrics.
@GET
@Produces({ XML, JSON })
public MetricInfoCollection listMetrics() throws OpsException, RepositoryException {
final ItemBase managedItem = getManagedItem();
final ServiceProvider serviceProvider = getServiceProvider();
OpsContextBuilder opsContextBuilder = objectInjector.getInstance(OpsContextBuilder.class);
final OpsContext opsContext = opsContextBuilder.buildTemporaryOpsContext(getServiceType(), getProjectAuthorization());
return OpsContext.runInContext(opsContext, new CheckedCallable<MetricInfoCollection, Exception>() {
@Override
public MetricInfoCollection call() throws Exception {
BindingScope bindingScope = BindingScope.push(managedItem, managedItem);
try {
Object controller = serviceProvider.getController(managedItem);
MetricConfig metricConfig = opsContext.getMetricInfo(controller);
return MetricCollector.toMetricInfo(metricConfig);
} finally {
bindingScope.pop();
}
}
});
}
use of org.platformlayer.metrics.model.MetricInfoCollection in project platformlayer by platformlayer.
the class HttpPlatformLayerClient method listMetrics.
@Override
public MetricInfoCollection listMetrics(PlatformLayerKey key) throws PlatformLayerClientException {
String relativePath = buildRelativePath(key) + "/metrics";
String retval = doRequest(HttpMethod.GET, relativePath, String.class, Format.XML, null, null);
MetricInfoCollection items;
try {
items = JaxbHelper.deserializeXmlObject(retval, MetricInfoCollection.class);
} catch (UnmarshalException e) {
throw new PlatformLayerClientException("Error parsing returned data", e);
}
return items;
}
use of org.platformlayer.metrics.model.MetricInfoCollection in project platformlayer by platformlayer.
the class ListMetrics method runCommand.
@Override
public Object runCommand() throws PlatformLayerClientException {
PlatformLayerClient client = getPlatformLayerClient();
PlatformLayerKey key = getContext().pathToItem(getProject(), path);
MetricInfoCollection items = client.listMetrics(key);
return items;
}
Aggregations