Skip to content

Commit

Permalink
Merge pull request #4 from thefreebit/bullfrog-v0.0.2
Browse files Browse the repository at this point in the history
Bullfrog v0.0.2
  • Loading branch information
thefreebit committed Aug 6, 2018
2 parents e9e1be8 + 04e7438 commit 90d59ff
Show file tree
Hide file tree
Showing 1,118 changed files with 54,454 additions and 22,885 deletions.
62 changes: 44 additions & 18 deletions .travis.yml
Expand Up @@ -16,72 +16,98 @@ cache:
matrix:
include:
- jdk: oraclejdk8
env: TARGET=test1 SKIP_SHADING=false GLOWROOT_HARNESS=javaagent
env: TARGET=test1 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=test2 SKIP_SHADING=false GLOWROOT_HARNESS=javaagent
env: TARGET=test2 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=test3 SKIP_SHADING=false GLOWROOT_HARNESS=javaagent
- jdk: openjdk7
env: TARGET=test1 SKIP_SHADING=false GLOWROOT_HARNESS=javaagent
- jdk: openjdk7
env: TARGET=test2 SKIP_SHADING=false GLOWROOT_HARNESS=javaagent
env: TARGET=test3 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=test4 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=deploy
- jdk: oraclejdk8
env: TARGET=checker
- jdk: oraclejdk9
env: TARGET=test1 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk9
env: TARGET=test2 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk9
env: TARGET=test3 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk9
env: TARGET=test4 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: openjdk7
env: TARGET=test1 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: openjdk7
env: TARGET=test2 TEST_SHADED=true GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=test1 TEST_SHADED=false GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=test1 SKIP_SHADING=false GLOWROOT_HARNESS=local
env: TARGET=test2 TEST_SHADED=false GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=test2 SKIP_SHADING=false GLOWROOT_HARNESS=local
env: TARGET=test3 TEST_SHADED=false GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=test3 SKIP_SHADING=false GLOWROOT_HARNESS=local
env: TARGET=test4 TEST_SHADED=false GLOWROOT_HARNESS=javaagent
- jdk: oraclejdk8
env: TARGET=test1 SKIP_SHADING=true GLOWROOT_HARNESS=javaagent
env: TARGET=test1 TEST_SHADED=true GLOWROOT_HARNESS=local
- jdk: oraclejdk8
env: TARGET=test2 SKIP_SHADING=true GLOWROOT_HARNESS=javaagent
env: TARGET=test2 TEST_SHADED=true GLOWROOT_HARNESS=local
- jdk: oraclejdk8
env: TARGET=test3 SKIP_SHADING=true GLOWROOT_HARNESS=javaagent
env: TARGET=test3 TEST_SHADED=true GLOWROOT_HARNESS=local
- jdk: oraclejdk8
env: TARGET=test4 SKIP_SHADING=true GLOWROOT_HARNESS=javaagent
env: TARGET=test4 TEST_SHADED=true GLOWROOT_HARNESS=local
- jdk: oraclejdk8
env: TARGET=test1 SKIP_SHADING=true GLOWROOT_HARNESS=local
env: TARGET=test1 TEST_SHADED=false GLOWROOT_HARNESS=local
- jdk: oraclejdk8
env: TARGET=test2 SKIP_SHADING=true GLOWROOT_HARNESS=local
env: TARGET=test2 TEST_SHADED=false GLOWROOT_HARNESS=local
- jdk: oraclejdk8
env: TARGET=test3 SKIP_SHADING=true GLOWROOT_HARNESS=local
env: TARGET=test3 TEST_SHADED=false GLOWROOT_HARNESS=local
- jdk: oraclejdk8
env: TARGET=test4 SKIP_SHADING=true GLOWROOT_HARNESS=local
env: TARGET=test4 TEST_SHADED=false GLOWROOT_HARNESS=local
# chrome
- jdk: oraclejdk8
env: TARGET=saucelabs1 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=chrome SAUCELABS_BROWSER_VERSION=
- jdk: oraclejdk8
env: TARGET=saucelabs2 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=chrome SAUCELABS_BROWSER_VERSION=
- jdk: oraclejdk8
env: TARGET=saucelabs3 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=chrome SAUCELABS_BROWSER_VERSION=
# firefox
- jdk: oraclejdk8
env: TARGET=saucelabs1 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=firefox SAUCELABS_BROWSER_VERSION=
- jdk: oraclejdk8
env: TARGET=saucelabs2 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=firefox SAUCELABS_BROWSER_VERSION=
- jdk: oraclejdk8
env: TARGET=saucelabs3 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=firefox SAUCELABS_BROWSER_VERSION=
# internet explorer
- jdk: oraclejdk8
env: TARGET=saucelabs1 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=11
- jdk: oraclejdk8
env: TARGET=saucelabs2 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=11
- jdk: oraclejdk8
env: TARGET=saucelabs3 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=11
- jdk: oraclejdk8
env: TARGET=saucelabs1 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=10
- jdk: oraclejdk8
env: TARGET=saucelabs2 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=10
- jdk: oraclejdk8
env: TARGET=saucelabs3 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=10
- jdk: oraclejdk8
env: TARGET=saucelabs1 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=9
- jdk: oraclejdk8
env: TARGET=saucelabs2 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=9
- jdk: oraclejdk8
env: TARGET=saucelabs3 SAUCELABS_PLATFORM="Windows 7" SAUCELABS_BROWSER_NAME=iexplore SAUCELABS_BROWSER_VERSION=9
# safari
- jdk: oraclejdk8
env: TARGET=saucelabs1 SAUCELABS_PLATFORM="OS X 10.11" SAUCELABS_BROWSER_NAME=safari SAUCELABS_BROWSER_VERSION=9
- jdk: oraclejdk8
env: TARGET=saucelabs2 SAUCELABS_PLATFORM="OS X 10.11" SAUCELABS_BROWSER_NAME=safari SAUCELABS_BROWSER_VERSION=9
- jdk: oraclejdk8
env: TARGET=saucelabs3 SAUCELABS_PLATFORM="OS X 10.11" SAUCELABS_BROWSER_NAME=safari SAUCELABS_BROWSER_VERSION=9
- jdk: oraclejdk8
env: TARGET=saucelabs1 SAUCELABS_PLATFORM="OS X 10.10" SAUCELABS_BROWSER_NAME=safari SAUCELABS_BROWSER_VERSION=8
- jdk: oraclejdk8
env: TARGET=saucelabs2 SAUCELABS_PLATFORM="OS X 10.10" SAUCELABS_BROWSER_NAME=safari SAUCELABS_BROWSER_VERSION=8
- jdk: oraclejdk8
env: TARGET=saucelabs3 SAUCELABS_PLATFORM="OS X 10.10" SAUCELABS_BROWSER_NAME=safari SAUCELABS_BROWSER_VERSION=8
addons:
sauce_connect: true
5 changes: 3 additions & 2 deletions README.md
@@ -1,5 +1,4 @@
BullFrog
=========

BullFrog is an Artifactory specific open source Java APM based on [Glowroot](https://github.com/glowroot/glowroot).

Expand Down Expand Up @@ -60,6 +59,8 @@ If you are modifying web assets, you either need to run grunt to re-build them a

`grunt serve` serves up the Glowroot web assets to the browser without the concat/minify/rev step, which makes testing/debugging much easier. It reverse proxies non- static resource requests to http://localhost:4000 to be handled by Glowroot. It also watches for changes to the files and performs live-reload of web assets inside the browser.

`grunt serve:demo` does the same as above, except that it reverse proxies non- static resource requests to [https://demo.glowroot.org](https://demo.glowroot.org) instead of http://localhost:4000.

## Integration tests

Integration tests are run during Maven's standard `integration-test` lifecycle phase.
Expand All @@ -70,7 +71,7 @@ Browser-based integration tests are run using WebDriver. By default they run ag

## Microbenchmarks

Microbenchmarks are written using the excellent [JMH](http://openjdk.java.net/projects/code-tools/jmh/) benchmark harness. The microbenchmarks can be built and run under [agent-parent/benchmarks](agent-parent/benchmarks):
Microbenchmarks are written using the excellent [JMH](http://openjdk.java.net/projects/code-tools/jmh/) benchmark harness. The microbenchmarks can be built and run under [agent/benchmarks](agent/benchmarks):

mvn clean package
java -jar target/benchmarks.jar -jvmArgs -javaagent:path/to/glowroot.jar
Expand Down
34 changes: 26 additions & 8 deletions agent/api/pom.xml
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.glowroot</groupId>
<artifactId>glowroot-parent</artifactId>
<version>0.9.25</version>
<version>0.10.12</version>
<relativePath>../..</relativePath>
</parent>

Expand All @@ -21,12 +22,6 @@
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<!-- don't need this dependency at runtime since only annotations -->
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -61,4 +56,27 @@
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<!-- use custom-built jdk6 compatible checker framework annotations by default except when
actually running checker framework code quality tests, in which case the real checker
framework annotations are provided -->
<id>not-the-checker-build</id>
<activation>
<property>
<name>!glowroot.checker.build</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.glowroot.build</groupId>
<artifactId>glowroot-build-checker-jdk6</artifactId>
<version>${project.version}</version>
<!-- don't need this dependency at runtime since only annotations -->
<optional>true</optional>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
52 changes: 10 additions & 42 deletions agent/api/src/main/java/org/glowroot/agent/api/Glowroot.java
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,40 +15,16 @@
*/
package org.glowroot.agent.api;

import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;

import javax.annotation.Nullable;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.checkerframework.checker.nullness.qual.Nullable;

import org.glowroot.agent.api.internal.GlowrootService;
import org.glowroot.agent.api.internal.NopGlowrootService;
import org.glowroot.agent.api.internal.GlowrootServiceHolder;

public class Glowroot {

private static final Logger logger = LoggerFactory.getLogger(Glowroot.class);

private static final GlowrootService glowrootService;

static {
GlowrootService service;
try {
Class<?> registryClass = Class.forName("org.glowroot.agent.impl.ServiceRegistryImpl");
Method getInstanceMethod = registryClass.getMethod("getGlowrootService");
service = (GlowrootService) getInstanceMethod.invoke(null);
if (service == null) {
service = NopGlowrootService.INSTANCE;
}
} catch (Exception e) {
// this is expected when Glowroot is not running
// log exception at debug level
logger.debug(e.getMessage(), e);
service = NopGlowrootService.INSTANCE;
}
glowrootService = service;
}
private static final GlowrootService service = GlowrootServiceHolder.get();

private Glowroot() {}

Expand All @@ -58,7 +34,7 @@ private Glowroot() {}
* If there is no current transaction then this method does nothing.
*/
public static void setTransactionType(@Nullable String transactionType) {
glowrootService.setTransactionType(transactionType);
service.setTransactionType(transactionType);
}

/**
Expand All @@ -67,7 +43,7 @@ public static void setTransactionType(@Nullable String transactionType) {
* If there is no current transaction then this method does nothing.
*/
public static void setTransactionName(@Nullable String transactionName) {
glowrootService.setTransactionName(transactionName);
service.setTransactionName(transactionName);
}

/**
Expand All @@ -76,7 +52,7 @@ public static void setTransactionName(@Nullable String transactionName) {
* If there is no current transaction then this method does nothing.
*/
public static void setTransactionUser(@Nullable String user) {
glowrootService.setTransactionUser(user);
service.setTransactionUser(user);
}

/**
Expand All @@ -93,7 +69,7 @@ public static void setTransactionUser(@Nullable String user) {
* {@code null} values are normalized to the empty string.
*/
public static void addTransactionAttribute(String name, @Nullable String value) {
glowrootService.addTransactionAttribute(name, value);
service.addTransactionAttribute(name, value);
}

/**
Expand All @@ -107,7 +83,7 @@ public static void addTransactionAttribute(String name, @Nullable String value)
* If there is no current transaction then this method does nothing.
*/
public static void setTransactionSlowThreshold(long threshold, TimeUnit unit) {
glowrootService.setTransactionSlowThreshold(threshold, unit);
service.setTransactionSlowThreshold(threshold, unit);
}

/**
Expand All @@ -121,14 +97,6 @@ public static void setTransactionSlowThreshold(long threshold, TimeUnit unit) {
* If there is no current transaction then this method does nothing.
*/
public static void setTransactionOuter() {
glowrootService.setTransactionOuter();
}

/**
* @deprecated Replaced by {@link #setTransactionOuter()}.
*/
@Deprecated
public static void setOuterTransaction() {
setTransactionOuter();
service.setTransactionOuter();
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2017 the original author or authors.
* Copyright 2015-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,5 +38,10 @@
String transactionName(); // template
String traceHeadline(); // template
String timer();
AlreadyInTransactionBehavior alreadyInTransactionBehavior() default AlreadyInTransactionBehavior.CAPTURE_TRACE_ENTRY;
}

enum AlreadyInTransactionBehavior {
CAPTURE_TRACE_ENTRY, CAPTURE_NEW_TRANSACTION, DO_NOTHING
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@

import java.util.concurrent.TimeUnit;

import javax.annotation.Nullable;
import org.checkerframework.checker.nullness.qual.Nullable;

public interface GlowrootService {

Expand Down
@@ -0,0 +1,43 @@
/*
* Copyright 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.glowroot.agent.api.internal;

import org.checkerframework.checker.nullness.qual.Nullable;

public class GlowrootServiceHolder {

private static volatile @Nullable GlowrootService service;
private static volatile @Nullable Exception retrievedTooEarlyLocation;

private GlowrootServiceHolder() {}

public static GlowrootService get() {
if (service == null) {
retrievedTooEarlyLocation = new Exception();
return NopGlowrootService.INSTANCE;
} else {
return service;
}
}

public static void set(GlowrootService service) {
GlowrootServiceHolder.service = service;
}

public static @Nullable Exception getRetrievedTooEarlyLocation() {
return retrievedTooEarlyLocation;
}
}

0 comments on commit 90d59ff

Please sign in to comment.