exasol / udf-debugging-java

Utilities for debugging, profiling and code coverage measure for UDFs.
MIT License
1 stars 1 forks source link
code-coverage debugging exasol exasol-integration java profiling udf user-defined-function virtual-schema

UDF Debugging Tools for Java

Build Status Maven Central – udf-debugging-java

Quality Gate Status

Security Rating Reliability Rating Maintainability Rating Technical Debt

Code Smells Coverage Duplicated Lines (%) Lines of Code

This repository contains tools for debugging UDFs.

Installation

Install as maven dependency. You can get the dependency declaration by clicking the maven badge above.

Typical Usage

Typically, you use this package together with test-db-builder-java and exasol-testcontainers as follows:


private static final ExasolContainer<?extends ExasolContainer<?>> EXASOL=new ExasolContainer<>();
final UdfTestSetup udfTestSetup=new UdfTestSetup(getTestHostIp(),EXASOL.getDefaultBucket());
final ExasolObjectFactory testDbBuilder=new ExasolObjectFactory(EXASOL.createConnection(),
        ExasolObjectConfiguration.builder().withJvmOptions(udfTestSetup.getJvmOptions()).build());

Modules

This package contains multiple modules that you can enable on runtime by setting the corresponding system property to true. Typically, you do so by appending -D<PROPERTY_NAME>="true" to your JVM call.

Debugging

System property: test.debug

This module instructs the UDF JVMs to connect to a Java debugger listening on the default port 8000 on you machine, running the tests.

Code Coverage

System property: test.coverage

This module installs a jacoco agent to the UDF JVM and receives the execution data using a TCP socket.

This module requires additional maven configuration. Use project-keeper module udf_coverage to verify it.

Please note that using a JaCoCo agent fails when running on Windows using a Docker image in a Linux virtual machine, see known issue Failing Integration Tests on Windows.

JProfiler

System property: test.jprofiler

This module allows you to profile UDF runs using JProfiler. 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

UDF Logs

System property: test.udf-logs

This module redirects the STDOUT from UDFs to files on the test host.

You can find the logs in target/udf-logs/. For each incoming stream (UDF instance) this module creates one file and logs its name:

Created log file for UDF output: target/udf-logs/udf-log-2023-07-05T10:49:09.316547Z-576983159368731727.log

Known Issue: Failing Integration Tests on Windows

Please note that integration tests fail when running on Windows using a Docker image in a Linux virtual machine due to JaCoCo agent obtaining the Code Coverage in the UDF.

Steps to reproduce

Known workarounds

Additional Information