Jian Li
Committed by Gerrit Code Review

[ONOS-4176] Implement influxdb reporter for backing up metrics

Change-Id: If899955c06cc5a5619a529178be8eb1bffa5b498
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright 2016 Open Networking Laboratory
~
~ Licensed 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.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
<feature name="${project.artifactId}" version="${project.version}"
description="${project.description}">
<feature>onos-api</feature>
<bundle>mvn:${project.groupId}/onos-app-influxdb/${project.version}</bundle>
<bundle>wrap:mvn:com.izettle/metrics-influxdb/1.1.1$Bundle-SymbolicName=metrics-influxdb&amp;Bundle-Version=1.1.1</bundle>
<bundle>mvn:commons-codec/commons-codec/1.10</bundle>
</feature>
</features>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 Open Networking Laboratory
~
~ Licensed 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-apps</artifactId>
<version>1.6.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-app-influxdb</artifactId>
<packaging>bundle</packaging>
<description>Performance metric service reporter and retriever for influxDB</description>
<properties>
<onos.app.name>org.onosproject.influxdbmetrics</onos.app.name>
<onos.app.title>InfluxDB Report and Query App</onos.app.title>
<onos.app.category>Monitoring</onos.app.category>
<onos.app.url>http://onosproject.org</onos.app.url>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-misc</artifactId>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-cli</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>com.izettle</groupId>
<artifactId>metrics-influxdb</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed 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.
*/
/**
* Application that provides capability to report and retrieve metrics
* to and from influx database.
*/
package org.onosproject.influxdbmetrics;
/*
* Copyright 2016 Open Networking Laboratory
*
* Licensed 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.
*/
package org.onosproject.influxdbmetrics;
import com.codahale.metrics.Counter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricFilter;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;
import org.junit.Before;
import org.onlab.metrics.MetricsComponent;
import org.onlab.metrics.MetricsFeature;
import org.onlab.metrics.MetricsService;
import org.onosproject.cfg.ComponentConfigAdapter;
import org.onosproject.cluster.ClusterServiceAdapter;
import org.onosproject.core.CoreServiceAdapter;
import java.util.Map;
/**
* Unit tests for influxDB metrics reporter.
*/
public class InfluxDbMetricsReporterTest {
private InfluxDbMetricsReporter influxReporter;
/**
* Sets up the services required by influxDB metrics reporter.
*/
@Before
public void setUp() {
influxReporter = new InfluxDbMetricsReporter();
influxReporter.coreService = new CoreServiceAdapter();
influxReporter.cfgService = new ComponentConfigAdapter();
influxReporter.clusterService = new ClusterServiceAdapter();
influxReporter.metricsService = new TestMetricsService();
influxReporter.activate();
}
/**
* Tears down influxDB metrics reporter.
*/
public void tearDown() {
influxReporter.deactivate();
}
private class TestMetricsService implements MetricsService {
@Override
public MetricsComponent registerComponent(String name) {
return null;
}
@Override
public MetricRegistry getMetricRegistry() {
return null;
}
@Override
public Counter createCounter(MetricsComponent component,
MetricsFeature feature, String metricName) {
return null;
}
@Override
public Histogram createHistogram(MetricsComponent component,
MetricsFeature feature, String metricName) {
return null;
}
@Override
public Timer createTimer(MetricsComponent component,
MetricsFeature feature, String metricName) {
return null;
}
@Override
public Meter createMeter(MetricsComponent component,
MetricsFeature feature, String metricName) {
return null;
}
@Override
public <T extends Metric> T registerMetric(MetricsComponent component,
MetricsFeature feature,
String metricName, T metric) {
return null;
}
@Override
public boolean removeMetric(MetricsComponent component,
MetricsFeature feature, String metricName) {
return false;
}
@Override
public Map<String, Timer> getTimers(MetricFilter filter) {
return null;
}
@Override
public Map<String, Gauge> getGauges(MetricFilter filter) {
return null;
}
@Override
public Map<String, Counter> getCounters(MetricFilter filter) {
return null;
}
@Override
public Map<String, Meter> getMeters(MetricFilter filter) {
return null;
}
@Override
public Map<String, Histogram> getHistograms(MetricFilter filter) {
return null;
}
@Override
public Map<String, Metric> getMetrics() {
return null;
}
@Override
public void removeMatching(MetricFilter filter) {
}
}
}
......@@ -70,6 +70,7 @@
<module>openstacknode</module>
<module>openstacknetworking</module>
<module>openstackinterface</module>
<module>influxdbmetrics</module>
</modules>
<properties>
......