mirror of
https://github.com/Telecominfraproject/wlan-cloud-base.git
synced 2026-03-20 15:39:03 +00:00
Compare commits
20 Commits
release/v1
...
release/v1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c15a9650b | ||
|
|
5c3bf48780 | ||
|
|
be09681087 | ||
|
|
a7076e523b | ||
|
|
6232b8db7b | ||
|
|
2bfab69a3a | ||
|
|
fef03f4bbe | ||
|
|
b6a02439b8 | ||
|
|
789e153519 | ||
|
|
c2c67e188c | ||
|
|
9f5e093ea5 | ||
|
|
d1bc55745e | ||
|
|
e185ccaef6 | ||
|
|
92fcaaa0bb | ||
|
|
1bcf2860df | ||
|
|
e005180f9f | ||
|
|
b1cc93b9df | ||
|
|
df157aecfd | ||
|
|
143fc61fef | ||
|
|
0e496faa5e |
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-cassandra-tests</artifactId>
|
||||
@@ -15,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-cassandra</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-cassandra</artifactId>
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -61,7 +61,9 @@ public class BaseCassandraDataSource {
|
||||
sessionBuilder.withConfigLoader(DriverConfigLoader.fromClasspath("cassandra-application"));
|
||||
}
|
||||
|
||||
CqlSession session =sessionBuilder.build();
|
||||
CqlSession session = sessionBuilder.build();
|
||||
|
||||
session = new CqlSessionWithMetrics(session);
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,420 @@
|
||||
package com.telecominfraproject.wlan.core.server.cassandra;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
|
||||
import com.datastax.dse.driver.api.core.cql.continuous.ContinuousAsyncResultSet;
|
||||
import com.datastax.dse.driver.api.core.cql.continuous.ContinuousResultSet;
|
||||
import com.datastax.dse.driver.api.core.cql.continuous.reactive.ContinuousReactiveResultSet;
|
||||
import com.datastax.dse.driver.api.core.cql.reactive.ReactiveResultSet;
|
||||
import com.datastax.dse.driver.api.core.graph.AsyncGraphResultSet;
|
||||
import com.datastax.dse.driver.api.core.graph.GraphResultSet;
|
||||
import com.datastax.dse.driver.api.core.graph.GraphStatement;
|
||||
import com.datastax.dse.driver.api.core.graph.reactive.ReactiveGraphResultSet;
|
||||
import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
import com.datastax.oss.driver.api.core.CqlSession;
|
||||
import com.datastax.oss.driver.api.core.context.DriverContext;
|
||||
import com.datastax.oss.driver.api.core.cql.AsyncResultSet;
|
||||
import com.datastax.oss.driver.api.core.cql.PrepareRequest;
|
||||
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.ResultSet;
|
||||
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
|
||||
import com.datastax.oss.driver.api.core.cql.Statement;
|
||||
import com.datastax.oss.driver.api.core.metadata.Metadata;
|
||||
import com.datastax.oss.driver.api.core.metrics.Metrics;
|
||||
import com.datastax.oss.driver.api.core.session.Request;
|
||||
import com.datastax.oss.driver.api.core.type.reflect.GenericType;
|
||||
import com.netflix.servo.DefaultMonitorRegistry;
|
||||
import com.netflix.servo.monitor.BasicCounter;
|
||||
import com.netflix.servo.monitor.BasicTimer;
|
||||
import com.netflix.servo.monitor.Counter;
|
||||
import com.netflix.servo.monitor.MonitorConfig;
|
||||
import com.netflix.servo.monitor.Stopwatch;
|
||||
import com.netflix.servo.monitor.Timer;
|
||||
import com.netflix.servo.tag.TagList;
|
||||
import com.telecominfraproject.wlan.cloudmetrics.CloudMetricsTags;
|
||||
|
||||
public class CqlSessionWithMetrics implements CqlSession {
|
||||
|
||||
private final TagList tags = CloudMetricsTags.commonTags;
|
||||
|
||||
final Counter executeCounter = new BasicCounter(MonitorConfig.builder("cassandra-execute").withTags(tags).build());
|
||||
final Counter executeAsyncCounter = new BasicCounter(MonitorConfig.builder("cassandra-execute-async").withTags(tags).build());
|
||||
final Counter executeReactiveCounter = new BasicCounter(MonitorConfig.builder("cassandra-execute-reactive").withTags(tags).build());
|
||||
|
||||
final Counter executeErrorCounter = new BasicCounter(MonitorConfig.builder("cassandra-execute-errors").withTags(tags).build());
|
||||
final Counter executeAsyncErrorCounter = new BasicCounter(MonitorConfig.builder("cassandra-execute-async-errors").withTags(tags).build());
|
||||
final Counter executeReactiveErrorCounter = new BasicCounter(MonitorConfig.builder("cassandra-execute-reactive-errors").withTags(tags).build());
|
||||
|
||||
private final Timer executeTimer = new BasicTimer(
|
||||
MonitorConfig.builder("cassandra-executeTimer").withTags(tags).build());
|
||||
|
||||
private final Timer executeAsyncTimer = new BasicTimer(
|
||||
MonitorConfig.builder("cassandra-executeAsyncTimer").withTags(tags).build());
|
||||
|
||||
private final Timer executeReactiveTimer = new BasicTimer(
|
||||
MonitorConfig.builder("cassandra-executeReactiveTimer").withTags(tags).build());
|
||||
|
||||
// dtop: use anonymous constructor to ensure that the following code always
|
||||
// get executed,
|
||||
// even when somebody adds another constructor in here
|
||||
{
|
||||
DefaultMonitorRegistry.getInstance().register(executeCounter);
|
||||
DefaultMonitorRegistry.getInstance().register(executeAsyncCounter);
|
||||
DefaultMonitorRegistry.getInstance().register(executeReactiveCounter);
|
||||
|
||||
DefaultMonitorRegistry.getInstance().register(executeErrorCounter);
|
||||
DefaultMonitorRegistry.getInstance().register(executeAsyncErrorCounter);
|
||||
DefaultMonitorRegistry.getInstance().register(executeReactiveErrorCounter);
|
||||
|
||||
DefaultMonitorRegistry.getInstance().register(executeTimer);
|
||||
DefaultMonitorRegistry.getInstance().register(executeAsyncTimer);
|
||||
DefaultMonitorRegistry.getInstance().register(executeReactiveTimer);
|
||||
}
|
||||
|
||||
private final CqlSession delegate;
|
||||
|
||||
public CqlSessionWithMetrics(CqlSession delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
public CompletionStage<AsyncResultSet> executeAsync(Statement<?> statement) {
|
||||
executeAsyncCounter.increment();
|
||||
Stopwatch stopwatch = executeAsyncTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
CompletionStage<AsyncResultSet> ret = delegate.executeAsync(statement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeAsyncErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ReactiveGraphResultSet executeReactive(GraphStatement<?> statement) {
|
||||
executeReactiveCounter.increment();
|
||||
Stopwatch stopwatch = executeReactiveTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ReactiveGraphResultSet ret = delegate.executeReactive(statement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeReactiveErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CompletionStage<Void> closeFuture() {
|
||||
return delegate.closeFuture();
|
||||
}
|
||||
|
||||
public ResultSet execute(Statement<?> statement) {
|
||||
executeCounter.increment();
|
||||
Stopwatch stopwatch = executeTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ResultSet ret = delegate.execute(statement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public GraphResultSet execute(GraphStatement<?> graphStatement) {
|
||||
executeCounter.increment();
|
||||
Stopwatch stopwatch = executeTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
GraphResultSet ret = delegate.execute(graphStatement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isClosed() {
|
||||
return delegate.isClosed();
|
||||
}
|
||||
|
||||
public ReactiveResultSet executeReactive(String query) {
|
||||
executeReactiveCounter.increment();
|
||||
Stopwatch stopwatch = executeReactiveTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ReactiveResultSet ret = delegate.executeReactive(query);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeReactiveErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CompletionStage<AsyncResultSet> executeAsync(String query) {
|
||||
executeAsyncCounter.increment();
|
||||
Stopwatch stopwatch = executeAsyncTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
CompletionStage<AsyncResultSet> ret = delegate.executeAsync(query);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeAsyncErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CompletionStage<Void> closeAsync() {
|
||||
return delegate.closeAsync();
|
||||
}
|
||||
|
||||
public ReactiveResultSet executeReactive(Statement<?> statement) {
|
||||
executeReactiveCounter.increment();
|
||||
Stopwatch stopwatch = executeReactiveTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ReactiveResultSet ret = delegate.executeReactive(statement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeReactiveErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CompletionStage<Void> forceCloseAsync() {
|
||||
return delegate.forceCloseAsync();
|
||||
}
|
||||
|
||||
public CompletionStage<PreparedStatement> prepareAsync(SimpleStatement statement) {
|
||||
return delegate.prepareAsync(statement);
|
||||
}
|
||||
|
||||
public ContinuousReactiveResultSet executeContinuouslyReactive(String query) {
|
||||
executeReactiveCounter.increment();
|
||||
Stopwatch stopwatch = executeReactiveTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ContinuousReactiveResultSet ret = delegate.executeContinuouslyReactive(query);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeReactiveErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ResultSet execute(String query) {
|
||||
executeCounter.increment();
|
||||
Stopwatch stopwatch = executeTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ResultSet ret = delegate.execute(query);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void close() {
|
||||
delegate.close();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return delegate.getName();
|
||||
}
|
||||
|
||||
public CompletionStage<AsyncGraphResultSet> executeAsync(GraphStatement<?> graphStatement) {
|
||||
executeAsyncCounter.increment();
|
||||
Stopwatch stopwatch = executeAsyncTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
CompletionStage<AsyncGraphResultSet> ret = delegate.executeAsync(graphStatement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeAsyncErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ContinuousReactiveResultSet executeContinuouslyReactive(Statement<?> statement) {
|
||||
executeReactiveCounter.increment();
|
||||
Stopwatch stopwatch = executeReactiveTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ContinuousReactiveResultSet ret = delegate.executeContinuouslyReactive(statement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeReactiveErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CompletionStage<PreparedStatement> prepareAsync(String query) {
|
||||
return delegate.prepareAsync(query);
|
||||
}
|
||||
|
||||
public PreparedStatement prepare(SimpleStatement statement) {
|
||||
return delegate.prepare(statement);
|
||||
}
|
||||
|
||||
public Metadata getMetadata() {
|
||||
return delegate.getMetadata();
|
||||
}
|
||||
|
||||
public ContinuousResultSet executeContinuously(Statement<?> statement) {
|
||||
executeCounter.increment();
|
||||
Stopwatch stopwatch = executeTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ContinuousResultSet ret = delegate.executeContinuously(statement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CompletionStage<PreparedStatement> prepareAsync(PrepareRequest request) {
|
||||
return delegate.prepareAsync(request);
|
||||
}
|
||||
|
||||
public boolean isSchemaMetadataEnabled() {
|
||||
return delegate.isSchemaMetadataEnabled();
|
||||
}
|
||||
|
||||
public CompletionStage<ContinuousAsyncResultSet> executeContinuouslyAsync(Statement<?> statement) {
|
||||
executeAsyncCounter.increment();
|
||||
Stopwatch stopwatch = executeAsyncTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
CompletionStage<ContinuousAsyncResultSet> ret = delegate.executeContinuouslyAsync(statement);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeAsyncErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CompletionStage<Metadata> setSchemaMetadataEnabled(Boolean newValue) {
|
||||
return delegate.setSchemaMetadataEnabled(newValue);
|
||||
}
|
||||
|
||||
public CompletionStage<Metadata> refreshSchemaAsync() {
|
||||
return delegate.refreshSchemaAsync();
|
||||
}
|
||||
|
||||
public Metadata refreshSchema() {
|
||||
return delegate.refreshSchema();
|
||||
}
|
||||
|
||||
public CompletionStage<Boolean> checkSchemaAgreementAsync() {
|
||||
return delegate.checkSchemaAgreementAsync();
|
||||
}
|
||||
|
||||
public PreparedStatement prepare(String query) {
|
||||
return delegate.prepare(query);
|
||||
}
|
||||
|
||||
public boolean checkSchemaAgreement() {
|
||||
return delegate.checkSchemaAgreement();
|
||||
}
|
||||
|
||||
public DriverContext getContext() {
|
||||
return delegate.getContext();
|
||||
}
|
||||
|
||||
public Optional<CqlIdentifier> getKeyspace() {
|
||||
return delegate.getKeyspace();
|
||||
}
|
||||
|
||||
public PreparedStatement prepare(PrepareRequest request) {
|
||||
return delegate.prepare(request);
|
||||
}
|
||||
|
||||
public Optional<Metrics> getMetrics() {
|
||||
return delegate.getMetrics();
|
||||
}
|
||||
|
||||
public <RequestT extends Request, ResultT> ResultT execute(RequestT request, GenericType<ResultT> resultType) {
|
||||
executeCounter.increment();
|
||||
Stopwatch stopwatch = executeTimer.start();
|
||||
boolean success = false;
|
||||
|
||||
try {
|
||||
ResultT ret = delegate.execute(request, resultType);
|
||||
success = true;
|
||||
return ret;
|
||||
} finally {
|
||||
stopwatch.stop();
|
||||
if(!success) {
|
||||
executeErrorCounter.increment();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-client</artifactId>
|
||||
@@ -16,25 +14,25 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-container</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.springframework.core.task.TaskRejectedException;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.web.client.DefaultResponseErrorHandler;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.HttpServerErrorException;
|
||||
import org.springframework.web.client.ResponseErrorHandler;
|
||||
|
||||
@@ -38,7 +39,7 @@ public class ExceptionPropagatingErrorHandler extends DefaultResponseErrorHandle
|
||||
public void handleError(ClientHttpResponse response) throws IOException {
|
||||
try {
|
||||
super.handleError(response);
|
||||
} catch (HttpServerErrorException e) {
|
||||
} catch (HttpServerErrorException | HttpClientErrorException e) {
|
||||
// look in the response object, and if it contains any of the
|
||||
// exceptions we recognize - throw that exception instead of the
|
||||
// HttpServerErrorException
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-container</artifactId>
|
||||
@@ -18,7 +18,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@@ -32,7 +32,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Auth0 dependencies -->
|
||||
|
||||
@@ -24,9 +24,15 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
|
||||
import com.netflix.servo.DefaultMonitorRegistry;
|
||||
import com.netflix.servo.annotations.DataSourceType;
|
||||
import com.netflix.servo.annotations.Monitor;
|
||||
import com.netflix.servo.monitor.Monitors;
|
||||
import com.netflix.servo.monitor.BasicCounter;
|
||||
import com.netflix.servo.monitor.Counter;
|
||||
import com.netflix.servo.monitor.MonitorConfig;
|
||||
import com.netflix.servo.monitor.NumberGauge;
|
||||
import com.netflix.servo.tag.TagList;
|
||||
import com.telecominfraproject.wlan.cloudmetrics.CloudMetricsTags;
|
||||
import com.telecominfraproject.wlan.core.server.async.example.AsyncCallerExample;
|
||||
import com.telecominfraproject.wlan.core.server.async.example.AsyncExample;
|
||||
|
||||
@@ -51,18 +57,31 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AsyncConfiguration.class);
|
||||
|
||||
@Autowired private Environment environment;
|
||||
|
||||
@Monitor(name="TotalAsyncThreads", type=DataSourceType.GAUGE)
|
||||
private static final AtomicInteger totalAsyncThreads = new AtomicInteger(0);
|
||||
|
||||
@Monitor(name="TotalTasksExecuted", type=DataSourceType.COUNTER)
|
||||
private static final AtomicInteger totalTasksExecuted = new AtomicInteger(0);
|
||||
|
||||
@Monitor(name = "TotalTasksRejected", type = DataSourceType.COUNTER)
|
||||
private static final AtomicInteger totalTasksRejected = new AtomicInteger(0);
|
||||
private final TagList tags = CloudMetricsTags.commonTags;
|
||||
|
||||
final Counter totalTasksExecuted = new BasicCounter(MonitorConfig.builder("async-totalTasksExecuted").withTags(tags).build());
|
||||
final Counter totalTasksRejected = new BasicCounter(MonitorConfig.builder("async-totalTasksRejected").withTags(tags).build());
|
||||
|
||||
private static final AtomicInteger totalAsyncThreads = new AtomicInteger(0);
|
||||
private final NumberGauge totalAsyncThreadsGauge = new NumberGauge(
|
||||
MonitorConfig.builder("async-totalAsyncThreads").withTags(tags).build(), totalAsyncThreads);
|
||||
|
||||
|
||||
@Monitor(name="TasksInTheQueue", type=DataSourceType.GAUGE)
|
||||
private static final AtomicInteger tasksInTheQueue = new AtomicInteger(0);
|
||||
private final NumberGauge tasksInTheQueueGauge = new NumberGauge(
|
||||
MonitorConfig.builder("async-tasksInTheQueue").withTags(tags).build(), tasksInTheQueue);
|
||||
|
||||
// dtop: use anonymous constructor to ensure that the following code always
|
||||
// get executed,
|
||||
// even when somebody adds another constructor in here
|
||||
{
|
||||
DefaultMonitorRegistry.getInstance().register(totalTasksExecuted);
|
||||
DefaultMonitorRegistry.getInstance().register(totalTasksRejected);
|
||||
DefaultMonitorRegistry.getInstance().register(totalAsyncThreadsGauge);
|
||||
DefaultMonitorRegistry.getInstance().register(tasksInTheQueueGauge);
|
||||
}
|
||||
|
||||
static interface RunnableBlockingQueueInSpringClassloaderInterface extends BlockingQueue<Runnable> {
|
||||
}
|
||||
@@ -266,7 +285,7 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||
}
|
||||
@Override
|
||||
public void execute(Runnable task) {
|
||||
totalTasksExecuted.incrementAndGet();
|
||||
totalTasksExecuted.increment();
|
||||
super.execute(task);
|
||||
}
|
||||
|
||||
@@ -274,10 +293,10 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||
public Future<?> submit(Runnable task) {
|
||||
try {
|
||||
Future<?> result = super.submit(task);
|
||||
totalTasksExecuted.incrementAndGet();
|
||||
totalTasksExecuted.increment();
|
||||
return result;
|
||||
} catch (TaskRejectedException exp) {
|
||||
totalTasksRejected.incrementAndGet();
|
||||
totalTasksRejected.increment();
|
||||
throw exp;
|
||||
}
|
||||
}
|
||||
@@ -286,10 +305,10 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
try {
|
||||
Future<T> result = super.submit(task);
|
||||
totalTasksExecuted.incrementAndGet();
|
||||
totalTasksExecuted.increment();
|
||||
return result;
|
||||
} catch (TaskRejectedException exp) {
|
||||
totalTasksRejected.incrementAndGet();
|
||||
totalTasksRejected.increment();
|
||||
throw exp;
|
||||
}
|
||||
}
|
||||
@@ -298,10 +317,10 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||
public ListenableFuture<?> submitListenable(Runnable task) {
|
||||
try {
|
||||
ListenableFuture<?> result = super.submitListenable(task);
|
||||
totalTasksExecuted.incrementAndGet();
|
||||
totalTasksExecuted.increment();
|
||||
return result;
|
||||
} catch (TaskRejectedException exp) {
|
||||
totalTasksRejected.incrementAndGet();
|
||||
totalTasksRejected.increment();
|
||||
throw exp;
|
||||
}
|
||||
}
|
||||
@@ -310,10 +329,10 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
|
||||
try {
|
||||
ListenableFuture<T> result = super.submitListenable(task);
|
||||
totalTasksExecuted.incrementAndGet();
|
||||
totalTasksExecuted.increment();
|
||||
return result;
|
||||
} catch (TaskRejectedException exp) {
|
||||
totalTasksRejected.incrementAndGet();
|
||||
totalTasksRejected.increment();
|
||||
throw exp;
|
||||
}
|
||||
}
|
||||
@@ -346,7 +365,7 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||
RejectedExecutionHandler rejectedExecutionHandler = new RejectedExecutionHandler() {
|
||||
@Override
|
||||
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
|
||||
totalTasksRejected.incrementAndGet();
|
||||
totalTasksRejected.increment();
|
||||
defaultRejectionHandler.rejectedExecution(r, executor);
|
||||
}
|
||||
};
|
||||
@@ -356,8 +375,6 @@ public class AsyncConfiguration implements AsyncConfigurer {
|
||||
LOG.info("Configuring {} with CorePoolSize={} MaxPoolSize={} QueueCapacity={}",
|
||||
executor.getThreadNamePrefix(), executor.getCorePoolSize(), executor.getMaxPoolSize(), queueCapacity);
|
||||
|
||||
Monitors.registerObject(AsyncConfiguration.class.getSimpleName(), this);
|
||||
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.telecominfraproject.wlan.core.model.json.JsonSerializedException;
|
||||
/**
|
||||
* @author dtoptygin
|
||||
*/
|
||||
@ControllerAdvice
|
||||
@ControllerAdvice(basePackages = "com.telecominfraproject")
|
||||
public class CommonControllerAdvice {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CommonControllerAdvice.class);
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-datastore-inmemory</artifactId>
|
||||
@@ -15,7 +13,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-elasticsearch</artifactId>
|
||||
@@ -15,12 +14,12 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- ElasticSearch dependencies -->
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-hazelcast-client</artifactId>
|
||||
@@ -23,12 +21,12 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>common-hazelcast</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-hierarchical-datastore</artifactId>
|
||||
@@ -13,17 +13,17 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-hazelcast-client</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-jdbc-tests</artifactId>
|
||||
@@ -17,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-jdbc</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-jdbc</artifactId>
|
||||
@@ -41,7 +41,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.sql.SQLException;
|
||||
import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -21,11 +20,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import com.netflix.servo.DefaultMonitorRegistry;
|
||||
import com.netflix.servo.annotations.DataSourceType;
|
||||
import com.netflix.servo.annotations.Monitor;
|
||||
import com.netflix.servo.monitor.BasicCounter;
|
||||
import com.netflix.servo.monitor.BasicGauge;
|
||||
import com.netflix.servo.monitor.Counter;
|
||||
import com.netflix.servo.monitor.MonitorConfig;
|
||||
import com.netflix.servo.monitor.Monitors;
|
||||
import com.netflix.servo.tag.TagList;
|
||||
import com.telecominfraproject.wlan.cloudmetrics.CloudMetricsTags;
|
||||
import com.telecominfraproject.wlan.server.exceptions.ConfigurationException;
|
||||
@@ -39,8 +37,14 @@ public abstract class BaseDataSourceConfig {
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
@Monitor(name = "getConnection", type = DataSourceType.COUNTER)
|
||||
private final AtomicInteger getConnectionExecuted = new AtomicInteger(0);
|
||||
final Counter getConnectionExecuted = new BasicCounter(MonitorConfig.builder("jdbc-getConnection").withTags(tags).build());
|
||||
|
||||
// dtop: use anonymous constructor to ensure that the following code always
|
||||
// get executed,
|
||||
// even when somebody adds another constructor in here
|
||||
{
|
||||
DefaultMonitorRegistry.getInstance().register(getConnectionExecuted);
|
||||
}
|
||||
|
||||
static interface DataSourceInSpringClassloaderInterface extends DataSource {
|
||||
}
|
||||
@@ -71,7 +75,7 @@ public abstract class BaseDataSourceConfig {
|
||||
}
|
||||
|
||||
public Connection getConnection() throws SQLException {
|
||||
getConnectionExecuted.incrementAndGet();
|
||||
getConnectionExecuted.increment();
|
||||
return dataSource.getConnection();
|
||||
}
|
||||
|
||||
@@ -80,7 +84,7 @@ public abstract class BaseDataSourceConfig {
|
||||
}
|
||||
|
||||
public Connection getConnection(String username, String password) throws SQLException {
|
||||
getConnectionExecuted.incrementAndGet();
|
||||
getConnectionExecuted.increment();
|
||||
return dataSource.getConnection(username, password);
|
||||
}
|
||||
|
||||
@@ -139,8 +143,6 @@ public abstract class BaseDataSourceConfig {
|
||||
String datasourceId = getDataSourceName();
|
||||
DataSourceInSpringClassloader wrappedObj = new DataSourceInSpringClassloader(datasourceId, poolDataSource);
|
||||
|
||||
Monitors.registerObject(datasourceId, this);
|
||||
|
||||
BasicGauge<Integer> numberOfActiveJDBCConnections = new BasicGauge<>(
|
||||
MonitorConfig.builder(getDataSourceName() + "-numberOfActiveJDBCConnections").withTags(tags).build(),
|
||||
new Callable<Integer>() {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -16,7 +15,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-models</artifactId>
|
||||
@@ -16,20 +14,20 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>json-patch-tip</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- this is used to register all subclasses of BaseJsonModel for deserialization -->
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>reflections-tip</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
if(address.length >= 6)
|
||||
{
|
||||
long mac = 0;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (var i = 0; i < 6; i++) {
|
||||
long t = (address[i] & 0xffL) << ((5 - i) * 8);
|
||||
mac |= t;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
}
|
||||
|
||||
public String getAddressAsString() {
|
||||
StringBuilder sb = new StringBuilder(124);
|
||||
var sb = new StringBuilder(124);
|
||||
|
||||
if(address != null)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
|
||||
@JsonIgnore
|
||||
public String getAsLowerCaseString() {
|
||||
StringBuilder sb = new StringBuilder(124);
|
||||
var sb = new StringBuilder(124);
|
||||
for (byte single : address) {
|
||||
sb.append(String.format("%02x", single));
|
||||
}
|
||||
@@ -131,8 +131,8 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
final var prime = 31;
|
||||
var result = 1;
|
||||
result = prime * result + Arrays.hashCode(address);
|
||||
return result;
|
||||
}
|
||||
@@ -163,12 +163,16 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
|
||||
|
||||
private static byte[] stringToByteArray(String str) {
|
||||
byte[] ret = new byte[6];
|
||||
if (str == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var ret = new byte[6];
|
||||
|
||||
String octets[] = str.split(":");
|
||||
if(octets.length == 1 && octets[0].length() == str.length() && str.length()<=12) {
|
||||
// hex string without colon
|
||||
for(int i = 0; i< str.length(); i+=2) {
|
||||
for(var i = 0; i< str.length(); i+=2) {
|
||||
Integer hex = Integer.parseInt(str.substring(i, i==str.length()-1?i+1:i+2), 16);
|
||||
ret[i/2] = hex.byteValue();
|
||||
}
|
||||
@@ -178,7 +182,7 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
}
|
||||
else {
|
||||
try {
|
||||
for (int i = 0; i < octets.length; i++) {
|
||||
for (var i = 0; i < octets.length; i++) {
|
||||
Integer hex = Integer.parseInt(octets[i], 16);
|
||||
ret[i] = hex.byteValue();
|
||||
}
|
||||
@@ -210,8 +214,8 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
else
|
||||
{
|
||||
String[] value = lowercaseValue.split(":");
|
||||
StringBuilder sb = new StringBuilder(6);
|
||||
for(int i=0; i<3; i++)
|
||||
var sb = new StringBuilder(6);
|
||||
for(var i=0; i<3; i++)
|
||||
{
|
||||
sb.append(value[i].toLowerCase());
|
||||
}
|
||||
@@ -221,11 +225,11 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
}
|
||||
|
||||
public String toOuiString() {
|
||||
if(address == null) {
|
||||
if(address == null || address.length == 0) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(6);
|
||||
for (int i = 0; i< 3; i++) {
|
||||
var sb = new StringBuilder(6);
|
||||
for (var i = 0; i< 3; i++) {
|
||||
sb.append(String.format("%02x", address[i]));
|
||||
}
|
||||
return sb.toString();
|
||||
@@ -288,11 +292,17 @@ public class MacAddress extends BaseJsonModel implements Comparable<MacAddress>
|
||||
* @return
|
||||
*/
|
||||
public static Long convertMacStringToLongValue(String macStr) {
|
||||
|
||||
if (macStr == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] bval = stringToByteArray(macStr);
|
||||
|
||||
if (bval.length >= 6) {
|
||||
long mac = 0;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (var i = 0; i < 6; i++) {
|
||||
long t = (bval[i] & 0xffL) << ((5 - i) * 8);
|
||||
mac |= t;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.telecominfraproject.wlan.core.model.json.interfaces;
|
||||
/**
|
||||
* Marker interface that tells if current object can provide a timestamp from its source data (i.e. timestamp for stats report used to generate a ServiceMetric)
|
||||
* @author mikehansen1970
|
||||
*
|
||||
*/
|
||||
public interface HasSourceTimestamp {
|
||||
|
||||
/**
|
||||
* @return the timestamp of the source data for this object (i.e. for the stats that were used for a ServiceMetric)
|
||||
*/
|
||||
public long getSourceTimestampMs();
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.telecominfraproject.wlan.core.model.utils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.math3.stat.descriptive.rank.Percentile;
|
||||
|
||||
|
||||
@@ -19,6 +22,30 @@ public class DecibelUtils
|
||||
return avgDbVal10;
|
||||
}
|
||||
|
||||
public static double getAverageDecibel(Collection<Integer> decibels)
|
||||
{
|
||||
if (decibels == null || decibels.isEmpty()) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double aggregation = 0;
|
||||
int count=0;
|
||||
Iterator<Integer> iter = decibels.iterator();
|
||||
|
||||
while(iter.hasNext()) {
|
||||
Integer value = iter.next();
|
||||
if(value!=null) {
|
||||
aggregation += Math.pow(10, value/10.0);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
return 0.0;
|
||||
}else {
|
||||
return 10 * Math.log10(aggregation/count);
|
||||
}
|
||||
}
|
||||
|
||||
public static double getDecibelStandardDeviation(int[] decibels)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,8 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
@@ -14,8 +16,6 @@ import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
|
||||
public class MacAddressTest {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MacAddressTest.class);
|
||||
|
||||
@@ -145,5 +145,97 @@ public class MacAddressTest {
|
||||
assertEquals(first, equalToFirst);
|
||||
assertNotEquals(first, notEqualToFirst);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetAddress() {
|
||||
MacAddress nullCheck = new MacAddress();
|
||||
nullCheck.setAddress(null);
|
||||
assertNull(nullCheck.getAddress());
|
||||
|
||||
MacAddress realValue = new MacAddress();
|
||||
realValue.setAddress(new byte[] { 1, 2, 3, 4, 5, 6 });
|
||||
assertNotNull(realValue.getAddress());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAddressAsLong()
|
||||
{
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.getAddressAsLong());
|
||||
|
||||
MacAddress otherMacAddress = new MacAddress(new byte[] { 1, 2, 3, 4, 5});
|
||||
assertNull(otherMacAddress.getAddressAsLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAddressAsString() {
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.getAddressAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAsLowerCaseString() {
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.getAsLowerCaseString().toCharArray());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashCode()
|
||||
{
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
|
||||
assertNotEquals(macAddress.hashCode(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringToByteArray()
|
||||
{
|
||||
MacAddress macAddress = new MacAddress();
|
||||
macAddress.setAddressAsString(null);
|
||||
assertNull(macAddress.getAddress());
|
||||
|
||||
macAddress.setAddressAsString("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.getAddress());
|
||||
|
||||
try {
|
||||
macAddress.setAddressAsString("00:2a:f7:7a:1e:a0:b0:f1");
|
||||
fail("expected exception.");
|
||||
} catch (IllegalArgumentException e)
|
||||
{
|
||||
//expected it
|
||||
}
|
||||
try {
|
||||
macAddress.setAddressAsString("00:2a:f7:7a:1esdafsat:a0");
|
||||
fail("expected exception.");
|
||||
} catch (IllegalArgumentException e)
|
||||
{
|
||||
//expected it
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOuiFromLowerCaseString()
|
||||
{
|
||||
assertNotNull(MacAddress.ouiFromLowerCaseString("00:2a:f7:7a:1e:a0", true));
|
||||
assertNotNull(MacAddress.ouiFromLowerCaseString("00:2a:f7:7a:1e:a0", false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToOuiString()
|
||||
{
|
||||
MacAddress macAddress = new MacAddress("00:2a:f7:7a:1e:a0");
|
||||
assertNotNull(macAddress.toOuiString());
|
||||
|
||||
MacAddress nullCheck = new MacAddress();
|
||||
nullCheck.setAddressAsString(null);
|
||||
assertNull(nullCheck.toOuiString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertMacStringToLongValue()
|
||||
{
|
||||
assertNotNull(MacAddress.convertMacStringToLongValue("00:2a:f7:7a:1e:a0"));
|
||||
assertNull(MacAddress.convertMacStringToLongValue(null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-partitioner</artifactId>
|
||||
@@ -13,7 +13,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-hazelcast-client</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-remote-tests</artifactId>
|
||||
@@ -15,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-tx-tests</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-scheduler</artifactId>
|
||||
@@ -15,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-stream-consumer</artifactId>
|
||||
@@ -14,8 +14,15 @@
|
||||
<dependency>
|
||||
<artifactId>base-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -9,6 +9,12 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.netflix.servo.DefaultMonitorRegistry;
|
||||
import com.netflix.servo.monitor.BasicCounter;
|
||||
import com.netflix.servo.monitor.Counter;
|
||||
import com.netflix.servo.monitor.MonitorConfig;
|
||||
import com.netflix.servo.tag.TagList;
|
||||
import com.telecominfraproject.wlan.cloudmetrics.CloudMetricsTags;
|
||||
import com.telecominfraproject.wlan.core.model.streams.QueuedStreamMessage;
|
||||
|
||||
/**
|
||||
@@ -21,10 +27,21 @@ public class StreamMessageDispatcher {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(StreamMessageDispatcher.class);
|
||||
|
||||
private final TagList tags = CloudMetricsTags.commonTags;
|
||||
|
||||
final Counter messagesProcessed = new BasicCounter(MonitorConfig.builder("stream-processors-messagesProcessed").withTags(tags).build());
|
||||
|
||||
//autowire all available stream processors
|
||||
@Autowired(required = false)
|
||||
List<StreamProcessor> streamProcessors;
|
||||
|
||||
// dtop: use anonymous constructor to ensure that the following code always
|
||||
// get executed,
|
||||
// even when somebody adds another constructor in here
|
||||
{
|
||||
DefaultMonitorRegistry.getInstance().register(messagesProcessed);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
if(streamProcessors!=null && !streamProcessors.isEmpty()) {
|
||||
@@ -46,7 +63,7 @@ public class StreamMessageDispatcher {
|
||||
}
|
||||
|
||||
LOG.trace("Pushing message to stream processors {}", message);
|
||||
|
||||
messagesProcessed.increment();
|
||||
streamProcessors.forEach(sp -> sp.push(message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-stream-interface</artifactId>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>base-tx-tests</artifactId>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>cloud-metrics</artifactId>
|
||||
@@ -14,18 +13,18 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-exceptions</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-elasticsearch</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -26,11 +26,19 @@ public class CloudMetricsTags {
|
||||
public static final String localIpV4 = getPropertyAsString("container.localipv4", UNDEFINED_STR);
|
||||
|
||||
|
||||
public static final TagList commonTags = new BasicTagList(Arrays.asList(
|
||||
new BasicTag("InstanceId", instanceId),
|
||||
new BasicTag("local-ipv4", localIpV4),
|
||||
new BasicTag("cloudTag", buildCloudTag())
|
||||
));
|
||||
public static final TagList commonTags;
|
||||
|
||||
static {
|
||||
if(Boolean.parseBoolean(getPropertyAsString("tip.wlan.cloudMetricTags.enabled", "false"))) {
|
||||
commonTags = new BasicTagList(Arrays.asList(
|
||||
new BasicTag("InstanceId", instanceId),
|
||||
new BasicTag("local-ipv4", localIpV4),
|
||||
new BasicTag("cloudTag", buildCloudTag())
|
||||
));
|
||||
} else {
|
||||
commonTags = BasicTagList.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
private static String buildCloudTag(){
|
||||
return role + "-" + stack + "-" + deployment;
|
||||
|
||||
@@ -242,11 +242,12 @@ public class StartServoMetricsCollector implements CommandLineRunner {
|
||||
MetricObserver transformElasticSearch = new CounterToRateMetricTransform(
|
||||
elasticSearchObserver, aggregationHeartbeatMultiplier * samplingIntervalMs, TimeUnit.MILLISECONDS);
|
||||
observers.add(transformElasticSearch);
|
||||
LOG.info("ElasticSearch metrics collection is ON");
|
||||
}catch(UnknownHostException e){
|
||||
LOG.error("Cannot initialize ElasticSearch client", e);
|
||||
}
|
||||
} else {
|
||||
LOG.info("ElasticSearch metrics collection is OFF");
|
||||
LOG.debug("ElasticSearch metrics collection is OFF");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>common-hazelcast</artifactId>
|
||||
@@ -20,7 +19,7 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>reflections-tip</artifactId>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<artifactId>webtoken-auth-service</artifactId>
|
||||
@@ -16,13 +14,13 @@
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-container</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-client</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
Reference in New Issue
Block a user