Search in sources :

Example 11 with ServiceName

use of org.apache.skywalking.apm.collector.storage.table.register.ServiceName in project incubator-skywalking by apache.

the class ServiceReferenceMetricAlarmAssertWorker method generateAlarmContent.

@Override
protected void generateAlarmContent(ServiceReferenceAlarm alarm, double threshold) {
    ServiceName serviceName = serviceNameCacheService.get(alarm.getBehindServiceId());
    String clientOrServer = "server";
    if (MetricSource.Caller.getValue() == alarm.getSourceValue()) {
        clientOrServer = "client";
    }
    if (AlarmType.ERROR_RATE.getValue() == alarm.getAlarmType()) {
        alarm.setAlarmContent("The success rate of " + serviceName.getServiceName() + ", detected from " + clientOrServer + " side, is lower than " + threshold + " rate.");
    } else if (AlarmType.SLOW_RTT.getValue() == alarm.getAlarmType()) {
        alarm.setAlarmContent("Response time of " + serviceName.getServiceName() + ", detected from " + clientOrServer + " side, is slower than " + threshold + " ms.");
    }
}
Also used : ServiceName(org.apache.skywalking.apm.collector.storage.table.register.ServiceName)

Example 12 with ServiceName

use of org.apache.skywalking.apm.collector.storage.table.register.ServiceName in project incubator-skywalking by apache.

the class ServiceNameH2CacheDAO method get.

@Override
public ServiceName get(int serviceId) {
    H2Client client = getClient();
    String sql = SqlBuilder.buildSql(GET_SERVICE_NAME_SQL, ServiceNameTable.COLUMN_APPLICATION_ID, ServiceNameTable.COLUMN_SERVICE_NAME, ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID);
    Object[] params = new Object[] { serviceId };
    try (ResultSet rs = client.executeQuery(sql, params)) {
        if (rs.next()) {
            ServiceName serviceName = new ServiceName();
            serviceName.setServiceId(serviceId);
            serviceName.setApplicationId(rs.getInt(ServiceNameTable.COLUMN_APPLICATION_ID));
            serviceName.setServiceName(rs.getString(ServiceNameTable.COLUMN_SERVICE_NAME));
            return serviceName;
        }
    } catch (SQLException | H2ClientException e) {
        logger.error(e.getMessage(), e);
    }
    return null;
}
Also used : H2Client(org.apache.skywalking.apm.collector.client.h2.H2Client) ServiceName(org.apache.skywalking.apm.collector.storage.table.register.ServiceName) SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet) H2ClientException(org.apache.skywalking.apm.collector.client.h2.H2ClientException)

Aggregations

ServiceName (org.apache.skywalking.apm.collector.storage.table.register.ServiceName)12 ParseException (java.text.ParseException)3 HashMap (java.util.HashMap)2 ServiceMetric (org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 H2Client (org.apache.skywalking.apm.collector.client.h2.H2Client)1 H2ClientException (org.apache.skywalking.apm.collector.client.h2.H2ClientException)1 Alarm (org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm)1 Call (org.apache.skywalking.apm.collector.storage.ui.common.Call)1 Node (org.apache.skywalking.apm.collector.storage.ui.common.Node)1 Topology (org.apache.skywalking.apm.collector.storage.ui.common.Topology)1 VisualUserNode (org.apache.skywalking.apm.collector.storage.ui.common.VisualUserNode)1 KeyValue (org.apache.skywalking.apm.collector.storage.ui.trace.KeyValue)1 LogEntity (org.apache.skywalking.apm.collector.storage.ui.trace.LogEntity)1