Deploy OneAgent on IBM Cloud Foundry for application-only monitoring

IBM Cloud Foundry provides a Platform as a Service (PaaS) solution that's based on open source Cloud Foundry technology.

Applications deployed on IBM Cloud Foundry (formerly Bluemix) are usually run through technology-specific and IBM-related buildpacks that provide framework and runtime support for applications running on the platform. For example, to run Java applications on IBM Cloud Foundry, typically the IBM WebSphere Liberty buildpack is used rather than the normal Java buildpack.

The following guidelines apply to integration with the supported Cloud Foundry buildpacks.

Before you begin

You'll need to

Generate PaaS token

The first step is to get your environment ID and PaaS token for your Dynatrace environment.

Create a Dynatrace service in your IBM Cloud Foundry environment

Cloud Foundry (and therefore also IBM Cloud Foundry) allows you to connect applications with 3rd party tools and other external resources (for example, databases) by means of services. On Cloud Foundry, service instances hold the credentials that are required to connect to such resources. You'll use this same approach to connect your apps with OneAgent.This is why you need to define a service instance by either creating a so-called "user-provided service" or by using a service broker application. To create a Dynatrace service in your Cloud Foundry environment, select one of the following options:

Bind Dynatrace service to your application

You can either bind the created Dynatrace service to your application in your manifest.yml file prior to starting your app or you can bind the service to your app and restage the app afterwards.

If you're pushing a Java application, the result may resemble the following example. If you're deploying to IBM Cloud Foundry, be sure to accept IBM licenses by setting the proper environment variables. For details, please refer to the buildpack readme.

---
applications:
- name: demo-helloworld
  path: target/JavaHelloWorldApp.war
  buildpack: https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack.git
  memory: 512M
  instances: 1
  host: hello-world-${random-word}
  disk_quota: 1024M
services:
  - dynatrace-service
env:
  IBM_LIBERTY_LICENSE: <liberty-license-key>
  IBM_JVM_LICENSE: <jvm-license-key>

Configure the default OneAgent log stream for Cloud Foundry (optional)

By default, OneAgent logs are written to the Cloud Foundry standard error stream. With OneAgent version 1.125 or later, you can configure the default OneAgent log stream for applications deployed in your IBM Cloud Foundry environment. All you have to do is set the environment variable DT_LOGSTREAM to either stdout or stderr.

For example:

cf set-env APP_NAME DT_LOGSTREAM stdout