parent
7532583d90
commit
1bc5de7af9
|
|
@ -22,13 +22,23 @@ package org.apache.skywalking.apm.agent.core.context.tag;
|
|||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
|
||||
public abstract class AbstractTag<T> {
|
||||
|
||||
private int id;
|
||||
|
||||
private boolean canOverwrite;
|
||||
/**
|
||||
* The key of this Tag.
|
||||
*/
|
||||
protected final String key;
|
||||
|
||||
public AbstractTag(String tagKey) {
|
||||
public AbstractTag(int id, String tagKey, boolean canOverwrite) {
|
||||
this.id = id;
|
||||
this.key = tagKey;
|
||||
this.canOverwrite = canOverwrite;
|
||||
}
|
||||
|
||||
public AbstractTag(String key) {
|
||||
this(-1, key, false);
|
||||
}
|
||||
|
||||
protected abstract void set(AbstractSpan span, T tagValue);
|
||||
|
|
@ -39,4 +49,16 @@ public abstract class AbstractTag<T> {
|
|||
public String key() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public boolean sameWith(AbstractTag<T> tag) {
|
||||
return canOverwrite && tag.id == tag.id;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isCanOverwrite() {
|
||||
return canOverwrite;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,18 +22,26 @@ package org.apache.skywalking.apm.agent.core.context.tag;
|
|||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
|
||||
/**
|
||||
* A subclass of {@link AbstractTag},
|
||||
* represent a tag with a {@link String} value.
|
||||
* A subclass of {@link AbstractTag}, represent a tag with a {@link String} value.
|
||||
* <p>
|
||||
* Created by wusheng on 2017/2/17.
|
||||
*/
|
||||
public class StringTag extends AbstractTag<String> {
|
||||
|
||||
public StringTag(String tagKey) {
|
||||
super(tagKey);
|
||||
}
|
||||
|
||||
public StringTag(int id, String tagKey) {
|
||||
super(id, tagKey, false);
|
||||
}
|
||||
|
||||
public StringTag(int id, String tagKey, boolean canOverWrite) {
|
||||
super(id, tagKey, canOverWrite);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(AbstractSpan span, String tagValue) {
|
||||
span.tag(key, tagValue);
|
||||
span.tag(this, tagValue);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
package org.apache.skywalking.apm.agent.core.context.tag;
|
||||
|
||||
/**
|
||||
* The span tags are supported by sky-walking engine.
|
||||
* As default, all tags will be stored, but these ones have particular meanings.
|
||||
* The span tags are supported by sky-walking engine. As default, all tags will be stored, but these ones have
|
||||
* particular meanings.
|
||||
* <p>
|
||||
* Created by wusheng on 2017/2/17.
|
||||
*/
|
||||
|
|
@ -32,49 +32,49 @@ public final class Tags {
|
|||
/**
|
||||
* URL records the url of the incoming request.
|
||||
*/
|
||||
public static final StringTag URL = new StringTag("url");
|
||||
public static final StringTag URL = new StringTag(1, "url");
|
||||
|
||||
/**
|
||||
* STATUS_CODE records the http status code of the response.
|
||||
*/
|
||||
public static final StringTag STATUS_CODE = new StringTag("status_code");
|
||||
public static final StringTag STATUS_CODE = new StringTag(2, "status_code", true);
|
||||
|
||||
/**
|
||||
* DB_TYPE records database type, such as sql, redis, cassandra and so on.
|
||||
*/
|
||||
public static final StringTag DB_TYPE = new StringTag("db.type");
|
||||
public static final StringTag DB_TYPE = new StringTag(3, "db.type");
|
||||
|
||||
/**
|
||||
* DB_INSTANCE records database instance name.
|
||||
*/
|
||||
public static final StringTag DB_INSTANCE = new StringTag("db.instance");
|
||||
public static final StringTag DB_INSTANCE = new StringTag(4, "db.instance");
|
||||
|
||||
/**
|
||||
* DB_STATEMENT records the sql statement of the database access.
|
||||
*/
|
||||
public static final StringTag DB_STATEMENT = new StringTag("db.statement");
|
||||
public static final StringTag DB_STATEMENT = new StringTag(5, "db.statement");
|
||||
|
||||
/**
|
||||
* DB_BIND_VARIABLES records the bind variables of sql statement.
|
||||
*/
|
||||
public static final StringTag DB_BIND_VARIABLES = new StringTag("db.bind_vars");
|
||||
public static final StringTag DB_BIND_VARIABLES = new StringTag(6, "db.bind_vars");
|
||||
|
||||
/**
|
||||
* MQ_QUEUE records the queue name of message-middleware
|
||||
*/
|
||||
public static final StringTag MQ_QUEUE = new StringTag("mq.queue");
|
||||
public static final StringTag MQ_QUEUE = new StringTag(7, "mq.queue");
|
||||
|
||||
/**
|
||||
* MQ_BROKER records the broker address of message-middleware
|
||||
*/
|
||||
public static final StringTag MQ_BROKER = new StringTag("mq.broker");
|
||||
public static final StringTag MQ_BROKER = new StringTag(8, "mq.broker");
|
||||
|
||||
/**
|
||||
* MQ_TOPIC records the topic name of message-middleware
|
||||
*/
|
||||
public static final StringTag MQ_TOPIC = new StringTag("mq.topic");
|
||||
public static final StringTag MQ_TOPIC = new StringTag(9, "mq.topic");
|
||||
|
||||
public static final class HTTP {
|
||||
public static final StringTag METHOD = new StringTag("http.method");
|
||||
public static final StringTag METHOD = new StringTag(10, "http.method");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.skywalking.apm.agent.core.context.trace;
|
||||
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
|
||||
import org.apache.skywalking.apm.network.trace.component.Component;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
|
|
@ -52,8 +53,16 @@ public interface AbstractSpan {
|
|||
*
|
||||
* @return this Span instance, for chaining
|
||||
*/
|
||||
@Deprecated
|
||||
AbstractSpan tag(String key, String value);
|
||||
|
||||
/**
|
||||
* @param tag
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
AbstractSpan tag(AbstractTag tag, String value);
|
||||
|
||||
/**
|
||||
* Record an exception event of the current walltime timestamp.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -18,13 +18,17 @@
|
|||
|
||||
package org.apache.skywalking.apm.agent.core.context.trace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.StringTag;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.ThrowableTransformer;
|
||||
import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
|
||||
import org.apache.skywalking.apm.network.language.agent.*;
|
||||
import org.apache.skywalking.apm.network.language.agent.SpanType;
|
||||
import org.apache.skywalking.apm.network.language.agent.v2.SpanObjectV2;
|
||||
import org.apache.skywalking.apm.network.trace.component.Component;
|
||||
|
||||
|
|
@ -37,7 +41,7 @@ import org.apache.skywalking.apm.network.trace.component.Component;
|
|||
public abstract class AbstractTracingSpan implements AbstractSpan {
|
||||
protected int spanId;
|
||||
protected int parentSpanId;
|
||||
protected List<KeyValuePair> tags;
|
||||
protected List<TagValuePair> tags;
|
||||
protected String operationName;
|
||||
protected int operationId;
|
||||
protected SpanLayer layer;
|
||||
|
|
@ -90,11 +94,27 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
|
|||
* @return this Span instance, for chaining
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public AbstractTracingSpan tag(String key, String value) {
|
||||
return tag(new StringTag(key), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTracingSpan tag(AbstractTag tag, String value) {
|
||||
if (tags == null) {
|
||||
tags = new LinkedList<KeyValuePair>();
|
||||
tags = new ArrayList<TagValuePair>(8);
|
||||
}
|
||||
tags.add(new KeyValuePair(key, value));
|
||||
|
||||
if (tag.isCanOverwrite()) {
|
||||
for (TagValuePair pair : tags) {
|
||||
if (pair.sameWith(tag)) {
|
||||
pair.setValue(value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tags.add(new TagValuePair(tag, value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +296,7 @@ public abstract class AbstractTracingSpan implements AbstractSpan {
|
|||
}
|
||||
spanBuilder.setIsError(errorOccurred);
|
||||
if (this.tags != null) {
|
||||
for (KeyValuePair tag : this.tags) {
|
||||
for (TagValuePair tag : this.tags) {
|
||||
spanBuilder.addTags(tag.transform());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.apache.skywalking.apm.agent.core.context.trace;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
|
||||
import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
|
||||
import org.apache.skywalking.apm.network.language.agent.v2.SpanObjectV2;
|
||||
import org.apache.skywalking.apm.network.trace.component.Component;
|
||||
|
|
@ -26,13 +27,13 @@ import org.apache.skywalking.apm.network.trace.component.Component;
|
|||
/**
|
||||
* The <code>ExitSpan</code> represents a service consumer point, such as Feign, Okhttp client for a Http service.
|
||||
*
|
||||
* It is an exit point or a leaf span(our old name) of trace tree.
|
||||
* In a single rpc call, because of a combination of discovery libs, there maybe contain multi-layer exit point:
|
||||
* It is an exit point or a leaf span(our old name) of trace tree. In a single rpc call, because of a combination of
|
||||
* discovery libs, there maybe contain multi-layer exit point:
|
||||
*
|
||||
* The <code>ExitSpan</code> only presents the first one.
|
||||
*
|
||||
* Such as: Dubbox - Apache Httpcomponent - ...(Remote)
|
||||
* The <code>ExitSpan</code> represents the Dubbox span, and ignore the httpcomponent span's info.
|
||||
* Such as: Dubbox - Apache Httpcomponent - ...(Remote) The <code>ExitSpan</code> represents the Dubbox span, and ignore
|
||||
* the httpcomponent span's info.
|
||||
*
|
||||
* @author wusheng
|
||||
*/
|
||||
|
|
@ -83,6 +84,13 @@ public class ExitSpan extends StackBasedTracingSpan implements WithPeerInfo {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override public AbstractTracingSpan tag(AbstractTag tag, String value) {
|
||||
if (stackDepth == 1 || tag.isCanOverwrite()) {
|
||||
super.tag(tag, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTracingSpan setLayer(SpanLayer layer) {
|
||||
if (stackDepth == 1) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ package org.apache.skywalking.apm.agent.core.context.trace;
|
|||
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.agent.core.context.IgnoredTracerContext;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
|
||||
import org.apache.skywalking.apm.network.trace.component.Component;
|
||||
|
||||
/**
|
||||
|
|
@ -64,6 +65,10 @@ public class NoopSpan implements AbstractSpan {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override public AbstractSpan tag(AbstractTag tag, String value) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override public boolean isEntry() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.apm.agent.core.context.util;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
|
||||
import org.apache.skywalking.apm.network.common.KeyStringValuePair;
|
||||
|
||||
public class TagValuePair {
|
||||
private AbstractTag key;
|
||||
private String value;
|
||||
|
||||
public TagValuePair(AbstractTag tag, String value) {
|
||||
this.key = tag;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public AbstractTag getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public KeyStringValuePair transform() {
|
||||
KeyStringValuePair.Builder keyValueBuilder = KeyStringValuePair.newBuilder();
|
||||
keyValueBuilder.setKey(key.key());
|
||||
if (value != null) {
|
||||
keyValueBuilder.setValue(value);
|
||||
}
|
||||
return keyValueBuilder.build();
|
||||
}
|
||||
|
||||
public boolean sameWith(AbstractTag tag) {
|
||||
return key.isCanOverwrite() && key.getId() == tag.getId();
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
|||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegmentRef;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
|
|
@ -214,7 +214,7 @@ public class DubboInterceptorTest {
|
|||
}
|
||||
|
||||
private void assertCommonsAttribute(AbstractTracingSpan span) {
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.size(), is(1));
|
||||
assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.RPC_FRAMEWORK));
|
||||
assertThat(SpanHelper.getComponentId(span), is(3));
|
||||
|
|
|
|||
|
|
@ -26,13 +26,19 @@ import java.util.Collection;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
@ -43,12 +49,6 @@ import org.mockito.Mock;
|
|||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
|
@ -109,7 +109,7 @@ public class DefaultHttpClientInterceptorTest {
|
|||
AbstractTracingSpan finishedSpan = SegmentHelper.getSpans(traceSegment).get(0);
|
||||
assertSpan(finishedSpan);
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
assertThat(tags.size(), is(2));
|
||||
assertThat(tags.get(0).getValue(), is("GET"));
|
||||
assertThat(tags.get(1).getValue(), is("http://skywalking.org/"));
|
||||
|
|
@ -132,7 +132,7 @@ public class DefaultHttpClientInterceptorTest {
|
|||
AbstractTracingSpan finishedSpan = SegmentHelper.getSpans(traceSegment).get(0);
|
||||
assertSpan(finishedSpan);
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
assertThat(tags.size(), is(3));
|
||||
assertThat(tags.get(0).getValue(), is("GET"));
|
||||
assertThat(tags.get(1).getValue(), is("http://skywalking.org/"));
|
||||
|
|
@ -163,7 +163,7 @@ public class DefaultHttpClientInterceptorTest {
|
|||
AbstractTracingSpan finishedSpan = SegmentHelper.getSpans(traceSegment).get(0);
|
||||
assertSpan(finishedSpan);
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
assertThat(tags.size(), is(2));
|
||||
assertThat(tags.get(0).getValue(), is("GET"));
|
||||
assertThat(tags.get(1).getValue(), is("http://skywalking.org/"));
|
||||
|
|
|
|||
|
|
@ -26,7 +26,18 @@ import org.apache.http.HttpResponse;
|
|||
import org.apache.http.ProtocolVersion;
|
||||
import org.apache.http.RequestLine;
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
@ -38,17 +49,6 @@ import org.powermock.api.mockito.PowerMockito;
|
|||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
|
@ -143,7 +143,7 @@ public class HttpClientExecuteInterceptorTest {
|
|||
|
||||
assertThat(spans.size(), is(1));
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(spans.get(0));
|
||||
List<TagValuePair> tags = SpanHelper.getTags(spans.get(0));
|
||||
assertThat(tags.size(), is(3));
|
||||
assertThat(tags.get(2).getValue(), is("500"));
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ public class HttpClientExecuteInterceptorTest {
|
|||
private void assertHttpSpan(AbstractTracingSpan span) {
|
||||
assertThat(span.getOperationName(), is("/test-web/test"));
|
||||
assertThat(SpanHelper.getComponentId(span), is(2));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("http://127.0.0.1:8080/test-web/test"));
|
||||
assertThat(tags.get(1).getValue(), is("GET"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
|
|
|
|||
|
|
@ -17,7 +17,12 @@
|
|||
|
||||
package org.apache.skywalking.apm.plugin.httpasyncclient.v4;
|
||||
|
||||
import org.apache.http.*;
|
||||
import java.util.List;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.ProtocolVersion;
|
||||
import org.apache.http.RequestLine;
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestWrapper;
|
||||
import org.apache.http.client.protocol.HttpClientContext;
|
||||
|
|
@ -31,7 +36,7 @@ import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
|
|||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
|
|
@ -52,13 +57,13 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
|
|||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.skywalking.apm.plugin.httpasyncclient.v4.SessionRequestCompleteInterceptor.CONTEXT_LOCAL;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* @author lican
|
||||
|
|
@ -120,7 +125,6 @@ public class HttpAsyncClientInterceptorTest {
|
|||
when(httpHost.getHostName()).thenReturn("127.0.0.1");
|
||||
when(httpHost.getSchemeName()).thenReturn("http");
|
||||
|
||||
|
||||
final RequestLine requestLine = new RequestLine() {
|
||||
@Override
|
||||
public String getMethod() {
|
||||
|
|
@ -192,7 +196,6 @@ public class HttpAsyncClientInterceptorTest {
|
|||
assertHttpSpan(spans.get(0));
|
||||
verify(requestWrapper, times(1)).setHeader(anyString(), anyString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -205,12 +208,11 @@ public class HttpAsyncClientInterceptorTest {
|
|||
|
||||
verify(requestWrapper, times(0)).setHeader(anyString(), anyString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
private Thread baseTest() throws Throwable {
|
||||
Object[] allArguments = new Object[]{producer, consumer, httpContext, callback};
|
||||
Class[] types = new Class[]{HttpAsyncRequestProducer.class, HttpAsyncResponseConsumer.class, HttpContext.class, FutureCallback.class};
|
||||
Object[] allArguments = new Object[] {producer, consumer, httpContext, callback};
|
||||
Class[] types = new Class[] {HttpAsyncRequestProducer.class, HttpAsyncResponseConsumer.class, HttpContext.class, FutureCallback.class};
|
||||
httpAsyncClientInterceptor.beforeMethod(enhancedInstance, null, allArguments, types, null);
|
||||
Assert.assertEquals(CONTEXT_LOCAL.get(), httpContext);
|
||||
Assert.assertTrue(allArguments[1] instanceof HttpAsyncResponseConsumerWrapper);
|
||||
|
|
@ -254,7 +256,7 @@ public class HttpAsyncClientInterceptorTest {
|
|||
private void assertHttpSpan(AbstractTracingSpan span) {
|
||||
assertThat(span.getOperationName(), is("/test-web/test"));
|
||||
assertThat(SpanHelper.getComponentId(span), is(26));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("http://localhost:8081/original/test"));
|
||||
assertThat(tags.get(1).getValue(), is("GET"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ package org.apache.skywalking.apm.plugin.jdbc;
|
|||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Assert;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
|
@ -46,14 +46,14 @@ public abstract class AbstractStatementTest {
|
|||
protected void assertDBSpan(AbstractTracingSpan span, String exceptOperationName, String exceptDBStatement) {
|
||||
assertDBSpan(span, exceptOperationName);
|
||||
assertThat(span.isExit(), is(true));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(2).getValue(), is(exceptDBStatement));
|
||||
}
|
||||
|
||||
protected void assertDBSpan(AbstractTracingSpan span, String exceptOperationName) {
|
||||
assertThat(span.getOperationName(), is(exceptOperationName));
|
||||
assertThat(SpanHelper.getComponentId(span), is(33));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("sql"));
|
||||
assertThat(tags.get(1).getValue(), is("test"));
|
||||
assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.DB));
|
||||
|
|
|
|||
|
|
@ -22,15 +22,17 @@ package org.apache.skywalking.apm.plugin.jedis.v2;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
@ -40,8 +42,6 @@ import org.junit.runner.RunWith;
|
|||
import org.mockito.Mock;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
|
|
@ -129,7 +129,7 @@ public class JedisMethodInterceptorTest {
|
|||
assertThat(span.getOperationName(), is("Jedis/set"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
assertThat(SpanHelper.getComponentId(span), is(30));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("Redis"));
|
||||
assertThat(tags.get(1).getValue(), is("set OperationKey"));
|
||||
assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.CACHE));
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.net.URI;
|
|||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
|
|
@ -31,6 +31,7 @@ import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
|||
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.client.HttpRequest;
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
|
|
@ -42,7 +43,6 @@ import org.junit.runner.RunWith;
|
|||
import org.mockito.Mock;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
|
@ -87,7 +87,7 @@ public class SyncHttpRequestSendInterceptorTest {
|
|||
Assert.assertEquals(1, SegmentHelper.getSpans(traceSegment).size());
|
||||
AbstractTracingSpan finishedSpan = SegmentHelper.getSpans(traceSegment).get(0);
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
assertThat(tags.size(), is(2));
|
||||
assertThat(tags.get(0).getValue(), is("GET"));
|
||||
assertThat(tags.get(1).getValue(), is(uri.toString()));
|
||||
|
|
@ -107,7 +107,7 @@ public class SyncHttpRequestSendInterceptorTest {
|
|||
Assert.assertEquals(1, SegmentHelper.getSpans(traceSegment).size());
|
||||
AbstractTracingSpan finishedSpan = SegmentHelper.getSpans(traceSegment).get(0);
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
assertThat(tags.size(), is(2));
|
||||
assertThat(tags.get(0).getValue(), is("GET"));
|
||||
assertThat(tags.get(1).getValue(), is(uri.toString()));
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.net.URI;
|
|||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
|
|
@ -85,7 +85,7 @@ public class SyncHttpRequestSendInterceptorTest {
|
|||
Assert.assertEquals(1, SegmentHelper.getSpans(traceSegment).size());
|
||||
AbstractTracingSpan finishedSpan = SegmentHelper.getSpans(traceSegment).get(0);
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
assertThat(tags.size(), is(2));
|
||||
assertThat(tags.get(0).getValue(), is("GET"));
|
||||
assertThat(tags.get(1).getValue(), is(uri.toString()));
|
||||
|
|
@ -105,7 +105,7 @@ public class SyncHttpRequestSendInterceptorTest {
|
|||
Assert.assertEquals(1, SegmentHelper.getSpans(traceSegment).size());
|
||||
AbstractTracingSpan finishedSpan = SegmentHelper.getSpans(traceSegment).get(0);
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(finishedSpan);
|
||||
assertThat(tags.size(), is(2));
|
||||
assertThat(tags.get(0).getValue(), is("GET"));
|
||||
assertThat(tags.get(1).getValue(), is(uri.toString()));
|
||||
|
|
|
|||
|
|
@ -23,14 +23,20 @@ import com.mongodb.DBCollection;
|
|||
import com.mongodb.DBObject;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.hamcrest.MatcherAssert;
|
||||
import org.junit.Before;
|
||||
|
|
@ -40,12 +46,6 @@ import org.junit.runner.RunWith;
|
|||
import org.mockito.Mock;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
|
@ -110,7 +110,7 @@ public class MongoDBCollectionMethodInterceptorTest {
|
|||
private void assertMongoSpan(AbstractTracingSpan span) {
|
||||
assertThat(span.getOperationName(), is("MongoDB/insert"));
|
||||
assertThat(SpanHelper.getComponentId(span), is(42));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("MongoDB"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.DB));
|
||||
|
|
|
|||
|
|
@ -24,15 +24,20 @@ import com.mongodb.MongoNamespace;
|
|||
import com.mongodb.operation.FindOperation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.bson.BsonDocument;
|
||||
import org.bson.BsonString;
|
||||
import org.bson.codecs.Decoder;
|
||||
|
|
@ -46,11 +51,6 @@ import org.mockito.Mock;
|
|||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
|
@ -124,7 +124,7 @@ public class MongoDBMethodInterceptorTest {
|
|||
private void assertRedisSpan(AbstractTracingSpan span) {
|
||||
assertThat(span.getOperationName(), is("MongoDB/FindOperation"));
|
||||
assertThat(SpanHelper.getComponentId(span), is(42));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(1).getValue(), is("FindOperation { \"name\" : \"by\" }"));
|
||||
assertThat(tags.get(0).getValue(), is("MongoDB"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
|
|||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
|
|
@ -125,7 +125,7 @@ public class ProducerOperationHandlerInterceptorTest {
|
|||
private void assertCombSpan(AbstractTracingSpan span) {
|
||||
assertThat(span.getOperationName(), is("productorTest"));
|
||||
assertThat(SpanHelper.getComponentId(span), is(28));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("/bmi"));
|
||||
assertThat(span.isEntry(), is(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
|
|||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
|
|
@ -120,7 +120,7 @@ public class TransportClientHandlerInterceptorTest {
|
|||
private void assertCombSpan(AbstractTracingSpan span) {
|
||||
assertThat(span.getOperationName(), is("consumerTest"));
|
||||
assertThat(SpanHelper.getComponentId(span), is(28));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("/bmi"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,20 +18,20 @@
|
|||
|
||||
package org.apache.skywalking.apm.plugin.servicecomb.v1;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.servicecomb.core.Endpoint;
|
||||
import org.apache.servicecomb.core.Invocation;
|
||||
import org.apache.servicecomb.core.definition.OperationMeta;
|
||||
import org.apache.servicecomb.core.definition.SchemaMeta;
|
||||
import org.apache.servicecomb.swagger.invocation.InvocationType;
|
||||
import org.apache.servicecomb.swagger.invocation.SwaggerInvocation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
|
|
@ -125,7 +125,7 @@ public class ProducerOperationHandlerInterceptorTest {
|
|||
private void assertCombSpan(AbstractTracingSpan span) {
|
||||
assertThat(span.getOperationName(), is("productorTest"));
|
||||
assertThat(SpanHelper.getComponentId(span), is(28));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("/bmi"));
|
||||
assertThat(span.isEntry(), is(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
package org.apache.skywalking.apm.plugin.servicecomb.v1;
|
||||
|
||||
import java.util.List;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.servicecomb.core.Endpoint;
|
||||
import org.apache.servicecomb.core.Invocation;
|
||||
import org.apache.servicecomb.core.definition.OperationMeta;
|
||||
|
|
@ -25,13 +27,11 @@ import org.apache.servicecomb.core.definition.SchemaMeta;
|
|||
import org.apache.servicecomb.core.provider.consumer.ReferenceConfig;
|
||||
import org.apache.servicecomb.swagger.invocation.InvocationType;
|
||||
import org.apache.servicecomb.swagger.invocation.SwaggerInvocation;
|
||||
import java.util.List;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
|
|
@ -120,7 +120,7 @@ public class TransportClientHandlerInterceptorTest {
|
|||
private void assertCombSpan(AbstractTracingSpan span) {
|
||||
assertThat(span.getOperationName(), is("consumerTest"));
|
||||
assertThat(SpanHelper.getComponentId(span), is(28));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("/bmi"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,13 @@ import com.alipay.sofa.rpc.context.RpcInternalContext;
|
|||
import com.alipay.sofa.rpc.core.request.SofaRequest;
|
||||
import com.alipay.sofa.rpc.core.response.SofaResponse;
|
||||
import com.alipay.sofa.rpc.filter.ConsumerInvoker;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.*;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
|
|
@ -45,10 +49,10 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
|
|||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.powermock.api.mockito.PowerMockito.when;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
|
|
@ -73,14 +77,14 @@ public class SofaRpcConsumerInterceptorTest {
|
|||
@Mock
|
||||
private ConsumerInvoker invoker;
|
||||
|
||||
private SofaRequest sofaRequest = PowerMockito.mock(SofaRequest.class);
|
||||
private SofaRequest sofaRequest = PowerMockito.mock(SofaRequest.class);
|
||||
@Mock
|
||||
private MethodInterceptResult methodInterceptResult;
|
||||
|
||||
private SofaResponse sofaResponse = PowerMockito.mock(SofaResponse.class);
|
||||
|
||||
private Object[] allArguments;
|
||||
private Class[] argumentTypes;
|
||||
private Class[] argumentTypes;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
|
@ -139,7 +143,7 @@ public class SofaRpcConsumerInterceptorTest {
|
|||
}
|
||||
|
||||
private void assertConsumerTraceSegmentInErrorCase(
|
||||
TraceSegment traceSegment) {
|
||||
TraceSegment traceSegment) {
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
|
||||
assertThat(spans.size(), is(1));
|
||||
assertConsumerSpan(spans.get(0));
|
||||
|
|
@ -161,7 +165,7 @@ public class SofaRpcConsumerInterceptorTest {
|
|||
}
|
||||
|
||||
private void assertCommonsAttribute(AbstractTracingSpan span) {
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.size(), is(1));
|
||||
assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.RPC_FRAMEWORK));
|
||||
assertThat(SpanHelper.getComponentId(span), is(43));
|
||||
|
|
|
|||
|
|
@ -23,13 +23,14 @@ import com.alipay.sofa.rpc.context.RpcInternalContext;
|
|||
import com.alipay.sofa.rpc.core.request.SofaRequest;
|
||||
import com.alipay.sofa.rpc.core.response.SofaResponse;
|
||||
import com.alipay.sofa.rpc.filter.ProviderInvoker;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.SW3CarrierItem;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegmentRef;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
|
|
@ -51,8 +52,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
|
|||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
|
@ -148,7 +147,7 @@ public class SofaRpcProviderInterceptorTest {
|
|||
}
|
||||
|
||||
private void assertCommonsAttribute(AbstractTracingSpan span) {
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.size(), is(0));
|
||||
assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.RPC_FRAMEWORK));
|
||||
assertThat(SpanHelper.getComponentId(span), is(43));
|
||||
|
|
|
|||
|
|
@ -23,14 +23,17 @@ import java.lang.reflect.Method;
|
|||
import java.util.List;
|
||||
import net.spy.memcached.MemcachedClient;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.hamcrest.MatcherAssert;
|
||||
import org.junit.Assert;
|
||||
|
|
@ -41,9 +44,6 @@ import org.junit.runner.RunWith;
|
|||
import org.mockito.Mock;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
|
@ -113,7 +113,7 @@ public class MemcachedMethodInterceptorTest {
|
|||
assertThat(span.getOperationName(), is("SpyMemcached/set"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
assertThat(SpanHelper.getComponentId(span), is(35));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("Spymemcached"));
|
||||
assertThat(tags.get(1).getValue(), is("set OperationKey"));
|
||||
MatcherAssert.assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.CACHE));
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@
|
|||
|
||||
package org.apache.skywalking.apm.plugin.undertow.v2x;
|
||||
|
||||
import io.undertow.server.HttpHandler;
|
||||
import io.undertow.server.HttpServerExchange;
|
||||
import io.undertow.server.ServerConnection;
|
||||
import io.undertow.util.HeaderMap;
|
||||
import io.undertow.util.HttpString;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.conf.Config;
|
||||
import org.apache.skywalking.apm.agent.core.context.SW3CarrierItem;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
|
|
@ -25,7 +32,7 @@ import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
|||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegmentRef;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
|
|
@ -47,15 +54,6 @@ import org.mockito.Mock;
|
|||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.List;
|
||||
|
||||
import io.undertow.server.HttpHandler;
|
||||
import io.undertow.server.HttpServerExchange;
|
||||
import io.undertow.server.ServerConnection;
|
||||
import io.undertow.util.HeaderMap;
|
||||
import io.undertow.util.HttpString;
|
||||
|
||||
import static org.apache.skywalking.apm.agent.test.tools.SpanAssert.assertComponent;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
|
@ -147,7 +145,7 @@ public class ExecuteRootHandlerInterceptorTest {
|
|||
|
||||
assertThat(spans.size(), is(1));
|
||||
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(spans.get(0));
|
||||
List<TagValuePair> tags = SpanHelper.getTags(spans.get(0));
|
||||
assertThat(tags.size(), is(3));
|
||||
assertThat(tags.get(2).getValue(), is("500"));
|
||||
|
||||
|
|
|
|||
|
|
@ -19,19 +19,15 @@
|
|||
|
||||
package org.apache.skywalking.apm.plugin.xmemcached.v2;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import net.rubyeye.xmemcached.XMemcachedClient;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
|
|
@ -49,7 +45,9 @@ import org.mockito.Mock;
|
|||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import net.rubyeye.xmemcached.XMemcachedClient;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
|
|
@ -116,7 +114,7 @@ public class XMemcachedMethodInterceptorTest {
|
|||
assertThat(span.getOperationName(), is("XMemcached/set"));
|
||||
assertThat(span.isExit(), is(true));
|
||||
assertThat(SpanHelper.getComponentId(span), is(36));
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(span);
|
||||
List<TagValuePair> tags = SpanHelper.getTags(span);
|
||||
assertThat(tags.get(0).getValue(), is("Xmemcached"));
|
||||
assertThat(tags.get(1).getValue(), is("set OperationKey"));
|
||||
assertThat(SpanHelper.getLayer(span), CoreMatchers.is(SpanLayer.CACHE));
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ package org.apache.skywalking.apm.agent.test.helper;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.LogDataEntity;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
|
||||
public class SpanHelper {
|
||||
public static int getParentSpanId(AbstractSpan tracingSpan) {
|
||||
|
|
@ -61,15 +61,15 @@ public class SpanHelper {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public static List<KeyValuePair> getTags(AbstractSpan tracingSpan) {
|
||||
public static List<TagValuePair> getTags(AbstractSpan tracingSpan) {
|
||||
try {
|
||||
List<KeyValuePair> tags = FieldGetter.get2LevelParentFieldValue(tracingSpan, "tags");
|
||||
List<TagValuePair> tags = FieldGetter.get2LevelParentFieldValue(tracingSpan, "tags");
|
||||
if (tags != null) {
|
||||
return tags;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
List<KeyValuePair> tags = FieldGetter.getParentFieldValue(tracingSpan, "tags");
|
||||
List<TagValuePair> tags = FieldGetter.getParentFieldValue(tracingSpan, "tags");
|
||||
if (tags != null) {
|
||||
return tags;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,17 @@ package org.apache.skywalking.apm.toolkit.activation.trace;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStorage;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SpanAssert;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
import org.apache.skywalking.apm.toolkit.trace.Trace;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
|
@ -31,15 +40,6 @@ import org.junit.runner.RunWith;
|
|||
import org.mockito.Mock;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment;
|
||||
import org.apache.skywalking.apm.agent.core.context.util.KeyValuePair;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SegmentHelper;
|
||||
import org.apache.skywalking.apm.agent.test.helper.SpanHelper;
|
||||
import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
|
||||
import org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint;
|
||||
import org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
|
@ -87,8 +87,8 @@ public class TraceAnnotationTest {
|
|||
assertThat(tracingSpan.getOperationName(), is("testMethod"));
|
||||
SpanAssert.assertLogSize(tracingSpan, 0);
|
||||
SpanAssert.assertTagSize(tracingSpan, 1);
|
||||
List<KeyValuePair> tags = SpanHelper.getTags(tracingSpan);
|
||||
assertThat(tags.get(0).getKey(), is("testTagKey"));
|
||||
List<TagValuePair> tags = SpanHelper.getTags(tracingSpan);
|
||||
assertThat(tags.get(0).getKey().key(), is("testTagKey"));
|
||||
assertThat(tags.get(0).getValue(), is("testTagValue"));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue