diff options
author | savaki <matt.ho@gmail.com> | 2018-07-18 08:57:07 -0700 |
---|---|---|
committer | savaki <matt.ho@gmail.com> | 2018-07-21 07:44:40 -0700 |
commit | 73c37dfc5ba28131c50d266b532877911bf0edea (patch) | |
tree | 177c6623b45ad7cc53e92985f165c9a520297d95 | |
parent | 3dcabd02cf06b303d7e109608974a635f61fd6c8 (diff) | |
download | opencensus-java-73c37dfc5ba28131c50d266b532877911bf0edea.tar.gz |
switched error to exception for consistency with tools like zipkin
wrapped calls to @Traced with a backtick where possible
updated test expectations
5 files changed, 11 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 47f62268..accf48be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - Add an artifact `opencensus-contrib-exemplar-util` that has helper utilities on recording exemplars. - Reduce the default limit on `Link`s per `Span` to 32 (was 128 before). -- Add Spring support for @Traced annotation and java.sql.PreparedStatements +- Add Spring support for `@Traced` annotation and java.sql.PreparedStatements tracing ## 0.15.0 - 2018-06-20 diff --git a/contrib/spring/README.md b/contrib/spring/README.md index e33a4274..22f08d90 100644 --- a/contrib/spring/README.md +++ b/contrib/spring/README.md @@ -51,7 +51,7 @@ runtime 'org.springframework:spring-aspects:SPRING_VERSION' ### Features -#### @Traced Annotation +#### Traced Annotation The `opencensus-contrib-spring` package provides support for a `@Traced` annotation that can be applied to methods. When applied, the method will be wrapped in a @@ -63,7 +63,7 @@ and the stack trace will be added to the span as an annotation. To enable the `@Traced` annotation, include the `CensusSpringAspect` bean. ```xml - <!-- traces explicit calls to @Traced --> + <!-- traces explicit calls to Traced --> <bean id="censusAspect" class="io.opencensus.contrib.spring.aop.CensusSpringAspect"> <constructor-arg ref="tracer"/> </bean> @@ -102,7 +102,7 @@ need to be done separately. <aop:aspectj-autoproxy/> - <!-- traces explicit calls to @Traced --> + <!-- traces explicit calls to Traced --> <bean id="censusAspect" class="io.opencensus.contrib.spring.aop.CensusSpringAspect"> <constructor-arg ref="tracer"/> </bean> @@ -117,7 +117,7 @@ need to be done separately. </beans> ``` -### @Traced Usage +### Traced Usage Once configured, you can use the `@Traced` annotation to indicate that a method should be wrapped with a `Span`. By default, `@Traced` will use the name of the method as the @@ -130,7 +130,7 @@ span name to be specified. // do work } - // a custom span name can also be provided to @Traced + // a custom span name can also be provided to Traced @Traced(name = "custom-span-name") void example2() { // do moar work diff --git a/contrib/spring/src/main/java/io/opencensus/contrib/spring/aop/CensusSpringAspect.java b/contrib/spring/src/main/java/io/opencensus/contrib/spring/aop/CensusSpringAspect.java index 477761cc..4d230982 100644 --- a/contrib/spring/src/main/java/io/opencensus/contrib/spring/aop/CensusSpringAspect.java +++ b/contrib/spring/src/main/java/io/opencensus/contrib/spring/aop/CensusSpringAspect.java @@ -25,7 +25,7 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Configurable; -/** CensusSpringAspect handles logic for the @Traced annotation. */ +/** CensusSpringAspect handles logic for the `@Traced` annotation. */ @Aspect @Configurable public class CensusSpringAspect { @@ -36,8 +36,8 @@ public class CensusSpringAspect { } /** - * trace handles methods executed with the @Traced annotation. A new span will be created with an - * optionally customizable span name. + * trace handles methods executed with the `@Traced` annotation. A new span will be + * created with an optionally customizable span name. * * @param call the join point to execute * @return the result of the invocation diff --git a/contrib/spring/src/main/java/io/opencensus/contrib/spring/aop/Handler.java b/contrib/spring/src/main/java/io/opencensus/contrib/spring/aop/Handler.java index 1e08f071..66fb1b24 100644 --- a/contrib/spring/src/main/java/io/opencensus/contrib/spring/aop/Handler.java +++ b/contrib/spring/src/main/java/io/opencensus/contrib/spring/aop/Handler.java @@ -52,7 +52,7 @@ final class Handler { attributes.put("stackTrace", AttributeValue.stringAttributeValue(sw.toString())); Span span = tracer.getCurrentSpan(); - span.addAnnotation("exception", attributes); + span.addAnnotation("error", attributes); span.setStatus(Status.UNKNOWN); throw t; } finally { diff --git a/contrib/spring/src/test/java/io/opencensus/contrib/spring/aop/CensusSpringAspectTest.java b/contrib/spring/src/test/java/io/opencensus/contrib/spring/aop/CensusSpringAspectTest.java index a356533d..3a3d3d67 100644 --- a/contrib/spring/src/test/java/io/opencensus/contrib/spring/aop/CensusSpringAspectTest.java +++ b/contrib/spring/src/test/java/io/opencensus/contrib/spring/aop/CensusSpringAspectTest.java @@ -127,7 +127,7 @@ public class CensusSpringAspectTest { List<SpanData.TimedEvent<Annotation>> events = annotations.getEvents(); assertThat(events.size()).isEqualTo(1); - assertThat(events.get(0).getEvent().getDescription()).isEqualTo("exception"); + assertThat(events.get(0).getEvent().getDescription()).isEqualTo("error"); } @Test |