First version of the agent documentation
This commit is contained in:
parent
b880e29ab9
commit
ee9e0626df
|
@ -23,21 +23,17 @@ sampler:
|
|||
# Decorators are used to add extra information to span
|
||||
# Could be DBServiceDecorator, MapperDecorator or HTTPServiceDecorator
|
||||
decorators:
|
||||
# This span decorator leverages HTTP tags such as the URL requested
|
||||
- type: HTTPServiceDecorator
|
||||
- type: HTTP
|
||||
componentName: java-web-servlet
|
||||
|
||||
# Decorator fot the HTTP client
|
||||
- type: HTTPServiceDecorator
|
||||
- type: HTTP
|
||||
componentName: java-okhttp
|
||||
desiredServiceName: http-client
|
||||
|
||||
# This span decorator leverages DB tags such as the statement requested
|
||||
- type: DBServiceDecorator
|
||||
- type: DB
|
||||
componentName: java-mongo
|
||||
desiredServiceName: mongo
|
||||
|
||||
# Decorator for the AWS SDK client
|
||||
- type: HTTPServiceDecorator
|
||||
- type: DB
|
||||
componentName: java-jdbc
|
||||
desiredServiceName: jdbc
|
||||
- type: HTTP
|
||||
componentName: java-aws-sdk
|
||||
desiredServiceName: aws-client
|
|
@ -8,18 +8,18 @@ import io.opentracing.tag.Tags;
|
|||
* This span decorator leverages DB tags. It allows the dev to define a custom
|
||||
* service name and retrieves some DB meta such as the statement
|
||||
*/
|
||||
public class DBServiceDecorator implements DDSpanContextDecorator {
|
||||
public class DB implements DDSpanContextDecorator {
|
||||
|
||||
protected final String componentName;
|
||||
protected final String desiredServiceName;
|
||||
|
||||
public DBServiceDecorator(String componentName) {
|
||||
public DB(String componentName) {
|
||||
super();
|
||||
this.componentName = componentName;
|
||||
this.desiredServiceName = null;
|
||||
}
|
||||
|
||||
public DBServiceDecorator(String componentName,String desiredServiceName) {
|
||||
public DB(String componentName,String desiredServiceName) {
|
||||
super();
|
||||
this.componentName = componentName;
|
||||
this.desiredServiceName = desiredServiceName;
|
|
@ -12,18 +12,18 @@ import io.opentracing.tag.Tags;
|
|||
* This span decorator leverages HTTP tags. It allows the dev to define a custom
|
||||
* service name and retrieves some HTTP meta such as the request path
|
||||
*/
|
||||
public class HTTPServiceDecorator implements DDSpanContextDecorator {
|
||||
public class HTTP implements DDSpanContextDecorator {
|
||||
|
||||
protected final String componentName;
|
||||
protected final String desiredServiceName;
|
||||
|
||||
public HTTPServiceDecorator(String componentName) {
|
||||
public HTTP(String componentName) {
|
||||
super();
|
||||
this.componentName = componentName;
|
||||
this.desiredServiceName = null;
|
||||
}
|
||||
|
||||
public HTTPServiceDecorator(String componentName,String desiredServiceName) {
|
||||
public HTTP(String componentName,String desiredServiceName) {
|
||||
super();
|
||||
this.componentName = componentName;
|
||||
this.desiredServiceName = desiredServiceName;
|
|
@ -10,9 +10,9 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.datadoghq.trace.DDTracer;
|
||||
import com.datadoghq.trace.integration.DBServiceDecorator;
|
||||
import com.datadoghq.trace.integration.DB;
|
||||
import com.datadoghq.trace.integration.DDSpanContextDecorator;
|
||||
import com.datadoghq.trace.integration.HTTPServiceDecorator;
|
||||
import com.datadoghq.trace.integration.HTTP;
|
||||
import com.datadoghq.trace.sampling.AllSampler;
|
||||
import com.datadoghq.trace.sampling.RateSampler;
|
||||
import com.datadoghq.trace.sampling.Sampler;
|
||||
|
@ -88,11 +88,11 @@ public class DDTracerResolver extends TracerResolver {
|
|||
String componentName = (String) map.get("componentName");
|
||||
String desiredServiceName = (String) map.get("desiredServiceName");
|
||||
|
||||
if (map.get("type").equals(HTTPServiceDecorator.class.getSimpleName())) {
|
||||
decorator = new HTTPServiceDecorator(componentName, desiredServiceName);
|
||||
if (map.get("type").equals(HTTP.class.getSimpleName())) {
|
||||
decorator = new HTTP(componentName, desiredServiceName);
|
||||
tracer.addDecorator(decorator);
|
||||
} else if (map.get("type").equals(DBServiceDecorator.class.getSimpleName())) {
|
||||
decorator = new DBServiceDecorator(componentName, desiredServiceName);
|
||||
} else if (map.get("type").equals(DB.class.getSimpleName())) {
|
||||
decorator = new DB(componentName, desiredServiceName);
|
||||
tracer.addDecorator(decorator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,10 @@ sampler:
|
|||
# Could be DBServiceDecorator, MapperDecorator or HTTPServiceDecorator
|
||||
decorators:
|
||||
# This span decorator leverages HTTP tags such as the URL requested
|
||||
- type: HTTPServiceDecorator
|
||||
- type: HTTP
|
||||
componentName: http
|
||||
desiredServiceName: unnamed-java-http
|
||||
|
||||
# This span decorator leverages DB tags such as the statement requested
|
||||
- type: DBServiceDecorator
|
||||
- type: DB
|
||||
componentName: db
|
||||
desiredServiceName: unnamed-java-db
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<Pattern>
|
||||
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</Pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root level="trace">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
|
@ -8,7 +8,7 @@ import org.junit.Test;
|
|||
|
||||
import com.datadoghq.trace.DDTracer;
|
||||
import com.datadoghq.trace.integration.DDSpanContextDecorator;
|
||||
import com.datadoghq.trace.integration.HTTPServiceDecorator;
|
||||
import com.datadoghq.trace.integration.HTTP;
|
||||
|
||||
public class TracerResolverTest {
|
||||
|
||||
|
@ -21,8 +21,8 @@ public class TracerResolverTest {
|
|||
|
||||
assertThat(decorators.size()).isEqualTo(1);
|
||||
DDSpanContextDecorator decorator = decorators.get(0);
|
||||
assertThat(decorator.getClass()).isEqualTo(HTTPServiceDecorator.class);
|
||||
HTTPServiceDecorator httpServiceDecorator = (HTTPServiceDecorator) decorator;
|
||||
assertThat(decorator.getClass()).isEqualTo(HTTP.class);
|
||||
HTTP httpServiceDecorator = (HTTP) decorator;
|
||||
assertThat(httpServiceDecorator.getComponentName()).isEqualTo("hello");
|
||||
assertThat(httpServiceDecorator.getDesiredServiceName()).isEqualTo("world");
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ writer:
|
|||
sampler:
|
||||
type: AllSampler
|
||||
decorators:
|
||||
- type: HTTPServiceDecorator
|
||||
- type: HTTP
|
||||
componentName: hello
|
||||
desiredServiceName: world
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</layout>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<root level="trace">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
|
|
Loading…
Reference in New Issue