Commit 6f06b45c authored by 吴晟's avatar 吴晟 Committed by GitHub
Browse files

Merge pull request #362 from ascrutae/zhangxin/feature/support-trace-annotation

support trace annotation
parents 998c04e0 b820a396
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>apm-application-toolkit</artifactId>
        <groupId>org.skywalking</groupId>
        <version>3.2-2017</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>apm-toolkit-trace</artifactId>
    <packaging>jar</packaging>

    <url>http://maven.apache.org</url>

    <build>
        <plugins>
            <plugin>
                <!-- 源码插件 -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <!-- 发布时自动将源码同时发布的配置 -->
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <version>2.4</version>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <repository>
            <id>bintray-wu-sheng-sky-walking-repository</id>
            <name>wu-sheng-sky-walking-repository</name>
            <url>
                https://api.bintray.com/maven/wu-sheng/skywalking/org.skywalking.apm-toolkit-trace/;publish=1
            </url>
        </repository>
    </distributionManagement>
</project>
+16 −0
Original line number Diff line number Diff line
package org.skywalking.apm.toolkit.trace;

/**
 * provide custom api that set tag for current active span.
 *
 * @author zhangxin
 */
public class ActiveSpan {
    /**
     * @param key tag key
     * @param value tag value
     */
    public static void tag(String key, String value) {

    }
}
+22 −0
Original line number Diff line number Diff line
package org.skywalking.apm.toolkit.trace;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * The agent create local span if the method that annotation with {@link Trace}. The value of span operation name will
 * fetch by {@link #operationName()}.  if the value of {@link #operationName()} is blank string. the operation name will
 * be set the class name + method name.
 *
 * @author zhangxin
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Trace {
    /**
     * @return operation name, the default value is blank string.
     */
    String operationName() default "";
}
+1 −0
Original line number Diff line number Diff line
@@ -19,5 +19,6 @@
        <module>apm-toolkit-logback-1.x</module>
        <module>apm-toolkit-trace-context</module>
        <module>apm-toolkit-opentracing</module>
        <module>apm-toolkit-trace</module>
    </modules>
</project>
+2 −1
Original line number Diff line number Diff line
package org.skywalking.apm.agent.core.plugin.match;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.bytebuddy.description.annotation.AnnotationDescription;
@@ -47,7 +48,7 @@ public class MethodAnnotationMatch implements IndirectMatch {
    @Override
    public boolean isMatch(TypeDescription typeDescription) {
        for (MethodDescription.InDefinedShape methodDescription : typeDescription.getDeclaredMethods()) {
            List<String> annotationList = Arrays.asList(annotations);
            List<String> annotationList = new ArrayList<String>(Arrays.asList(annotations));

            AnnotationList declaredAnnotations = methodDescription.getDeclaredAnnotations();
            for (AnnotationDescription annotation : declaredAnnotations) {
Loading