Created
November 26, 2019 20:02
-
-
Save jaycdave88/230df7f2ca0b07b242ff49079c06dbbb to your computer and use it in GitHub Desktop.
Manual Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping | |
public @ResponseBody String coffeeHouseIndex() { | |
if (GlobalTracer.get() != null && GlobalTracer.get().activeSpan() != null) { | |
try { | |
GlobalTracer.get().activeSpan(); | |
if (setPriority.get() == null) { | |
setPriority.compareAndSet(null, GlobalTracer.get().activeSpan().getClass().getDeclaredMethod("setSamplingPriority", int.class)); | |
} | |
setPriority.get().invoke(GlobalTracer.get().activeSpan(), 2 ); | |
} catch(Exception e) { | |
throw new RuntimeException(e); | |
} | |
} | |
final long startTs = System.currentTimeMillis(); | |
User user = getRandomUser(); | |
final long dbTime = System.currentTimeMillis() - startTs; | |
// distributed tracing with other applications | |
if (nodeJSAppAvailable) { | |
getUsersAuth(); | |
} | |
prepareBrewInfo(user); | |
return "Hello Java: " + System.currentTimeMillis() | |
+ "<br/>Fetched Random User: " + user + " in " + dbTime + "ms"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment