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.

Feature request: Unique Identifier per Advice application

See original GitHub issue

Given a class like this:

public class Foo {
  public void foo1() {}
  public void foo2() {}
}

If I write advice that instruments each public method in Foo, there is not a simple way to uniquely identify the advice for each method. I suggest something like this:

@Advice.Pointcut int unscopedUniqueIdentifier
@Advice.Pointcut(Foo.class) int fooScopedUniqueIdentifier

I expect this would be implemented via a shared AtomicInteger per the scope provided. The ID could be injected as a constant into the bytecode and probably regenerated each time a retransformation occurs.

The alternative would be to use a combination of class and method name + signature mapping to an ID, but that would be much less performant.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
raphwcommented, Aug 14, 2020

Have a look at the unit tests, they should reflect any possible use case. Other then that, have a look at Mockito. We inject unique ids per mock maker in there. Mockito only defines a hand full of advice, so it should be easy to find by looking for the @Advice annotations there.

0reactions
tylerbensoncommented, Aug 14, 2020

Cool. Do you know of any examples you could point me to?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Manage Feature Requests [Template included]
This guide will teach you everything about feature requests – how to process them, manage them, respond to them, prioritize them – so...
Read more >
Best practices for unique identifiers - Android Developers
This document provides guidance for selecting appropriate identifiers for your app based on your use case. For a general look at Android permissions, ......
Read more >
Feature Requests: How to Track, Prioritize, and Manage - Pipefy
Feature requests are demands for improvement in a company's product. Click to learn how to track and prioritize these requests efficiently!
Read more >
possible to log a unique id per request/response?
Hello, does anyone know of a trivial way to log a unique or semi-unique such as scalar($self-req) identifier for a request? The problem...
Read more >
10 Tips to Improve Your Feature Request Responses - Nicereply
Feature requests don't need to be a sore spot for your customers or your CSAT—you just need to help everyone feel heard.
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