Skip to content

Instantly share code, notes, and snippets.

@autoletics
Last active January 16, 2017 11:05
Show Gist options
  • Save autoletics/1fa628c48153bd5a604f77928bc36822 to your computer and use it in GitHub Desktop.
Save autoletics/1fa628c48153bd5a604f77928bc36822 to your computer and use it in GitHub Desktop.
static final Probes.Label DISABLED = Probes.label("disabled");
static final java.lang.reflect.Method m = /** some reflection code to lookup method **/
// how to check if a method is disabled in terms of metering
if(Probes.name(m).contains(DISABLED)) { /**...**/ }
// in simulated environment there is no access to the meta classes so instead use
static final Probes.Name NAME = Probes.name("com").name("acme").name("Service").name("doWork")
// or alternatively have it parsed
static final Probes.Name NAME = Probes.parse("com.acme.Service.doWork")
// more efficient checking of disablement
if(NAME.contains(DISABLED)) { /**...**/ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment