Skip to content

Commit

Permalink
Merge pull request #169 from rollbar/native-agent
Browse files Browse the repository at this point in the history
Get local variables via the JVMTI
  • Loading branch information
rokob authored Dec 12, 2018
2 parents e97523e + efcf2f8 commit 202e928
Show file tree
Hide file tree
Showing 24 changed files with 1,999 additions and 7 deletions.
8 changes: 8 additions & 0 deletions examples/rollbar-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ jar {

mainClassName = "com.rollbar.example.Application"

// Uncomment the block below to use the native agent to add local variables to stack traces
// This assumes you have run `cargo build --release` inside the native-agent directory
/*
applicationDefaultJvmArgs = [
"-agentpath:../../native-agent/target/release/"+System.mapLibraryName("rollbar_java_agent"),
]
*/

dependencies {
compile project(":rollbar-java")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.rollbar.notifier.config.Config;
import com.rollbar.notifier.config.ConfigBuilder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
Expand All @@ -29,9 +30,11 @@ public class Application {
public Application() {
this.greeting = new Greeting();
LOGGER.info("Configuring Rollbar");
List<String> appPackages = Arrays.asList("com.rollbar.example");
Config config = ConfigBuilder.withAccessToken(System.getenv("ROLLBAR_ACCESSTOKEN"))
.environment("development")
.codeVersion("1.0.0")
.appPackages(appPackages)
.build();
LOGGER.info("Initializing Rollbar");
this.rollbar = Rollbar.init(config);
Expand Down
8 changes: 8 additions & 0 deletions examples/rollbar-scala/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ repositories {
mavenCentral()
}

// Uncomment the block below to use the native agent to add local variables to stack traces
// This assumes you have run `cargo build --release` inside the native-agent directory
/*
applicationDefaultJvmArgs = [
"-agentpath:../../native-agent/target/release/"+System.mapLibraryName("rollbar_java_agent")
]
*/

dependencies {
compile project(":rollbar-java")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,46 @@ package com.rollbar.example
import com.rollbar.notifier.Rollbar
import com.rollbar.notifier.config.ConfigBuilder

import scala.collection.JavaConverters._
import scala.util.control.NonFatal

object Application {

def main(args: Array[String]) {
val appPackages = List("com.rollbar.example")
val config = ConfigBuilder.withAccessToken(sys.env("ROLLBAR_ACCESSTOKEN"))
.language("scala")
.codeVersion("1.0.0")
.environment("development")
.appPackages(appPackages.asJava)
.build();

val rollbar = Rollbar.init(config)
val rollbar = new Rollbar(config)

val whoa = 92
try {
exec()
} catch {
case NonFatal(e) => rollbar.error(e)
}

try {
rollbar.close(true);
} catch {
case NonFatal(e) => e.printStackTrace
}
}

def exec() {
val x = 42
val y = x + 99
greeting()

throw new RuntimeException("Execution error after greeting.")
}

def greeting() {
println(s"Hello Rollbar!")
val zz = s"Hello Rollbar!"
println(zz)
}
}
}
Loading

0 comments on commit 202e928

Please sign in to comment.