How do I define tags with Cloud Foundry services?

Dynatrace automatically detects Cloud Foundry tags that are supplied via any user-provided Dynatrace Cloud Foundry service that’s bound to your application. This enables you to automatically organize and filter all monitored Cloud Foundry application components.

Please note, Cloud Foundry service-based tags work both in full-stack monitoring mode, where you use Dynatrace to monitor Cloud Foundry cluster components and applications and also when you leverage Dynatrace buildpack integrations for the monitoring of Cloud Foundry applications. However, Dynatrace buildpack integrations can currently only support a single service instance that uses the name dynatrace as a substring (see Limitations below for details).

Define Cloud Foundry service tags for multiple applications

To define Dynatrace tags, you can leverage one or more Cloud Foundry service instances that have the name dynatrace as a substring. For example:

cf cups dynatrace-tags -p "tag:pivotal, tag:region"

You’re prompted automatically to provide values for certain tags (for example, tag:region>eu-central-1). Dynatrace supports both Cloud Foundry labels and Cloud Foundry key-value tags. For example, the tag pivotal in the example above is used to label all applications running within a Pivotal Cloud Foundry environment&so this tag doesn’t include a value. The key-value tag region in the example holds the region of the AWS account that was used to deploy the Cloud Foundry environment.

You can easily update your user-provided Cloud Foundry services with new values (for example, tag:region>eu-west-2) or additional tags:

cf uups dynatrace-tags -p "tag:pivotal, tag:region, tag:newtag"

Please note, to exploit the service instance dynatrace-tags above, you must bind the instance to your application (for example, spring-music):

cf bs spring-music dynatrace-tags

Define tags for specific Cloud Foundry applications

Additionally, Dynatrace automatically detects tags that are provided via Cloud Foundry environment variables for applications:

cf set-env spring-music DT_TAGS "hotfix"

The example cf command above attaches the tag hotfix to all monitored processes that are related to the application spring-music.

Leverage Cloud Foundry tags in your Dynatrace environment

Cloud Foundry tags are searchable via Dynatrace search. This allows you to easily find and inspect the monitoring results of related processes that are running in your Cloud Foundry environment.

Cloud Foundry tags also integrate seamlessly with Dynatrace filters. For example, you can easily filter technologies or problems using Cloud Foundry tags. You can also leverage Cloud Foundry tags when setting up fine-grained alerting profiles.

Limitations

Dynatrace buildpack integrations currently only support the use of a single service instance with the name dynatrace as a substring. However, you can easily provide tags when creating this single service instance for Dynatrace:

cf cups dynatrace-service -p "environmentid, apitoken, tag:pivotal, tag:region"

If you already have a service instance for Dynatrace in place you can update it with new values or additional tags:

cf uups dynatrace-service -p "environmentid, apitoken, tag:pivotal, tag:region, tag:newtag"

For further details on creating a user-provided service for Dynatrace please see How do I monitor Cloud Foundry applications?