<commit_before>package com.profiler.context;

import com.profiler.Agent;
import org.apache.thrift.TBase;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 *
 */
public class SubSpanList implements Thriftable {

    private List<SubSpan> subSpanList = new ArrayList<SubSpan>();

    public SubSpanList(List<SubSpan> subSpanList) {
        this.subSpanList = subSpanList;
    }

    @Override
    public TBase toThrift() {
        com.profiler.common.dto.thrift.SubSpanList tSubSpanList = new com.profiler.common.dto.thrift.SubSpanList();
        // TODO 반드시 1개 이상이라는 조건을 충족해야 된다.
        SubSpan first = subSpanList.get(0);
        Span parentSpan = first.getParentSpan();
        tSubSpanList.setAgentId(Agent.getInstance().getAgentId());
        tSubSpanList.setAgentIdentifier(Agent.getInstance().getIdentifier());

        UUID id = parentSpan.getTraceID().getId();
        tSubSpanList.setMostTraceId(id.getMostSignificantBits());
        tSubSpanList.setLeastTraceId(id.getLeastSignificantBits());
        tSubSpanList.setSpanId(parentSpan.getTraceID().getSpanId());

        List<com.profiler.common.dto.thrift.SubSpan> tSubSpan = createSubSpan(subSpanList);

        tSubSpanList.setSubSpanList(tSubSpan);

        return tSubSpanList;
    }

    private List<com.profiler.common.dto.thrift.SubSpan> createSubSpan(List<SubSpan> subSpanList) {
        List<com.profiler.common.dto.thrift.SubSpan> result = new ArrayList<com.profiler.common.dto.thrift.SubSpan>(subSpanList.size());
        for (SubSpan subSpan : subSpanList) {
            com.profiler.common.dto.thrift.SubSpan tSubSpan = new com.profiler.common.dto.thrift.SubSpan();

            tSubSpan.setAgentId(Agent.getInstance().getAgentId());
            tSubSpan.setAgentIdentifier(Agent.getInstance().getIdentifier());

            long parentSpanStartTime = subSpan.getParentSpan().getStartTime();
            tSubSpan.setStartElapsed((int) (subSpan.getStartTime() - parentSpanStartTime));
            tSubSpan.setEndElapsed((int) (subSpan.getEndTime() - subSpan.getStartTime()));

            tSubSpan.setSequence(subSpan.getSequence());

            tSubSpan.setRpc(subSpan.getRpc());
            tSubSpan.setServiceName(subSpan.getServiceName());
            tSubSpan.setServiceType(subSpan.getServiceType().getCode());

            tSubSpan.setEndPoint(subSpan.getEndPoint());
            tSubSpan.setDestinationId(subSpan.getDestionationId());

            // 여기서 데이터 인코딩을 하자.
            List<com.profiler.common.dto.thrift.Annotation> annotationList = new ArrayList<com.profiler.common.dto.thrift.Annotation>(subSpan.getAnnotationSize());
            for (Annotation a : subSpan.getAnnotations()) {
                annotationList.add(a.toThrift());
            }
            
			if (subSpan.getDepth() != -1) {
				tSubSpan.setDepth(subSpan.getDepth());
			}

			if (subSpan.getNextSpanId() != -1) {
				tSubSpan.setNextSpanId(subSpan.getNextSpanId());
			}
            
            tSubSpan.setAnnotations(annotationList);
            result.add(tSubSpan);
        }
        return result;
    }
}
<commit_msg>[강운덕] [LUCYSUS-1744]SubSpanList의 클래명이 직관적이지 않아 SpanChunk로 변경함<commit_after>package com.profiler.context;

import com.profiler.Agent;
import com.profiler.common.dto.thrift.SpanChunk;
import org.apache.thrift.TBase;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 *
 */
public class SubSpanList implements Thriftable {

    private List<SubSpan> subSpanList = new ArrayList<SubSpan>();

    public SubSpanList(List<SubSpan> subSpanList) {
        this.subSpanList = subSpanList;
    }

    @Override
    public TBase toThrift() {
        SpanChunk tSpanChunk = new SpanChunk();
        // TODO 반드시 1개 이상이라는 조건을 충족해야 된다.
        SubSpan first = subSpanList.get(0);
        Span parentSpan = first.getParentSpan();
        tSpanChunk.setAgentId(Agent.getInstance().getAgentId());
        tSpanChunk.setAgentIdentifier(Agent.getInstance().getIdentifier());

        UUID id = parentSpan.getTraceID().getId();
        tSpanChunk.setMostTraceId(id.getMostSignificantBits());
        tSpanChunk.setLeastTraceId(id.getLeastSignificantBits());
        tSpanChunk.setSpanId(parentSpan.getTraceID().getSpanId());

        List<com.profiler.common.dto.thrift.SubSpan> tSubSpan = createSubSpan(subSpanList);

        tSpanChunk.setSubSpanList(tSubSpan);

        return tSpanChunk;
    }

    private List<com.profiler.common.dto.thrift.SubSpan> createSubSpan(List<SubSpan> subSpanList) {
        List<com.profiler.common.dto.thrift.SubSpan> result = new ArrayList<com.profiler.common.dto.thrift.SubSpan>(subSpanList.size());
        for (SubSpan subSpan : subSpanList) {
            com.profiler.common.dto.thrift.SubSpan tSubSpan = new com.profiler.common.dto.thrift.SubSpan();

            tSubSpan.setAgentId(Agent.getInstance().getAgentId());
            tSubSpan.setAgentIdentifier(Agent.getInstance().getIdentifier());

            long parentSpanStartTime = subSpan.getParentSpan().getStartTime();
            tSubSpan.setStartElapsed((int) (subSpan.getStartTime() - parentSpanStartTime));
            tSubSpan.setEndElapsed((int) (subSpan.getEndTime() - subSpan.getStartTime()));

            tSubSpan.setSequence(subSpan.getSequence());

            tSubSpan.setRpc(subSpan.getRpc());
            tSubSpan.setServiceName(subSpan.getServiceName());
            tSubSpan.setServiceType(subSpan.getServiceType().getCode());

            tSubSpan.setEndPoint(subSpan.getEndPoint());
            tSubSpan.setDestinationId(subSpan.getDestionationId());

            // 여기서 데이터 인코딩을 하자.
            List<com.profiler.common.dto.thrift.Annotation> annotationList = new ArrayList<com.profiler.common.dto.thrift.Annotation>(subSpan.getAnnotationSize());
            for (Annotation a : subSpan.getAnnotations()) {
                annotationList.add(a.toThrift());
            }
            
			if (subSpan.getDepth() != -1) {
				tSubSpan.setDepth(subSpan.getDepth());
			}

			if (subSpan.getNextSpanId() != -1) {
				tSubSpan.setNextSpanId(subSpan.getNextSpanId());
			}
            
            tSubSpan.setAnnotations(annotationList);
            result.add(tSubSpan);
        }
        return result;
    }
}

{'fraction_non_alphanumeric': 0.11923316708229427, 'fraction_numerical': 0.0018703241895261845, 'mean_word_length': 2.7747058823529414, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4886974', 'n_tokens_mistral': 2083, 'n_tokens_neox': 2079, 'n_words': 248}