Skip to content

Commit

Permalink
feature/20 jprofiler (#22)
Browse files Browse the repository at this point in the history
* #20 Added module for JProfiler

Co-authored-by: Muhammet Orazov <[email protected]>
  • Loading branch information
jakobbraun and morazow authored Jul 15, 2021
1 parent 0827ed9 commit f8ca745
Show file tree
Hide file tree
Showing 15 changed files with 327 additions and 114 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/broken_links_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: lychee Link Checker
id: lc
uses: lycheeverse/[email protected]
- name: Fail if there were link errors
run: exit ${{ steps.lc.outputs.exit_code }}
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ jobs:
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.inputs.upload_url }}
asset_path: target/*.jar
asset_path: target/*.jar
- name: Upload error-code-report
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.inputs.upload_url }}
asset_path: target/error_code_report.json
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,29 @@ This module installs a jacoco agent to the UDF JVM and receives the execution da

This module requires additional maven configuration. Use the [project-keeper's](https://github.com/exasol/project-keeper-maven-plugin) `udf_coverage` module to verify it.

### JProfiler

System property: `test.jprofiler`

This module allows you to profile UDF runs using [JProfiler](https://www.ej-technologies.com/products/jprofiler/overview.html). For that it uploads the JProfiler archive to BucketFs and adds the agent to the UDF command.

Since JProfiler uses a forward TCP connection you can only profile one UDF instance at once. Make sure that you don't start multiple parallel instances.

#### Usage

* Install JProfiler on your system
* Download JProfiler for Linux without JRE as `.tar.gz` (Also choose the Linux version if you're on a different operating system!)
* Now you've two options:
* Store it as `jprofiler.tar.gz` in your home directory
* Store it somewhere and pass `-DjProfilerAgent=<path to the archive.tar.gz>` to each test run
* Run your tests with `-Dtest.jprofiler=true`
* Find out the IPv4 address of your Exasol DB (for docker use `docker inspect`)
* Start JProfiler GUI
* Connect to `<EXASOL_IP>:11002`
* The UDF execution will wait until you connect the profiler
* Ensure that the port is reachable from your system (for AWS instances you can use an SSH tunnel from inside JProfiler)

## Additional Information

* [Changelog](doc/changes/changelog.md)
* [Dependencies](dependencies.md)

131 changes: 67 additions & 64 deletions dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,87 +10,90 @@
| [JaCoCo :: Core][4] | [Eclipse Public License 2.0][5] |
| [BucketFS Java][6] | [MIT][3] |
| [exasol-test-setup-abstraction-java][8] | [MIT][3] |
| [Test Database Builder for Java][10] | [MIT][3] |
| [SLF4J API Module][12] | [MIT License][13] |
| [Apache Commons Compress][10] | [Apache License, Version 2.0][11] |
| [Test Database Builder for Java][12] | [MIT][3] |
| [SLF4J API Module][14] | [MIT License][15] |

## Test Dependencies

| Dependency | License |
| ----------------------------------------------- | --------------------------------- |
| [JaCoCo :: Agent][4] | [Eclipse Public License 2.0][5] |
| [JUnit Jupiter Engine][16] | [Eclipse Public License v2.0][17] |
| [JUnit Jupiter Params][16] | [Eclipse Public License v2.0][17] |
| [mockito-core][20] | [The MIT License][21] |
| [Hamcrest All][22] | [New BSD License][23] |
| [Test containers for Exasol on Docker][24] | [MIT][3] |
| [Testcontainers :: JUnit Jupiter Extension][26] | [MIT][27] |
| [JUnit Jupiter Engine][18] | [Eclipse Public License v2.0][19] |
| [JUnit Jupiter Params][18] | [Eclipse Public License v2.0][19] |
| [mockito-core][22] | [The MIT License][23] |
| [Hamcrest All][24] | [New BSD License][25] |
| [Test containers for Exasol on Docker][26] | [MIT][3] |
| [Testcontainers :: JUnit Jupiter Extension][28] | [MIT][29] |

## Plugin Dependencies

| Dependency | License |
| ------------------------------------------------------- | ---------------------------------------------- |
| [Maven Surefire Plugin][28] | [Apache License, Version 2.0][29] |
| [Maven Failsafe Plugin][30] | [Apache License, Version 2.0][29] |
| [JaCoCo :: Maven Plugin][4] | [Eclipse Public License 2.0][5] |
| [Apache Maven Compiler Plugin][34] | [Apache License, Version 2.0][29] |
| [Maven Dependency Plugin][36] | [The Apache Software License, Version 2.0][37] |
| [Versions Maven Plugin][38] | [Apache License, Version 2.0][29] |
| [Apache Maven Source Plugin][40] | [Apache License, Version 2.0][29] |
| [Apache Maven Javadoc Plugin][42] | [Apache License, Version 2.0][29] |
| [Apache Maven GPG Plugin][44] | [Apache License, Version 2.0][37] |
| [org.sonatype.ossindex.maven:ossindex-maven-plugin][46] | [ASL2][37] |
| [Apache Maven Enforcer Plugin][48] | [Apache License, Version 2.0][29] |
| [Project keeper maven plugin][50] | [MIT][3] |
| [Maven Deploy Plugin][52] | [The Apache Software License, Version 2.0][37] |
| [Nexus Staging Maven Plugin][54] | [Eclipse Public License][55] |
| [error-code-crawler-maven-plugin][56] | [MIT][3] |
| [Reproducible Build Maven Plugin][58] | [Apache 2.0][37] |
| [Maven Clean Plugin][60] | [The Apache Software License, Version 2.0][37] |
| [Maven Resources Plugin][62] | [The Apache Software License, Version 2.0][37] |
| [Maven JAR Plugin][64] | [The Apache Software License, Version 2.0][37] |
| [Maven Install Plugin][66] | [The Apache Software License, Version 2.0][37] |
| [Maven Site Plugin 3][68] | [The Apache Software License, Version 2.0][37] |
| [Maven Surefire Plugin][30] | [Apache License, Version 2.0][11] |
| [Maven Failsafe Plugin][32] | [Apache License, Version 2.0][11] |
| [JaCoCo :: Maven Plugin][34] | [Eclipse Public License 2.0][5] |
| [Apache Maven Compiler Plugin][36] | [Apache License, Version 2.0][11] |
| [Maven Dependency Plugin][38] | [The Apache Software License, Version 2.0][39] |
| [Versions Maven Plugin][40] | [Apache License, Version 2.0][11] |
| [Apache Maven Source Plugin][42] | [Apache License, Version 2.0][11] |
| [Apache Maven Javadoc Plugin][44] | [Apache License, Version 2.0][11] |
| [Apache Maven GPG Plugin][46] | [Apache License, Version 2.0][39] |
| [org.sonatype.ossindex.maven:ossindex-maven-plugin][48] | [ASL2][39] |
| [Apache Maven Enforcer Plugin][50] | [Apache License, Version 2.0][11] |
| [Project keeper maven plugin][52] | [MIT][3] |
| [Maven Deploy Plugin][54] | [The Apache Software License, Version 2.0][39] |
| [Nexus Staging Maven Plugin][56] | [Eclipse Public License][57] |
| [error-code-crawler-maven-plugin][58] | [MIT][3] |
| [Reproducible Build Maven Plugin][60] | [Apache 2.0][39] |
| [Maven Clean Plugin][62] | [The Apache Software License, Version 2.0][39] |
| [Maven Resources Plugin][64] | [The Apache Software License, Version 2.0][39] |
| [Maven JAR Plugin][66] | [The Apache Software License, Version 2.0][39] |
| [Maven Install Plugin][68] | [The Apache Software License, Version 2.0][39] |
| [Maven Site Plugin 3][70] | [The Apache Software License, Version 2.0][39] |

[4]: https://www.eclemma.org/jacoco/index.html
[50]: https://github.com/exasol/project-keeper-maven-plugin
[52]: https://github.com/exasol/project-keeper-maven-plugin
[6]: https://github.com/exasol/bucketfs-java
[2]: https://github.com/exasol/error-reporting-java
[0]: https://javaee.github.io/jsonp
[37]: http://www.apache.org/licenses/LICENSE-2.0.txt
[28]: https://maven.apache.org/surefire/maven-surefire-plugin/
[54]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/
[60]: http://maven.apache.org/plugins/maven-clean-plugin/
[39]: http://www.apache.org/licenses/LICENSE-2.0.txt
[30]: https://maven.apache.org/surefire/maven-surefire-plugin/
[56]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/
[62]: http://maven.apache.org/plugins/maven-clean-plugin/
[3]: https://opensource.org/licenses/MIT
[20]: https://github.com/mockito/mockito
[30]: https://maven.apache.org/surefire/maven-failsafe-plugin/
[36]: http://maven.apache.org/plugins/maven-dependency-plugin/
[38]: http://www.mojohaus.org/versions-maven-plugin/
[34]: https://maven.apache.org/plugins/maven-compiler-plugin/
[22]: https://github.com/mockito/mockito
[32]: https://maven.apache.org/surefire/maven-failsafe-plugin/
[12]: https://github.com/exasol/test-db-builder-java
[10]: https://commons.apache.org/proper/commons-compress/
[38]: http://maven.apache.org/plugins/maven-dependency-plugin/
[40]: http://www.mojohaus.org/versions-maven-plugin/
[36]: https://maven.apache.org/plugins/maven-compiler-plugin/
[1]: https://oss.oracle.com/licenses/CDDL+GPL-1.1
[27]: http://opensource.org/licenses/MIT
[44]: http://maven.apache.org/plugins/maven-gpg-plugin/
[29]: http://opensource.org/licenses/MIT
[46]: http://maven.apache.org/plugins/maven-gpg-plugin/
[5]: https://www.eclipse.org/legal/epl-2.0/
[55]: http://www.eclipse.org/legal/epl-v10.html
[24]: https://github.com/exasol/exasol-testcontainers
[22]: https://github.com/hamcrest/JavaHamcrest/hamcrest-all
[58]: http://zlika.github.io/reproducible-build-maven-plugin
[64]: http://maven.apache.org/plugins/maven-jar-plugin/
[13]: http://www.opensource.org/licenses/mit-license.php
[29]: https://www.apache.org/licenses/LICENSE-2.0.txt
[48]: https://maven.apache.org/enforcer/maven-enforcer-plugin/
[21]: https://github.com/mockito/mockito/blob/release/3.x/LICENSE
[17]: https://www.eclipse.org/legal/epl-v20.html
[23]: http://www.opensource.org/licenses/bsd-license.php
[66]: http://maven.apache.org/plugins/maven-install-plugin/
[16]: https://junit.org/junit5/
[46]: https://sonatype.github.io/ossindex-maven/maven-plugin/
[26]: https://testcontainers.org
[40]: https://maven.apache.org/plugins/maven-source-plugin/
[12]: http://www.slf4j.org
[52]: http://maven.apache.org/plugins/maven-deploy-plugin/
[68]: http://maven.apache.org/plugins/maven-site-plugin/
[62]: http://maven.apache.org/plugins/maven-resources-plugin/
[42]: https://maven.apache.org/plugins/maven-javadoc-plugin/
[56]: https://github.com/exasol/error-code-crawler-maven-plugin
[57]: http://www.eclipse.org/legal/epl-v10.html
[26]: https://github.com/exasol/exasol-testcontainers
[34]: https://www.jacoco.org/jacoco/trunk/doc/maven.html
[24]: https://github.com/hamcrest/JavaHamcrest/hamcrest-all
[23]: https://github.com/mockito/mockito/blob/main/LICENSE
[60]: http://zlika.github.io/reproducible-build-maven-plugin
[66]: http://maven.apache.org/plugins/maven-jar-plugin/
[15]: http://www.opensource.org/licenses/mit-license.php
[11]: https://www.apache.org/licenses/LICENSE-2.0.txt
[50]: https://maven.apache.org/enforcer/maven-enforcer-plugin/
[19]: https://www.eclipse.org/legal/epl-v20.html
[25]: http://www.opensource.org/licenses/bsd-license.php
[68]: http://maven.apache.org/plugins/maven-install-plugin/
[18]: https://junit.org/junit5/
[48]: https://sonatype.github.io/ossindex-maven/maven-plugin/
[28]: https://testcontainers.org
[42]: https://maven.apache.org/plugins/maven-source-plugin/
[14]: http://www.slf4j.org
[54]: http://maven.apache.org/plugins/maven-deploy-plugin/
[70]: http://maven.apache.org/plugins/maven-site-plugin/
[64]: http://maven.apache.org/plugins/maven-resources-plugin/
[44]: https://maven.apache.org/plugins/maven-javadoc-plugin/
[58]: https://github.com/exasol/error-code-crawler-maven-plugin
[8]: https://github.com/exasol/exasol-test-setup-abstraction-java
[10]: https://github.com/exasol/test-db-builder
1 change: 1 addition & 0 deletions doc/changes/changes_0.4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Code name:

* #15: Add API for host port proxy
* #26: Added support for exasol-test-setup-abstraction
* #20: Added module for JProfiler

## Refactoring:

Expand Down
45 changes: 15 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<junit.version>5.7.1</junit.version>
<junit.version>5.7.2</junit.version>
<junit.platform.version>1.7.1</junit.platform.version>
<vscommon.version>11.0.0</vscommon.version>
<gpg.skip>true</gpg.skip>
<jacoco.version>0.8.6</jacoco.version>
<org.testcontainers.version>1.15.2</org.testcontainers.version>
<jacoco.version>0.8.7</jacoco.version>
<org.testcontainers.version>1.15.3</org.testcontainers.version>
<surefire.and.failsafe.plugin.version>3.0.0-M4</surefire.and.failsafe.plugin.version>
</properties>
<licenses>
Expand Down Expand Up @@ -50,26 +50,6 @@
<developerConnection>scm:git:https://github.com/exasol/udf-debugging-java.git</developerConnection>
<url>https://github.com/exasol/udf-debugging-java/tree/master</url>
</scm>
<repositories>
<repository>
<id>maven.exasol.com</id>
<url>https://maven.exasol.com/artifactory/exasol-releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>maven.exasol.com-snapshots</id>
<url>https://maven.exasol.com/artifactory/exasol-snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax.json</groupId>
Expand All @@ -96,12 +76,17 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>bucketfs-java</artifactId>
<version>1.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.exasol</groupId>
<artifactId>exasol-test-setup-abstraction-java</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
</dependency>
<!-- test dependencies -->
<dependency>
Expand All @@ -119,7 +104,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.8.0</version>
<version>3.11.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -132,7 +117,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>exasol-testcontainers</artifactId>
<version>3.5.2</version>
<version>3.5.3</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -144,12 +129,12 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>test-db-builder-java</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
<version>1.7.31</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -369,7 +354,7 @@
<plugin>
<groupId>com.exasol</groupId>
<artifactId>project-keeper-maven-plugin</artifactId>
<version>0.9.0</version>
<version>0.10.0</version>
<executions>
<execution>
<goals>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/exasol/udfdebugging/UdfTestSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
import com.exasol.exasoltestsetup.ServiceAddress;
import com.exasol.udfdebugging.modules.coverage.CoverageModuleFactory;
import com.exasol.udfdebugging.modules.debugging.DebuggingModuleFactory;
import com.exasol.udfdebugging.modules.jprofiler.JProfilerModuleFactory;

/**
* Test setup for testing UDFs in the database.
*/
public class UdfTestSetup {
private static final List<ModuleFactory> AVAILABLE_MODULES = List.of(new DebuggingModuleFactory(),
new CoverageModuleFactory());
new CoverageModuleFactory(), new JProfilerModuleFactory());
private static final Logger LOGGER = LoggerFactory.getLogger(UdfTestSetup.class);
private final List<Module> enabledModules;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.exasol.udfdebugging.modules.coverage;

import java.io.FileNotFoundException;
import java.nio.file.Path;
import java.util.concurrent.TimeoutException;
import java.util.stream.Stream;
Expand Down Expand Up @@ -53,17 +54,10 @@ public Stream<String> getJvmOptions() {
private void uploadAgentToBucketFs(final Bucket bucket) {
try {
bucket.uploadFile(JACOCO_AGENT_PATH, JACOCO_AGENT_NAME);
} catch (final TimeoutException | BucketAccessException exception) {
throw getUploadFailedException(exception);
} catch (final InterruptedException exception) {
Thread.currentThread().interrupt();
throw getUploadFailedException(exception);
} catch (final TimeoutException | BucketAccessException | FileNotFoundException exception) {
throw new IllegalStateException(
ExaError.messageBuilder("E-UDJ-5").message("Failed to upload jacoco agent to BucketFS.").toString(),
exception);
}
}

private IllegalStateException getUploadFailedException(final Exception exception) {
return new IllegalStateException(
ExaError.messageBuilder("E-UDJ-5").message("Failed to upload jacoco agent to BucketFS.").toString(),
exception);
}
}
Loading

0 comments on commit f8ca745

Please sign in to comment.