Add alarm config into application.yml.
This commit is contained in:
parent
f625cdd166
commit
766971837b
|
|
@ -41,4 +41,13 @@ storage:
|
|||
cluster_nodes: localhost:9300
|
||||
index_shards_number: 2
|
||||
index_replicas_number: 0
|
||||
ttl: 7
|
||||
ttl: 7
|
||||
configuration:
|
||||
default:
|
||||
application_apdex_threshold: 2000
|
||||
service_error_rate_threshold: 10.00
|
||||
service_average_response_time_threshold: 2000
|
||||
instance_error_rate_threshold: 10.00
|
||||
instance_average_response_time_threshold: 2000
|
||||
application_error_rate_threshold: 10.00
|
||||
application_average_response_time_threshold: 2000
|
||||
|
|
@ -42,6 +42,14 @@ import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedExcepti
|
|||
*/
|
||||
public class ConfigurationModuleProvider extends ModuleProvider {
|
||||
|
||||
private static final String APPLICATION_APDEX_THRESHOLD = "application_apdex_threshold";
|
||||
private static final String SERVICE_ERROR_RATE_THRESHOLD = "service_error_rate_threshold";
|
||||
private static final String SERVICE_AVERAGE_RESPONSE_TIME_THRESHOLD = "service_average_response_time_threshold";
|
||||
private static final String INSTANCE_ERROR_RATE_THRESHOLD = "instance_error_rate_threshold";
|
||||
private static final String INSTANCE_AVERAGE_RESPONSE_TIME_THRESHOLD = "instance_average_response_time_threshold";
|
||||
private static final String APPLICATION_ERROR_RATE_THRESHOLD = "application_error_rate_threshold";
|
||||
private static final String APPLICATION_AVERAGE_RESPONSE_TIME_THRESHOLD = "application_average_response_time_threshold";
|
||||
|
||||
@Override public String name() {
|
||||
return "default";
|
||||
}
|
||||
|
|
@ -51,13 +59,21 @@ public class ConfigurationModuleProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public void prepare(Properties config) throws ServiceNotProvidedException {
|
||||
this.registerServiceImplementation(IApdexThresholdService.class, new ApdexThresholdService());
|
||||
this.registerServiceImplementation(IServiceAlarmRuleConfig.class, new ServiceAlarmRuleConfig());
|
||||
this.registerServiceImplementation(IInstanceAlarmRuleConfig.class, new InstanceAlarmRuleConfig());
|
||||
this.registerServiceImplementation(IApplicationAlarmRuleConfig.class, new ApplicationAlarmRuleConfig());
|
||||
this.registerServiceImplementation(IServiceReferenceAlarmRuleConfig.class, new ServiceReferenceAlarmRuleConfig());
|
||||
this.registerServiceImplementation(IInstanceReferenceAlarmRuleConfig.class, new InstanceReferenceAlarmRuleConfig());
|
||||
this.registerServiceImplementation(IApplicationReferenceAlarmRuleConfig.class, new ApplicationReferenceAlarmRuleConfig());
|
||||
Integer applicationApdexThreshold = (Integer)config.getOrDefault(APPLICATION_APDEX_THRESHOLD, 2000);
|
||||
Double serviceErrorRateThreshold = (Double)config.getOrDefault(SERVICE_ERROR_RATE_THRESHOLD, 10.00);
|
||||
Integer serviceAverageResponseTimeThreshold = (Integer)config.getOrDefault(SERVICE_AVERAGE_RESPONSE_TIME_THRESHOLD, 2000);
|
||||
Double instanceErrorRateThreshold = (Double)config.getOrDefault(INSTANCE_ERROR_RATE_THRESHOLD, 10.00);
|
||||
Integer instanceAverageResponseTimeThreshold = (Integer)config.getOrDefault(INSTANCE_AVERAGE_RESPONSE_TIME_THRESHOLD, 2000);
|
||||
Double applicationErrorRateThreshold = (Double)config.getOrDefault(APPLICATION_ERROR_RATE_THRESHOLD, 10.00);
|
||||
Integer applicationAverageResponseTimeThreshold = (Integer)config.getOrDefault(APPLICATION_AVERAGE_RESPONSE_TIME_THRESHOLD, 2000);
|
||||
|
||||
this.registerServiceImplementation(IApdexThresholdService.class, new ApdexThresholdService(applicationApdexThreshold));
|
||||
this.registerServiceImplementation(IServiceAlarmRuleConfig.class, new ServiceAlarmRuleConfig(serviceErrorRateThreshold, serviceAverageResponseTimeThreshold));
|
||||
this.registerServiceImplementation(IInstanceAlarmRuleConfig.class, new InstanceAlarmRuleConfig(instanceErrorRateThreshold, instanceAverageResponseTimeThreshold));
|
||||
this.registerServiceImplementation(IApplicationAlarmRuleConfig.class, new ApplicationAlarmRuleConfig(applicationErrorRateThreshold, applicationAverageResponseTimeThreshold));
|
||||
this.registerServiceImplementation(IServiceReferenceAlarmRuleConfig.class, new ServiceReferenceAlarmRuleConfig(serviceErrorRateThreshold, serviceAverageResponseTimeThreshold));
|
||||
this.registerServiceImplementation(IInstanceReferenceAlarmRuleConfig.class, new InstanceReferenceAlarmRuleConfig(instanceErrorRateThreshold, instanceAverageResponseTimeThreshold));
|
||||
this.registerServiceImplementation(IApplicationReferenceAlarmRuleConfig.class, new ApplicationReferenceAlarmRuleConfig(applicationErrorRateThreshold, applicationAverageResponseTimeThreshold));
|
||||
}
|
||||
|
||||
@Override public void start(Properties config) throws ServiceNotProvidedException {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.apache.skywalking.apm.collector.configuration.service;
|
||||
|
||||
/**
|
||||
|
|
@ -24,6 +23,12 @@ package org.apache.skywalking.apm.collector.configuration.service;
|
|||
*/
|
||||
public class ApdexThresholdService implements IApdexThresholdService {
|
||||
|
||||
private int apdexThreshold;
|
||||
|
||||
public ApdexThresholdService(int apdexThreshold) {
|
||||
this.apdexThreshold = apdexThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apdex T applies to web transactions only
|
||||
*
|
||||
|
|
@ -31,6 +36,6 @@ public class ApdexThresholdService implements IApdexThresholdService {
|
|||
* @return This value is in milli-seconds.
|
||||
*/
|
||||
@Override public Integer getApplicationApdexThreshold(int applicationId) {
|
||||
return 1000;
|
||||
return apdexThreshold;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,27 @@ package org.apache.skywalking.apm.collector.configuration.service;
|
|||
*/
|
||||
public class ApplicationAlarmRuleConfig implements IApplicationAlarmRuleConfig {
|
||||
|
||||
private double errorRateThreshold;
|
||||
private int averageResponseTimeThreshold;
|
||||
|
||||
public ApplicationAlarmRuleConfig(double errorRateThreshold, int averageResponseTimeThreshold) {
|
||||
this.errorRateThreshold = errorRateThreshold;
|
||||
this.averageResponseTimeThreshold = averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,27 @@ package org.apache.skywalking.apm.collector.configuration.service;
|
|||
*/
|
||||
public class ApplicationReferenceAlarmRuleConfig implements IApplicationReferenceAlarmRuleConfig {
|
||||
|
||||
private double errorRateThreshold;
|
||||
private int averageResponseTimeThreshold;
|
||||
|
||||
public ApplicationReferenceAlarmRuleConfig(double errorRateThreshold, int averageResponseTimeThreshold) {
|
||||
this.errorRateThreshold = errorRateThreshold;
|
||||
this.averageResponseTimeThreshold = averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,27 @@ package org.apache.skywalking.apm.collector.configuration.service;
|
|||
*/
|
||||
public class InstanceAlarmRuleConfig implements IInstanceAlarmRuleConfig {
|
||||
|
||||
private double errorRateThreshold;
|
||||
private int averageResponseTimeThreshold;
|
||||
|
||||
public InstanceAlarmRuleConfig(double errorRateThreshold, int averageResponseTimeThreshold) {
|
||||
this.errorRateThreshold = errorRateThreshold;
|
||||
this.averageResponseTimeThreshold = averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,27 @@ package org.apache.skywalking.apm.collector.configuration.service;
|
|||
*/
|
||||
public class InstanceReferenceAlarmRuleConfig implements IInstanceReferenceAlarmRuleConfig {
|
||||
|
||||
private double errorRateThreshold;
|
||||
private int averageResponseTimeThreshold;
|
||||
|
||||
public InstanceReferenceAlarmRuleConfig(double errorRateThreshold, int averageResponseTimeThreshold) {
|
||||
this.errorRateThreshold = errorRateThreshold;
|
||||
this.averageResponseTimeThreshold = averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,27 @@ package org.apache.skywalking.apm.collector.configuration.service;
|
|||
*/
|
||||
public class ServiceAlarmRuleConfig implements IServiceAlarmRuleConfig {
|
||||
|
||||
private double errorRateThreshold;
|
||||
private int averageResponseTimeThreshold;
|
||||
|
||||
public ServiceAlarmRuleConfig(double errorRateThreshold, int averageResponseTimeThreshold) {
|
||||
this.errorRateThreshold = errorRateThreshold;
|
||||
this.averageResponseTimeThreshold = averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,27 @@ package org.apache.skywalking.apm.collector.configuration.service;
|
|||
*/
|
||||
public class ServiceReferenceAlarmRuleConfig implements IServiceReferenceAlarmRuleConfig {
|
||||
|
||||
private double errorRateThreshold;
|
||||
private int averageResponseTimeThreshold;
|
||||
|
||||
public ServiceReferenceAlarmRuleConfig(double errorRateThreshold, int averageResponseTimeThreshold) {
|
||||
this.errorRateThreshold = errorRateThreshold;
|
||||
this.averageResponseTimeThreshold = averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double calleeAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerErrorRateThreshold() {
|
||||
return 10.00;
|
||||
return errorRateThreshold;
|
||||
}
|
||||
|
||||
@Override public double callerAverageResponseTimeThreshold() {
|
||||
return 2000;
|
||||
return averageResponseTimeThreshold;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ analysis_alarm:
|
|||
default:
|
||||
configuration:
|
||||
default:
|
||||
application_apdex_threshold: 2000
|
||||
service_error_rate_threshold: 10.00
|
||||
service_average_response_time_threshold: 2000
|
||||
instance_error_rate_threshold: 10.00
|
||||
instance_average_response_time_threshold: 2000
|
||||
application_error_rate_threshold: 10.00
|
||||
application_average_response_time_threshold: 2000
|
||||
ui:
|
||||
jetty:
|
||||
host: localhost
|
||||
|
|
|
|||
Loading…
Reference in New Issue