提交 d2f562f1 编写于 作者: wu-sheng's avatar wu-sheng

Adjust segment service and span interface.

上级 e09741c8
package org.skywalking.apm.network.trace.component;
/**
* @author wusheng
*/
public interface Component {
int getId();
String getName();
}
package org.skywalking.apm.network.trace.component;
/**
* @author wusheng
*/
public class ComponentsDefine {
public static final OfficialComponent TOMCAT = new OfficialComponent(1, "Tomcat");
}
package org.skywalking.apm.agent.core.context.component;
package org.skywalking.apm.network.trace.component;
/**
* @author wusheng
*/
public abstract class AbstractComponent {
public class OfficialComponent implements Component{
private int id;
private String name;
protected AbstractComponent(int id, String name) {
public OfficialComponent(int id, String name) {
this.id = id;
this.name = name;
}
@Override
public int getId() {
return id;
}
@Override
public String getName() {
return name;
}
}
......@@ -38,14 +38,16 @@ message SpanObject {
int64 startTime = 3;
int64 endTime = 4;
int32 operationNameId = 5;
int32 peerId = 6;
string peer = 7;
SpanType spanType = 8;
SpanLayer spanLayer = 9;
string component = 10;
bool isError = 11;
repeated KeyValue tags = 12;
repeated LogMessage logs = 13;
string operationName = 6;
int32 peerId = 7;
string peer = 8;
SpanType spanType = 9;
SpanLayer spanLayer = 10;
int32 componentId = 11;
string component = 12;
bool isError = 13;
repeated KeyValue tags = 14;
repeated LogMessage logs = 15;
}
enum SpanType {
......
package org.skywalking.apm.agent.core.context.trace;
import org.skywalking.apm.network.trace.component.Component;
/**
* The <code>AbstractSpan</code> represents the span's skeleton,
......@@ -8,6 +9,14 @@ package org.skywalking.apm.agent.core.context.trace;
* @author wusheng
*/
public interface AbstractSpan {
/**
* Set the component id, which defines in {@link org.skywalking.apm.network.trace.component.ComponentsDefine}
* @param component
*/
void setComponent(Component component);
void setComponent(String componentName);
void setLayer(SpanLayer layer);
/**
......
......@@ -2,10 +2,10 @@ package org.skywalking.apm.agent.core.context.trace;
import java.util.LinkedList;
import java.util.List;
import org.skywalking.apm.agent.core.context.component.AbstractComponent;
import org.skywalking.apm.agent.core.context.util.KeyValuePair;
import org.skywalking.apm.agent.core.context.util.ThrowableTransformer;
import org.skywalking.apm.agent.core.dictionary.DictionaryUtil;
import org.skywalking.apm.network.trace.component.Component;
/**
* The <code>AbstractTracingSpan</code> represents a group of {@link AbstractSpan} implementations,
......@@ -35,6 +35,8 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
protected int componentId = 0;
protected String componentName;
/**
* Log is a concept from OpenTracing spec.
* <p>
......@@ -123,7 +125,13 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
this.layer = layer;
}
public void setComponent(AbstractComponent component){
@Override
public void setComponent(Component component) {
this.componentId = component.getId();
}
@Override
public void setComponent(String componentName) {
this.componentName = componentName;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册