/* * Copyright 2017, OpenSkywalking Organization All rights reserved. * * 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 repository: https://github.com/OpenSkywalking/skywalking */ package org.skywalking.apm.collector.storage.define.global; import org.skywalking.apm.collector.core.stream.Data; import org.skywalking.apm.collector.core.stream.Transform; import org.skywalking.apm.collector.core.stream.operate.CoverOperation; import org.skywalking.apm.collector.core.stream.operate.NonOperation; import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; import org.skywalking.apm.collector.storage.define.Attribute; import org.skywalking.apm.collector.storage.define.AttributeType; import org.skywalking.apm.collector.storage.define.DataDefine; /** * @author pengys5 */ public class GlobalTraceDataDefine extends DataDefine { @Override protected int initialCapacity() { return 4; } @Override protected void attributeDefine() { addAttribute(0, new Attribute(GlobalTraceTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); addAttribute(1, new Attribute(GlobalTraceTable.COLUMN_SEGMENT_ID, AttributeType.STRING, new CoverOperation())); addAttribute(2, new Attribute(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, AttributeType.STRING, new CoverOperation())); addAttribute(3, new Attribute(GlobalTraceTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); } @Override public Object deserialize(RemoteData remoteData) { return null; } @Override public RemoteData serialize(Object object) { return null; } public static class GlobalTrace implements Transform { private String id; private String segmentId; private String globalTraceId; private long timeBucket; public GlobalTrace() { } @Override public Data toData() { GlobalTraceDataDefine define = new GlobalTraceDataDefine(); Data data = define.build(id); data.setDataString(0, this.id); data.setDataString(1, this.segmentId); data.setDataString(2, this.globalTraceId); data.setDataLong(0, this.timeBucket); return data; } @Override public Object toSelf(Data data) { return null; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSegmentId() { return segmentId; } public void setSegmentId(String segmentId) { this.segmentId = segmentId; } public String getGlobalTraceId() { return globalTraceId; } public void setGlobalTraceId(String globalTraceId) { this.globalTraceId = globalTraceId; } public long getTimeBucket() { return timeBucket; } public void setTimeBucket(long timeBucket) { this.timeBucket = timeBucket; } } }