Skip to content

Commit

Permalink
[#noissue] Remove unnecessary Thrift SpanFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Dec 31, 2024
1 parent df717b8 commit 73b5e15
Show file tree
Hide file tree
Showing 8 changed files with 451 additions and 730 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.navercorp.pinpoint.common.server;

import com.navercorp.pinpoint.common.server.bo.thrift.SpanFactory;
import com.navercorp.pinpoint.common.server.util.AcceptedTimeService;
import com.navercorp.pinpoint.common.server.util.AgentEventMessageDeserializerV1;
import com.navercorp.pinpoint.common.server.util.AgentEventMessageSerializerV1;
Expand Down Expand Up @@ -28,10 +27,6 @@ public AgentEventMessageSerializerV1 agentEventMessageSerializerV1() {
return new AgentEventMessageSerializerV1();
}

@Bean
public SpanFactory spanFactory() {
return new SpanFactory();
}

@Bean
public TimeSlot timeSlot() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,32 +172,17 @@ private void bind(SpanEventBo spanEvent, PSpanEvent pSpanEvent, SpanEventBo prev

spanEvent.setSequence((short) pSpanEvent.getSequence());

if (prevSpanEvent == null) {
int startElapsed = pSpanEvent.getStartElapsed();
spanEvent.setStartElapsed(startElapsed);
} else {
int startElapsed = pSpanEvent.getStartElapsed() + prevSpanEvent.getStartElapsed();
spanEvent.setStartElapsed(startElapsed);
}
int startTime = getStartTimeDelta(pSpanEvent, prevSpanEvent);
spanEvent.setStartElapsed(startTime);
spanEvent.setEndElapsed(pSpanEvent.getEndElapsed());

spanEvent.setServiceType((short) pSpanEvent.getServiceType());

spanEvent.setApiId(pSpanEvent.getApiId());

// v2 spec
final int depth = pSpanEvent.getDepth();
if (depth == 0) {
// depth compact case
if (prevSpanEvent == null) {
// first spanEvent
spanEvent.setDepth(0);
} else {
spanEvent.setDepth(prevSpanEvent.getDepth());
}
} else {
spanEvent.setDepth(depth);
}
int depth = getDepthDelta(pSpanEvent, prevSpanEvent);
spanEvent.setDepth(depth);

if (pSpanEvent.hasNextEvent()) {
final PNextEvent nextEvent = pSpanEvent.getNextEvent();
Expand Down Expand Up @@ -232,6 +217,29 @@ private void bind(SpanEventBo spanEvent, PSpanEvent pSpanEvent, SpanEventBo prev
}
}

private int getDepthDelta(PSpanEvent pSpanEvent, SpanEventBo prevSpanEvent) {
final int depth = pSpanEvent.getDepth();
if (depth == 0) {
// depth compact case
if (prevSpanEvent == null) {
// first spanEvent
return 0;
} else {
return prevSpanEvent.getDepth();
}
} else {
return depth;
}
}

private int getStartTimeDelta(PSpanEvent pSpanEvent, SpanEventBo prevSpanEvent) {
if (prevSpanEvent == null) {
return pSpanEvent.getStartElapsed();
} else {
return pSpanEvent.getStartElapsed() + prevSpanEvent.getStartElapsed();
}
}

public SpanChunkBo bindSpanChunkBo(PSpanChunk pSpanChunk, BindAttribute attribute) {
checkVersion(pSpanChunk.getVersion());

Expand Down

This file was deleted.

Loading

0 comments on commit 73b5e15

Please sign in to comment.