This add-on is operated by Hallin Information Technology AB
Codekvast detects Truly Dead Code in your app
Last updated 18 May 2018
This is a draft article - the text and URL may change in the future. This article is unlisted. Only those with the link can access it.
The Codekvast add-on is currently in beta.
Table of Contents
Codekvast is an add-on for detecting Truly Dead Code in your app.
By “Truly Dead Code”, we mean code in your production app that has not executed for a significant period of time.
Continuously detecting and removing dead code from your app provides the following benefits:
- Shorter development cycles
- Reduced technical debt
- Reduced risk for security exploits
- Faster developer onboarding
Codekvast requires minimal changes to your application. It is currently available for Java (Java 7 or higher).
Install the Codekvast add-on
Codekvast can be attached to a Heroku application via the CLI:
A list of all available plans can be found here.
$ heroku addons:create codekvast -----> Adding codekvast to sharp-mountain-4005... done, v18 (free)
Installing the add-on automatically creates a private Codekvast account connected to your Heroku account. You can access your Codekvast account from your app’s Add-ons list in the Heroku Dashboard.
After you provision Codekvast, the
CODEKVAST_LICENSE_KEY config vars are available in your app’s configuration. They contain information for accessing the newly provisioned Codekvast service instance. You can confirm this via the
heroku config:get command:
$ heroku config:get CODEKVAST_URL https://api.codekvast.io/
After you attach Codekvast to your app, you’ll need to configure it.
Configure your Codekvast javaagent
Download codekvast-agent-0.24.0.zip and unzip it into your project’s root directory. The ZIP file includes a sample
codekvast.conffile, as well as a
codekvast/directory that contains the Java agent.
codekvast.confto suit your app’s needs. Do not change the
licenseKeyvalues, because they are injected from your Heroku environment.
Full documentation for the
codekvast.conffile is available at http://www.codekvast.io/pages/config.html.
Update your app’s
JAVA_OPTSconfig var to include the javaagent:
heroku config:set JAVA_OPTS="-javaagent:/app/codekvast/codekvast-javaagent-0.24.0.jar"
Using Codekvast with Gradle
spring-boot-gradle-plugin to build an executable JAR file is supported.
See Codekvast Config to learn how to use Codekvast with
The standard standard Gradle
application plugin is also supported.
A sample application that illustrates how to use
codekvast-agent with the
application plugin is available on Github.
The sample application also illustrates how to download
codekvast-javaagent via Gradle’s dependency mechanism.
Using Codekvast with Java/Maven
spring-boot-maven-plugin to build an executable JAR file is supported.
See Codekvast Config to learn how to use Codekvast with
After you install the add-on and configure the Codekvast java agent, you can test locally that everything works as expected, and that data collection is taking place.
It’s necessary to locally replicate the add-on’s config vars so your development environment can operate against the service.
Use the Heroku Local command-line tool to configure, run and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a
.env file. To view all of your app’s config vars, type
heroku config. Use the following command for each value that you want to add to your
heroku config:get CODEKVAST_URL -s >> .env heroku config:get CODEKVAST_LICENSE_KEY -s >> .env heroku config:get JAVA_OPTS -s >> .env
Warning Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the
echo .env >> .gitignore.
For more information, see the Heroku Local article.
Monitoring and logging
You can monitor Codekvast activity within the Heroku log-stream by running the following command:
$ heroku logs -t | grep -i codekvast
You should see the string
Codekvast uploaded within a few minutes after the application starts if the integration is working correctly.
After the initial upload, Codekvast will upload data according to your selected plan.
For more information on features available in the Codekvast dashboard, please see the documentation at www.codekvast.io.
The Codekvast dashboard allows you to browse your collected usage data.
You can access the dashboard via the CLI:
$ heroku addons:open codekvast Opening codekvast for sharp-mountain-4005
or by visiting the Heroku Dashboard and selecting the application in question. Select Codekvast from the Add-ons menu.
Migrating between plans
heroku addons:upgrade command to migrate to a new plan.
$ heroku addons:upgrade codekvast:newplan -----> Upgrading codekvast:newplan to sharp-mountain-4005... done, v18 ($49/mo) Your plan has been updated to: codekvast:newplan
Note Migrating from a shared plan to a dedicated plan will destroy your collected data and cannot be undone!
Uninstalling the Codekvast add-on
Use the following procedure for uninstalling the Codekvast add-on:
codekvast.conffrom your project root.
- Revert the changes to your build system, or run
heroku config:unset JAVA_OPTS
git push heroku master
Then deprovision the Codekvast service via the CLI:
Warning This will destroy all collected data and cannot be undone!
$ heroku addons:destroy codekvast -----> Removing codekvast from sharp-mountain-4005... done, v20 (free)
All Codekvast support and runtime issues should be submitted via one of the Heroku Support channels.
Any non-support related issues or product feedback is welcome at https://github.com/crispab/codekvast/issues.
There is also a Slack team for Codekvast. Send an email to email@example.com for an invitation.