InstanceJvmYoungGcTimeIndicator.java 7.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.apache.skywalking.oap.server.core.analysis.generated.serviceinstancejvmgc;

import java.util.*;
import lombok.*;
import org.apache.skywalking.oap.server.core.Const;
24 25
import org.apache.skywalking.oap.server.core.alarm.AlarmMeta;
import org.apache.skywalking.oap.server.core.alarm.AlarmSupported;
26
import org.apache.skywalking.oap.server.core.analysis.indicator.*;
27 28 29
import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType;
import org.apache.skywalking.oap.server.core.remote.annotation.StreamData;
import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData;
30
import org.apache.skywalking.oap.server.core.storage.annotation.*;
31 32
import org.apache.skywalking.oap.server.core.storage.StorageBuilder;
import org.apache.skywalking.oap.server.core.source.Scope;
33 34 35 36 37 38 39 40

/**
 * This class is auto generated. Please don't change this class manually.
 *
 * @author Observability Analysis Language code generator
 */
@IndicatorType
@StreamData
41
@StorageEntity(name = "instance_jvm_young_gc_time", builder = InstanceJvmYoungGcTimeIndicator.Builder.class, source = Scope.ServiceInstanceJVMGC)
42
public class InstanceJvmYoungGcTimeIndicator extends LongAvgIndicator implements AlarmSupported {
43

44
    @Setter @Getter @Column(columnName = "entity_id") @IDColumn private java.lang.String entityId;
wu-sheng's avatar
wu-sheng 已提交
45
    @Setter @Getter @Column(columnName = "service_instance_id")  private int serviceInstanceId;
46 47 48

    @Override public String id() {
        String splitJointId = String.valueOf(getTimeBucket());
wu-sheng's avatar
wu-sheng 已提交
49
        splitJointId += Const.ID_SPLIT + entityId;
50 51 52 53 54
        return splitJointId;
    }

    @Override public int hashCode() {
        int result = 17;
wu-sheng's avatar
wu-sheng 已提交
55
        result = 31 * result + entityId.hashCode();
56 57 58 59
        result = 31 * result + (int)getTimeBucket();
        return result;
    }

wu-sheng's avatar
wu-sheng 已提交
60 61 62 63 64 65
    @Override public int remoteHashCode() {
        int result = 17;
        result = 31 * result + entityId.hashCode();
        return result;
    }

66 67 68 69 70 71 72 73
    @Override public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;

74
        InstanceJvmYoungGcTimeIndicator indicator = (InstanceJvmYoungGcTimeIndicator)obj;
wu-sheng's avatar
wu-sheng 已提交
75
        if (!entityId.equals(indicator.entityId))
76
            return false;
77

78 79 80 81 82 83 84 85
        if (getTimeBucket() != indicator.getTimeBucket())
            return false;

        return true;
    }

    @Override public RemoteData.Builder serialize() {
        RemoteData.Builder remoteBuilder = RemoteData.newBuilder();
86
        remoteBuilder.addDataStrings(getEntityId());
87

88 89 90
        remoteBuilder.addDataLongs(getSummation());
        remoteBuilder.addDataLongs(getValue());
        remoteBuilder.addDataLongs(getTimeBucket());
91 92


93 94
        remoteBuilder.addDataIntegers(getServiceInstanceId());
        remoteBuilder.addDataIntegers(getCount());
95 96 97 98 99

        return remoteBuilder;
    }

    @Override public void deserialize(RemoteData remoteData) {
wu-sheng's avatar
wu-sheng 已提交
100
        setEntityId(remoteData.getDataStrings(0));
101 102 103 104 105 106

        setSummation(remoteData.getDataLongs(0));
        setValue(remoteData.getDataLongs(1));
        setTimeBucket(remoteData.getDataLongs(2));


wu-sheng's avatar
wu-sheng 已提交
107 108
        setServiceInstanceId(remoteData.getDataIntegers(0));
        setCount(remoteData.getDataIntegers(1));
109 110


111 112
    }

113
    @Override public AlarmMeta getAlarmMeta() {
wu-sheng's avatar
wu-sheng 已提交
114
        return new AlarmMeta("instance_jvm_young_gc_time", Scope.ServiceInstanceJVMGC, entityId);
115 116
    }

117 118 119
    @Override
    public Indicator toHour() {
        InstanceJvmYoungGcTimeIndicator indicator = new InstanceJvmYoungGcTimeIndicator();
wu-sheng's avatar
wu-sheng 已提交
120
        indicator.setEntityId(this.getEntityId());
121 122 123 124
        indicator.setServiceInstanceId(this.getServiceInstanceId());
        indicator.setSummation(this.getSummation());
        indicator.setCount(this.getCount());
        indicator.setValue(this.getValue());
125
        indicator.setTimeBucket(toTimeBucketInHour());
126 127 128 129 130 131
        return indicator;
    }

    @Override
    public Indicator toDay() {
        InstanceJvmYoungGcTimeIndicator indicator = new InstanceJvmYoungGcTimeIndicator();
wu-sheng's avatar
wu-sheng 已提交
132
        indicator.setEntityId(this.getEntityId());
133 134 135 136
        indicator.setServiceInstanceId(this.getServiceInstanceId());
        indicator.setSummation(this.getSummation());
        indicator.setCount(this.getCount());
        indicator.setValue(this.getValue());
137
        indicator.setTimeBucket(toTimeBucketInDay());
138 139 140 141 142 143
        return indicator;
    }

    @Override
    public Indicator toMonth() {
        InstanceJvmYoungGcTimeIndicator indicator = new InstanceJvmYoungGcTimeIndicator();
wu-sheng's avatar
wu-sheng 已提交
144
        indicator.setEntityId(this.getEntityId());
145 146 147 148
        indicator.setServiceInstanceId(this.getServiceInstanceId());
        indicator.setSummation(this.getSummation());
        indicator.setCount(this.getCount());
        indicator.setValue(this.getValue());
149
        indicator.setTimeBucket(toTimeBucketInMonth());
150 151 152
        return indicator;
    }

153
    public static class Builder implements StorageBuilder<InstanceJvmYoungGcTimeIndicator> {
154

155
        @Override public Map<String, Object> data2Map(InstanceJvmYoungGcTimeIndicator storageData) {
156
            Map<String, Object> map = new HashMap<>();
wu-sheng's avatar
wu-sheng 已提交
157
            map.put("entity_id", storageData.getEntityId());
158 159 160 161 162 163 164 165
            map.put("service_instance_id", storageData.getServiceInstanceId());
            map.put("summation", storageData.getSummation());
            map.put("count", storageData.getCount());
            map.put("value", storageData.getValue());
            map.put("time_bucket", storageData.getTimeBucket());
            return map;
        }

166 167
        @Override public InstanceJvmYoungGcTimeIndicator map2Data(Map<String, Object> dbMap) {
            InstanceJvmYoungGcTimeIndicator indicator = new InstanceJvmYoungGcTimeIndicator();
wu-sheng's avatar
wu-sheng 已提交
168
            indicator.setEntityId((String)dbMap.get("entity_id"));
169 170 171 172 173 174 175 176 177
            indicator.setServiceInstanceId(((Number)dbMap.get("service_instance_id")).intValue());
            indicator.setSummation(((Number)dbMap.get("summation")).longValue());
            indicator.setCount(((Number)dbMap.get("count")).intValue());
            indicator.setValue(((Number)dbMap.get("value")).longValue());
            indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue());
            return indicator;
        }
    }
}