Add Fastjson plugin (#35)
This commit is contained in:
parent
8b0f0e1bb7
commit
c5657e83b3
|
|
@ -84,6 +84,7 @@ jobs:
|
|||
- elasticjob-3.x-scenario
|
||||
- springmvc-reactive-scenario
|
||||
- springmvc-reactive-devtools-scenario
|
||||
- fastjson-scenario
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ Release Notes.
|
|||
* Add benchmark result for `exception-ignore` plugin and polish plugin guide.
|
||||
* Provide Alibaba Druid database connection pool plugin.
|
||||
* Provide HikariCP database connection pool plugin.
|
||||
* Provide Alibaba Fastjson parser/generator plugin.
|
||||
* Fix a tracing context leak of SpringMVC plugin, when an internal exception throws due to response can't be found.
|
||||
* Make GRPC log reporter sharing GRPC channel with other reporters of agent. Remove config items of `agent.conf`, `plugin.toolkit.log.grpc.reporter.server_host`, `plugin.toolkit.log.grpc.reporter.server_port`, and `plugin.toolkit.log.grpc.reporter.upstream_timeout`.
|
||||
rename `plugin.toolkit.log.grpc.reporter.max_message_size` to `log.max_message_size`.
|
||||
|
|
|
|||
|
|
@ -211,4 +211,6 @@ public class ComponentsDefine {
|
|||
|
||||
public static final OfficialComponent HIKARI_CP = new OfficialComponent(116, "HikariCP");
|
||||
|
||||
public static final OfficialComponent FASTJSON = new OfficialComponent(117, "Fastjson");
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
~
|
||||
-->
|
||||
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>optional-plugins</artifactId>
|
||||
<version>8.8.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>apm-fastjson-1.x-plugin</artifactId>
|
||||
<name>fastjson-1.2.x-plugin</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<fastjson.version>1.2.62</fastjson.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -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.plugin.fastjson;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ParseArrayInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
public static final String OPERATION_NAME_FROM_JSON = "Fastjson/";
|
||||
public static final String SPAN_TAG_KEY_LENGTH = "length";
|
||||
|
||||
@Override
|
||||
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
|
||||
|
||||
AbstractSpan span = ContextManager.createLocalSpan(OPERATION_NAME_FROM_JSON + method.getName());
|
||||
span.setComponent(ComponentsDefine.FASTJSON);
|
||||
|
||||
if (allArguments[0] instanceof String) {
|
||||
span.tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((String) allArguments[0]).length()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Object ret) {
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Throwable t) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ParseInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
public static final String OPERATION_NAME_FROM_JSON = "Fastjson/";
|
||||
public static final String SPAN_TAG_KEY_LENGTH = "length";
|
||||
|
||||
@Override
|
||||
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
|
||||
|
||||
AbstractSpan span = ContextManager.createLocalSpan(OPERATION_NAME_FROM_JSON + method.getName());
|
||||
span.setComponent(ComponentsDefine.FASTJSON);
|
||||
|
||||
if (allArguments[0] instanceof String) {
|
||||
span.tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((String) allArguments[0]).length()));
|
||||
} else if (allArguments[0] instanceof byte[]) {
|
||||
span.tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((byte[]) allArguments[0]).length));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Object ret) {
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Throwable t) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ParseObjectInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
public static final String OPERATION_NAME_FROM_JSON = "Fastjson/";
|
||||
public static final String SPAN_TAG_KEY_LENGTH = "length";
|
||||
|
||||
@Override
|
||||
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
|
||||
|
||||
AbstractSpan span = ContextManager.createLocalSpan(OPERATION_NAME_FROM_JSON + method.getName());
|
||||
span.setComponent(ComponentsDefine.FASTJSON);
|
||||
|
||||
if (allArguments[0] instanceof String) {
|
||||
span.tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((String) allArguments[0]).length()));
|
||||
} else if (allArguments[0] instanceof byte[]) {
|
||||
span.tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((byte[]) allArguments[0]).length));
|
||||
} else if (allArguments[0] instanceof char[]) {
|
||||
span.tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((char[]) allArguments[0]).length));
|
||||
} else if (allArguments[0] instanceof InputStream) {
|
||||
span.tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(inputStreamAvailable(allArguments[0])));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Object ret) {
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Throwable t) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
|
||||
private int inputStreamAvailable(Object in) {
|
||||
try {
|
||||
return ((InputStream) in).available();
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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.plugin.fastjson;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ToJavaObjectInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
public static final String OPERATION_NAME_TO_JSON = "Fastjson/";
|
||||
public static final String SPAN_TAG_KEY_OBJECT = "object";
|
||||
|
||||
@Override
|
||||
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
|
||||
|
||||
AbstractSpan span = ContextManager.createLocalSpan(OPERATION_NAME_TO_JSON + method.getName());
|
||||
span.setComponent(ComponentsDefine.FASTJSON);
|
||||
|
||||
if (allArguments.length > 1 && allArguments[1] instanceof Class) {
|
||||
span.tag(Tags.ofKey(SPAN_TAG_KEY_OBJECT), ((Class) allArguments[1]).getTypeName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Object ret) {
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Throwable t) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ToJsonBytesInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
public static final String OPERATION_NAME_TO_JSON = "Fastjson/";
|
||||
public static final String SPAN_TAG_KEY_LENGTH = "length";
|
||||
|
||||
@Override
|
||||
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
|
||||
|
||||
AbstractSpan span = ContextManager.createLocalSpan(OPERATION_NAME_TO_JSON + method.getName());
|
||||
span.setComponent(ComponentsDefine.FASTJSON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Object ret) {
|
||||
|
||||
if (!ContextManager.isActive()) {
|
||||
return ret;
|
||||
}
|
||||
if (ret instanceof byte[]) {
|
||||
ContextManager.activeSpan().tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((byte[]) ret).length));
|
||||
}
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Throwable t) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ToJsonInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
public static final String OPERATION_NAME_TO_JSON = "Fastjson/";
|
||||
public static final String SPAN_TAG_KEY_OBJECT = "object";
|
||||
|
||||
@Override
|
||||
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
|
||||
|
||||
AbstractSpan span = ContextManager.createLocalSpan(OPERATION_NAME_TO_JSON + method.getName());
|
||||
span.setComponent(ComponentsDefine.FASTJSON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Object ret) {
|
||||
|
||||
if (!ContextManager.isActive()) {
|
||||
return ret;
|
||||
}
|
||||
if (ret != null) {
|
||||
ContextManager.activeSpan().tag(Tags.ofKey(SPAN_TAG_KEY_OBJECT), String.valueOf(ret.getClass().getTypeName()));
|
||||
}
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Throwable t) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class ToJsonStringInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
public static final String OPERATION_NAME_TO_JSON = "Fastjson/";
|
||||
public static final String SPAN_TAG_KEY_LENGTH = "length";
|
||||
|
||||
@Override
|
||||
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
|
||||
|
||||
AbstractSpan span = ContextManager.createLocalSpan(OPERATION_NAME_TO_JSON + method.getName());
|
||||
span.setComponent(ComponentsDefine.FASTJSON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Object ret) {
|
||||
|
||||
if (!ContextManager.isActive()) {
|
||||
return ret;
|
||||
}
|
||||
if (ret instanceof String) {
|
||||
ContextManager.activeSpan().tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((String) ret).length()));
|
||||
}
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Throwable t) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import org.apache.skywalking.apm.agent.core.context.ContextManager;
|
||||
import org.apache.skywalking.apm.agent.core.context.tag.Tags;
|
||||
import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.StaticMethodsAroundInterceptor;
|
||||
import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class WriteJsonStringInterceptor implements StaticMethodsAroundInterceptor {
|
||||
|
||||
public static final String OPERATION_NAME_TO_JSON = "Fastjson/";
|
||||
public static final String SPAN_TAG_KEY_LENGTH = "length";
|
||||
|
||||
@Override
|
||||
public void beforeMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, MethodInterceptResult result) {
|
||||
|
||||
AbstractSpan span = ContextManager.createLocalSpan(OPERATION_NAME_TO_JSON + method.getName());
|
||||
span.setComponent(ComponentsDefine.FASTJSON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Object ret) {
|
||||
|
||||
if (!ContextManager.isActive()) {
|
||||
return ret;
|
||||
}
|
||||
if (ret instanceof Integer) {
|
||||
ContextManager.activeSpan().tag(Tags.ofKey(SPAN_TAG_KEY_LENGTH), Integer.toString(((Integer) ret).intValue()));
|
||||
}
|
||||
ContextManager.stopSpan();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes, Throwable t) {
|
||||
ContextManager.activeSpan().log(t);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* 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.plugin.fastjson.define;
|
||||
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassStaticMethodsEnhancePluginDefine;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
|
||||
import org.apache.skywalking.apm.agent.core.plugin.match.NameMatch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||
|
||||
/**
|
||||
* Fastjson A fast JSON parser/generator for Java from Alibaba inc.
|
||||
* <p>
|
||||
* JSON provides a "one stop" solution for json parser/generator solution
|
||||
* basic requirements.
|
||||
* <p>
|
||||
* json2x: JSON#parse()/JSON#parseArray()/JSON#parseObject()/JSON#toJavaObject()
|
||||
* x2json: JSON#toJSON()/JSON#toJSONBytes()/JSON#toJSONString()/JSON#writeJSONString()
|
||||
*/
|
||||
public class FastjsonInstrumentation extends ClassStaticMethodsEnhancePluginDefine {
|
||||
|
||||
public static final String ENHANCE_CLASS = "com.alibaba.fastjson.JSON";
|
||||
|
||||
private static final Map<String, String> ENHANCE_METHODS = new HashMap<String, String>() {
|
||||
{
|
||||
put("parseArray", "org.apache.skywalking.apm.plugin.fastjson.ParseArrayInterceptor");
|
||||
put("parse", "org.apache.skywalking.apm.plugin.fastjson.ParseInterceptor");
|
||||
put("parseObject", "org.apache.skywalking.apm.plugin.fastjson.ParseObjectInterceptor");
|
||||
put("toJavaObject", "org.apache.skywalking.apm.plugin.fastjson.ToJavaObjectInterceptor");
|
||||
put("toJSONBytes", "org.apache.skywalking.apm.plugin.fastjson.ToJsonBytesInterceptor");
|
||||
put("toJSON", "org.apache.skywalking.apm.plugin.fastjson.ToJsonInterceptor");
|
||||
put("toJSONString", "org.apache.skywalking.apm.plugin.fastjson.ToJsonStringInterceptor");
|
||||
put("writeJSONString", "org.apache.skywalking.apm.plugin.fastjson.WriteJsonStringInterceptor");
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
|
||||
|
||||
final List<StaticMethodsInterceptPoint> points = new ArrayList<StaticMethodsInterceptPoint>(ENHANCE_METHODS.size());
|
||||
|
||||
for (Map.Entry<String, String> entry : ENHANCE_METHODS.entrySet()) {
|
||||
final StaticMethodsInterceptPoint point = new StaticMethodsInterceptPoint() {
|
||||
@Override
|
||||
public ElementMatcher<MethodDescription> getMethodsMatcher() {
|
||||
return named(entry.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodsInterceptor() {
|
||||
return entry.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverrideArgs() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
points.add(point);
|
||||
}
|
||||
|
||||
return points.toArray(new StaticMethodsInterceptPoint[points.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassMatch enhanceClass() {
|
||||
return NameMatch.byName(ENHANCE_CLASS);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# 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.
|
||||
|
||||
fastjson-1.2.x=org.apache.skywalking.apm.plugin.fastjson.define.FastjsonInstrumentation
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.test.helper.SegmentHelper;
|
||||
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.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
public class ParseArrayInterceptorTest {
|
||||
|
||||
private ParseArrayInterceptor parseArrayInterceptor;
|
||||
|
||||
@SegmentStoragePoint
|
||||
private SegmentStorage segmentStorage;
|
||||
|
||||
@Rule
|
||||
public AgentServiceRule serviceRule = new AgentServiceRule();
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
private Class[] argumentType;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
parseArrayInterceptor = new ParseArrayInterceptor();
|
||||
arguments = new Object[]{"[{\"key\": 123}]"};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Throwable {
|
||||
|
||||
Method method = JSON.class.getMethod("parseArray", String.class);
|
||||
parseArrayInterceptor.beforeMethod(null, method, arguments, null, null);
|
||||
parseArrayInterceptor.afterMethod(null, method, arguments, null, null);
|
||||
|
||||
List<TraceSegment> traceSegmentList = segmentStorage.getTraceSegments();
|
||||
assertThat(traceSegmentList.size(), is(1));
|
||||
|
||||
TraceSegment segment = traceSegmentList.get(0);
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
|
||||
assertThat(spans.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.test.helper.SegmentHelper;
|
||||
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.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
public class ParseInterceptorTest {
|
||||
|
||||
private ParseInterceptor parseInterceptor;
|
||||
|
||||
@SegmentStoragePoint
|
||||
private SegmentStorage segmentStorage;
|
||||
|
||||
@Rule
|
||||
public AgentServiceRule serviceRule = new AgentServiceRule();
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
private Class[] argumentType;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
parseInterceptor = new ParseInterceptor();
|
||||
arguments = new Object[]{"{\"key\": 123}"};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Throwable {
|
||||
|
||||
Method method = JSON.class.getMethod("parse", String.class);
|
||||
parseInterceptor.beforeMethod(null, method, arguments, null, null);
|
||||
parseInterceptor.afterMethod(null, method, arguments, null, null);
|
||||
|
||||
List<TraceSegment> traceSegmentList = segmentStorage.getTraceSegments();
|
||||
assertThat(traceSegmentList.size(), is(1));
|
||||
|
||||
TraceSegment segment = traceSegmentList.get(0);
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
|
||||
assertThat(spans.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.test.helper.SegmentHelper;
|
||||
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.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
public class ParseObjectInterceptorTest {
|
||||
|
||||
private ParseObjectInterceptor parseObjectInterceptor;
|
||||
|
||||
@SegmentStoragePoint
|
||||
private SegmentStorage segmentStorage;
|
||||
|
||||
@Rule
|
||||
public AgentServiceRule serviceRule = new AgentServiceRule();
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
private Class[] argumentType;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
parseObjectInterceptor = new ParseObjectInterceptor();
|
||||
arguments = new Object[]{"{\"key\": 123}"};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Throwable {
|
||||
|
||||
Method method = JSON.class.getMethod("parseObject", String.class);
|
||||
parseObjectInterceptor.beforeMethod(null, method, arguments, null, null);
|
||||
parseObjectInterceptor.afterMethod(null, method, arguments, null, null);
|
||||
|
||||
List<TraceSegment> traceSegmentList = segmentStorage.getTraceSegments();
|
||||
assertThat(traceSegmentList.size(), is(1));
|
||||
|
||||
TraceSegment segment = traceSegmentList.get(0);
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
|
||||
assertThat(spans.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.Data;
|
||||
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.test.helper.SegmentHelper;
|
||||
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.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
public class ToJavaObjectInterceptorTest {
|
||||
|
||||
private ToJavaObjectInterceptor toJavaObjectInterceptor;
|
||||
|
||||
@SegmentStoragePoint
|
||||
private SegmentStorage segmentStorage;
|
||||
|
||||
@Rule
|
||||
public AgentServiceRule serviceRule = new AgentServiceRule();
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
private Class[] argumentType;
|
||||
|
||||
@Data
|
||||
private class TestBean {
|
||||
private int key;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
toJavaObjectInterceptor = new ToJavaObjectInterceptor();
|
||||
arguments = new Object[]{JSON.parseObject("{\"key\": 123}"), TestBean.class};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Throwable {
|
||||
|
||||
Method method = JSON.class.getMethod("toJavaObject", JSON.class, Class.class);
|
||||
toJavaObjectInterceptor.beforeMethod(null, method, arguments, null, null);
|
||||
toJavaObjectInterceptor.afterMethod(null, method, arguments, null, null);
|
||||
|
||||
List<TraceSegment> traceSegmentList = segmentStorage.getTraceSegments();
|
||||
assertThat(traceSegmentList.size(), is(1));
|
||||
|
||||
TraceSegment segment = traceSegmentList.get(0);
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
|
||||
assertThat(spans.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import lombok.Data;
|
||||
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.test.helper.SegmentHelper;
|
||||
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.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
public class ToJsonBytesInterceptorTest {
|
||||
|
||||
private ToJsonBytesInterceptor toJsonBytesInterceptor;
|
||||
|
||||
@SegmentStoragePoint
|
||||
private SegmentStorage segmentStorage;
|
||||
|
||||
@Rule
|
||||
public AgentServiceRule serviceRule = new AgentServiceRule();
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
private Object result;
|
||||
|
||||
private Class[] argumentType;
|
||||
|
||||
@Data
|
||||
private class TestBean {
|
||||
private int key;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
toJsonBytesInterceptor = new ToJsonBytesInterceptor();
|
||||
arguments = new Object[]{new TestBean(), new SerializerFeature[0]};
|
||||
result = new byte[0];
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Throwable {
|
||||
|
||||
Method method = JSON.class.getMethod("toJSONBytes", Object.class, SerializerFeature[].class);
|
||||
toJsonBytesInterceptor.beforeMethod(null, method, arguments, null, null);
|
||||
toJsonBytesInterceptor.afterMethod(null, method, arguments, null, result);
|
||||
|
||||
List<TraceSegment> traceSegmentList = segmentStorage.getTraceSegments();
|
||||
assertThat(traceSegmentList.size(), is(1));
|
||||
|
||||
TraceSegment segment = traceSegmentList.get(0);
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
|
||||
assertThat(spans.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
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.test.helper.SegmentHelper;
|
||||
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.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
public class ToJsonInterceptorTest {
|
||||
|
||||
private ToJsonInterceptor toJsonInterceptor;
|
||||
|
||||
@SegmentStoragePoint
|
||||
private SegmentStorage segmentStorage;
|
||||
|
||||
@Rule
|
||||
public AgentServiceRule serviceRule = new AgentServiceRule();
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
private Object result;
|
||||
|
||||
private Class[] argumentType;
|
||||
|
||||
@Data
|
||||
private class TestBean {
|
||||
private int key;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
toJsonInterceptor = new ToJsonInterceptor();
|
||||
arguments = new Object[]{new TestBean()};
|
||||
result = new JSONObject();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Throwable {
|
||||
|
||||
Method method = JSON.class.getMethod("toJSON", Object.class);
|
||||
toJsonInterceptor.beforeMethod(null, method, arguments, null, null);
|
||||
toJsonInterceptor.afterMethod(null, method, arguments, null, result);
|
||||
|
||||
List<TraceSegment> traceSegmentList = segmentStorage.getTraceSegments();
|
||||
assertThat(traceSegmentList.size(), is(1));
|
||||
|
||||
TraceSegment segment = traceSegmentList.get(0);
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
|
||||
assertThat(spans.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
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.test.helper.SegmentHelper;
|
||||
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.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
public class ToJsonStringInterceptorTest {
|
||||
|
||||
private ToJsonStringInterceptor toJsonStringInterceptor;
|
||||
|
||||
@SegmentStoragePoint
|
||||
private SegmentStorage segmentStorage;
|
||||
|
||||
@Rule
|
||||
public AgentServiceRule serviceRule = new AgentServiceRule();
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
private Object result;
|
||||
|
||||
private Class[] argumentType;
|
||||
|
||||
@Data
|
||||
private class TestBean {
|
||||
private int key;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
toJsonStringInterceptor = new ToJsonStringInterceptor();
|
||||
arguments = new Object[]{new TestBean()};
|
||||
result = new JSONObject().toJSONString();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Throwable {
|
||||
|
||||
Method method = JSON.class.getMethod("toJSONString", Object.class);
|
||||
toJsonStringInterceptor.beforeMethod(null, method, arguments, null, null);
|
||||
toJsonStringInterceptor.afterMethod(null, method, arguments, null, result);
|
||||
|
||||
List<TraceSegment> traceSegmentList = segmentStorage.getTraceSegments();
|
||||
assertThat(traceSegmentList.size(), is(1));
|
||||
|
||||
TraceSegment segment = traceSegmentList.get(0);
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
|
||||
assertThat(spans.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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.plugin.fastjson;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import lombok.Data;
|
||||
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.test.helper.SegmentHelper;
|
||||
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.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PowerMockRunnerDelegate(TracingSegmentRunner.class)
|
||||
public class WriteJsonStringInterceptorTest {
|
||||
|
||||
private WriteJsonStringInterceptor writeJsonStringInterceptor;
|
||||
|
||||
@SegmentStoragePoint
|
||||
private SegmentStorage segmentStorage;
|
||||
|
||||
@Rule
|
||||
public AgentServiceRule serviceRule = new AgentServiceRule();
|
||||
|
||||
private Object[] arguments;
|
||||
|
||||
private int result;
|
||||
|
||||
private Class[] argumentType;
|
||||
|
||||
@Data
|
||||
private class TestBean {
|
||||
private int key;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
writeJsonStringInterceptor = new WriteJsonStringInterceptor();
|
||||
arguments = new Object[]{null, new TestBean(), new SerializerFeature[0]};
|
||||
result = 1;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() throws Throwable {
|
||||
|
||||
Method method = JSON.class.getMethod("writeJSONString", OutputStream.class, Object.class, SerializerFeature[].class);
|
||||
writeJsonStringInterceptor.beforeMethod(null, method, arguments, null, null);
|
||||
writeJsonStringInterceptor.afterMethod(null, method, arguments, null, result);
|
||||
|
||||
List<TraceSegment> traceSegmentList = segmentStorage.getTraceSegments();
|
||||
assertThat(traceSegmentList.size(), is(1));
|
||||
|
||||
TraceSegment segment = traceSegmentList.get(0);
|
||||
List<AbstractTracingSpan> spans = SegmentHelper.getSpans(segment);
|
||||
assertThat(spans.size(), is(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -53,6 +53,7 @@
|
|||
<module>sentinel-1.x-plugin</module>
|
||||
<module>ehcache-2.x-plugin</module>
|
||||
<module>guava-cache-plugin</module>
|
||||
<module>fastjson-1.2.x-plugin</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
- elasticsearch-5.x
|
||||
- elasticsearch-6.x
|
||||
- elasticsearch-7.x
|
||||
- fastjson-1.2.x
|
||||
- feign-default-http-9.x
|
||||
- feign-pathvar-9.x
|
||||
- finagle
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ Now, we have the following known optional plugins.
|
|||
* Plugin of sentinel-1.x in the optional plugin folder. The reason for being an optional plugin is, the sentinel plugin generates a large number of local spans, which have a potential performance impact.
|
||||
* Plugin of ehcache-2.x in the optional plugin folder. The reason for being an optional plugin is, this plugin enhanced cache framework, generates large number of local spans, which have a potential performance impact.
|
||||
* Plugin of guava-cache in the optional plugin folder. The reason for being an optional plugin is, this plugin enhanced cache framework, generates large number of local spans, which have a potential performance impact.
|
||||
* Plugin of fastjson serialization lib in optional plugin folder.
|
||||
|
||||
## Bootstrap class plugins
|
||||
All bootstrap plugins are optional, due to unexpected risk. Bootstrap plugins are provided in `bootstrap-plugins` folder.
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ metrics based on the tracing data.
|
|||
* [Canal: Alibaba mysql database binlog incremental subscription & consumer components](https://github.com/alibaba/canal) 1.0.25 -> 1.1.2
|
||||
* JSON
|
||||
* [GSON](https://github.com/google/gson) 2.8.x (Optional²)
|
||||
* [Fastjson](https://github.com/alibaba/fastjson) 1.2.x (Optional²)
|
||||
* Vert.x Ecosystem
|
||||
* Vert.x Eventbus 3.2+
|
||||
* Vert.x Web 3.x
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# 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.
|
||||
|
||||
home="$(cd "$(dirname $0)"; pwd)"
|
||||
|
||||
java -jar ${agent_opts} ${home}/../libs/fastjson-scenario.jar &
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
# 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.
|
||||
segmentItems:
|
||||
- serviceName: fastjson-scenario
|
||||
segmentSize: ge 2
|
||||
segments:
|
||||
- segmentId: nq 0
|
||||
spans:
|
||||
- operationName: Fastjson/parse
|
||||
parentSpanId: 0
|
||||
spanId: 1
|
||||
spanLayer: Unknown
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 117
|
||||
isError: false
|
||||
spanType: Local
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: length, value: '11'}
|
||||
- operationName: Fastjson/parseArray
|
||||
parentSpanId: 0
|
||||
spanId: 2
|
||||
spanLayer: Unknown
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 117
|
||||
isError: false
|
||||
spanType: Local
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: length, value: '25'}
|
||||
- operationName: Fastjson/parseObject
|
||||
parentSpanId: 0
|
||||
spanId: 3
|
||||
spanLayer: Unknown
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 117
|
||||
isError: false
|
||||
spanType: Local
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: length, value: '24'}
|
||||
- operationName: Fastjson/toJavaObject
|
||||
parentSpanId: 0
|
||||
spanId: 4
|
||||
spanLayer: Unknown
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 117
|
||||
isError: false
|
||||
spanType: Local
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: object, value: org.apache.skywalking.apm.testcase.fastjson.entity.CaseEntity}
|
||||
- operationName: Fastjson/toJSON
|
||||
parentSpanId: 0
|
||||
spanId: 5
|
||||
spanLayer: Unknown
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 117
|
||||
isError: false
|
||||
spanType: Local
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: object, value: com.alibaba.fastjson.JSONObject}
|
||||
- operationName: Fastjson/toJSONBytes
|
||||
parentSpanId: 0
|
||||
spanId: 6
|
||||
spanLayer: Unknown
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 117
|
||||
isError: false
|
||||
spanType: Local
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: length, value: '24'}
|
||||
- operationName: Fastjson/toJSONString
|
||||
parentSpanId: 0
|
||||
spanId: 7
|
||||
spanLayer: Unknown
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 117
|
||||
isError: false
|
||||
spanType: Local
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: length, value: '24'}
|
||||
- operationName: Fastjson/writeJSONString
|
||||
parentSpanId: 0
|
||||
spanId: 8
|
||||
spanLayer: Unknown
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 117
|
||||
isError: false
|
||||
spanType: Local
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: length, value: '24'}
|
||||
- operationName: /fastjson-scenario/case/fastjson-scenario
|
||||
parentSpanId: -1
|
||||
spanId: 0
|
||||
spanLayer: Http
|
||||
startTime: nq 0
|
||||
endTime: nq 0
|
||||
componentId: 1
|
||||
isError: false
|
||||
spanType: Entry
|
||||
peer: ''
|
||||
tags:
|
||||
- {key: url, value: 'http://localhost:8080/fastjson-scenario/case/fastjson-scenario'}
|
||||
- {key: http.method, value: GET}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# 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.
|
||||
|
||||
type: jvm
|
||||
entryService: http://localhost:8080/fastjson-scenario/case/fastjson-scenario
|
||||
healthCheck: http://localhost:8080/fastjson-scenario/case/healthCheck
|
||||
startScript: ./bin/startup.sh
|
||||
runningMode: with_optional
|
||||
withPlugins: apm-fastjson-1.x-plugin-*.jar
|
||||
environment:
|
||||
dependencies:
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
~
|
||||
-->
|
||||
<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">
|
||||
|
||||
<groupId>org.apache.skywalking.apm.testcase</groupId>
|
||||
<artifactId>fastjson-scenario</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring-boot-version>2.1.6.RELEASE</spring-boot-version>
|
||||
<test.framework.version>1.2.62</test.framework.version>
|
||||
<docker.image.version>${test.framework.version}</docker.image.version>
|
||||
<log4j.version>2.6.2</log4j.version>
|
||||
<spring.version>4.3.8.RELEASE</spring.version>
|
||||
</properties>
|
||||
|
||||
<name>skywalking-fastjson-scenario</name>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot-version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${test.framework.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>fastjson-scenario</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${compiler.version}</source>
|
||||
<target>${compiler.version}</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>assemble</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<outputDirectory>./target/</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
~
|
||||
-->
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>./bin</directory>
|
||||
<fileMode>0775</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<files>
|
||||
<file>
|
||||
<source>${project.build.directory}/fastjson-scenario.jar</source>
|
||||
<outputDirectory>./libs</outputDirectory>
|
||||
<fileMode>0775</fileMode>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.testcase.fastjson;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
SpringApplication.run(Application.class, args);
|
||||
} catch (Exception e) {
|
||||
// Never do this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.testcase.fastjson.controller;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.skywalking.apm.testcase.fastjson.service.CaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/case")
|
||||
public class CaseController {
|
||||
|
||||
@Autowired
|
||||
CaseService caseService;
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(CaseController.class);
|
||||
|
||||
private static final String SUCCESS = "Success";
|
||||
|
||||
@RequestMapping("/fastjson-scenario")
|
||||
@ResponseBody
|
||||
public String testcase() throws IOException {
|
||||
try {
|
||||
caseService.parseCase();
|
||||
caseService.parseArrayCase();
|
||||
caseService.parseObjectCase();
|
||||
caseService.toJavaObjectCase();
|
||||
caseService.toJsonCase();
|
||||
caseService.toJsonBytesCase();
|
||||
caseService.toJsonStringCase();
|
||||
caseService.writeJsonStringCase();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Failed to parse json.", e);
|
||||
throw e;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@RequestMapping("/healthCheck")
|
||||
@ResponseBody
|
||||
public String healthCheck() {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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.testcase.fastjson.entity;
|
||||
|
||||
public class CaseEntity {
|
||||
|
||||
private int key;
|
||||
private String msg;
|
||||
|
||||
public int getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(int key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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.testcase.fastjson.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||
import com.alibaba.fastjson.serializer.SerializeFilter;
|
||||
import com.alibaba.fastjson.util.IOUtils;
|
||||
import org.apache.skywalking.apm.testcase.fastjson.entity.CaseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
@Service
|
||||
public class CaseService {
|
||||
|
||||
public void parseCase() {
|
||||
String jsonStr = "{\"key\":123}";
|
||||
Object jsonObj = JSON.parse(jsonStr, ParserConfig.getGlobalInstance(), JSON.DEFAULT_GENERATE_FEATURE);
|
||||
assert jsonObj instanceof JSONObject;
|
||||
}
|
||||
|
||||
public void parseArrayCase() {
|
||||
String jsonStr = "[{\"key\":123},{\"key\":456}]";
|
||||
Object jsonObj = JSON.parseArray(jsonStr);
|
||||
assert jsonObj instanceof JSONArray;
|
||||
}
|
||||
|
||||
public void parseObjectCase() {
|
||||
String jsonStr = "{\"key\":123,\"msg\":\"test\"}";
|
||||
Object jsonObj = JSON.parseObject(jsonStr, CaseEntity.class, ParserConfig.global, null, JSON.DEFAULT_PARSER_FEATURE, new Feature[0]);
|
||||
assert jsonObj instanceof CaseEntity;
|
||||
}
|
||||
|
||||
public void toJavaObjectCase() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("key", 123);
|
||||
jsonObject.put("msg", "test");
|
||||
Object jsonObj = JSON.toJavaObject(jsonObject, CaseEntity.class);
|
||||
assert jsonObj instanceof CaseEntity;
|
||||
}
|
||||
|
||||
public void toJsonCase() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("key", 123);
|
||||
jsonObject.put("msg", "test");
|
||||
Object jsonObj = JSON.toJSON(jsonObject, SerializeConfig.globalInstance);
|
||||
assert jsonObj instanceof JSONObject;
|
||||
}
|
||||
|
||||
public void toJsonBytesCase() {
|
||||
CaseEntity caseEntity = new CaseEntity();
|
||||
caseEntity.setKey(123);
|
||||
caseEntity.setMsg("test");
|
||||
Object jsonObj = JSON.toJSONBytes(IOUtils.UTF8, caseEntity, SerializeConfig.globalInstance, new SerializeFilter[0], null, JSON.DEFAULT_GENERATE_FEATURE);
|
||||
assert jsonObj instanceof byte[];
|
||||
}
|
||||
|
||||
public void toJsonStringCase() {
|
||||
CaseEntity caseEntity = new CaseEntity();
|
||||
caseEntity.setKey(123);
|
||||
caseEntity.setMsg("test");
|
||||
Object jsonObj = JSON.toJSONString(caseEntity, SerializeConfig.globalInstance, new SerializeFilter[0], null, JSON.DEFAULT_GENERATE_FEATURE);
|
||||
assert jsonObj instanceof String;
|
||||
}
|
||||
|
||||
public void writeJsonStringCase() throws IOException {
|
||||
ByteArrayOutputStream outnew = new ByteArrayOutputStream();
|
||||
CaseEntity caseEntity = new CaseEntity();
|
||||
caseEntity.setKey(123);
|
||||
caseEntity.setMsg("test");
|
||||
Object jsonObj = JSON.writeJSONString(outnew, IOUtils.UTF8, caseEntity, SerializeConfig.globalInstance, new SerializeFilter[0], null, JSON.DEFAULT_GENERATE_FEATURE);
|
||||
assert jsonObj instanceof Integer;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
server:
|
||||
port: 8080
|
||||
servlet:
|
||||
context-path: /fastjson-scenario
|
||||
logging:
|
||||
config: classpath:log4j2.xml
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
~
|
||||
-->
|
||||
<Configuration status="WARN">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_ERR">
|
||||
<PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="WARN">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# 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.
|
||||
|
||||
1.2.62
|
||||
Loading…
Reference in New Issue