question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@Traced annotation

See original GitHub issue

I was wondering if it was ever discuss to have a @Traced method-level annotation?

It would allow to easily start/stop a span around a method (using AOP). We could even capture the args and return value at some point.

Something like this:

@Target({ ElementType.METHOD, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Traced {

    boolean withActiveSpanOnly() default true;

    String component() default "java-traced-annotation";
    
    String operationName() default "";

}

Apache SkyWalking offers this: https://github.com/apache/incubator-skywalking/blob/master/apm-application-toolkit/apm-toolkit-trace/src/main/java/org/apache/skywalking/apm/toolkit/trace/Trace.java

And it could be similar to the @Timed annotation from DropWizard http://metrics.dropwizard.io/3.1.0/apidocs/com/codahale/metrics/annotation/Timed.html

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
pavolloffaycommented, Feb 24, 2020

I am happy to review/merge if it’s not controversial.

1reaction
duclm2609commented, Feb 20, 2020

I’m looking for the same feature. It would be nice to not mess with business logic code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Traced (MicroProfile 2.0.1-SNAPSHOT API)
Annotation Type Traced ... This annotation allows fine-tuned control over which classes and methods create OpenTracing spans. By default, all JAX-RS methods ...
Read more >
Java agent API: Instrument using annotation
Annotating a method with @Trace tells the Java agent that measurements should be taken for that method. To add a method call as...
Read more >
Enabling explicit distributed tracing code instrumentation - IBM
Use the @Traced annotation to instrument classes and methods for OpenTracing. ... Apply the @Traced annotation to specify a class or method to...
Read more >
Trace (newrelic-api 7.11.0 API)
If you annotate a method with the Trace annotation it will be automatically timed by the New Relic agent with the following measurements:....
Read more >
Annotation - OpenCensus
Attributes, A set of attributes to articulate the annotate ... We'll add an annotation to a span in the excerpts with a couple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found