Dynatrace Automation Plugin

Dynatrace plugin for Maven

License

License

Categories

Categories

Maven Build Tools Dynatrace Application Testing & Monitoring Application Performance Monitoring (APM) Auto Application Layer Libs Code Generators
GroupId

GroupId

com.dynatrace.diagnostics.automation
ArtifactId

ArtifactId

dynatrace-maven-plugin
Last Version

Last Version

7.0.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Dynatrace Automation Plugin
Dynatrace plugin for Maven
Project URL

Project URL

https://github.com/Dynatrace/Dynatrace-Maven-Plugin
Source Code Management

Source Code Management

https://github.com/Dynatrace/Dynatrace-Maven-Plugin

Download dynatrace-maven-plugin

How to add to project

<plugin>
    <groupId>com.dynatrace.diagnostics.automation</groupId>
    <artifactId>dynatrace-maven-plugin</artifactId>
    <version>7.0.0</version>
</plugin>

Dependencies

compile (1)

Group / Artifact Type Version
com.dynatrace.sdk : server-rest-sdk jar 7.0.0

provided (5)

Group / Artifact Type Version
org.apache.httpcomponents : httpclient jar 4.5.2
org.apache.maven : maven-core jar 3.2.5
org.apache.maven : maven-artifact jar 3.2.5
org.apache.maven : maven-compat jar 3.2.5
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

test (5)

Group / Artifact Type Version
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 3.3.0
junit : junit jar 4.11
org.mockito : mockito-core jar 1.10.19
org.powermock : powermock-module-junit4 jar 1.6.2
org.powermock : powermock-api-mockito jar 1.6.2

Project Modules

There are no modules declared in this project.

Dynatrace Maven Plugin Build Status

The automation plugin enables FULL Automation of Dynatrace by leveraging the REST interfaces of the Dynatrace AppMon Server. The automation plugin includes Maven goals to execute the following actions on the Dynatrace AppMon Server:

  • Activate Configuration: Activates a configuration within a system profile
  • Enable/Disable Profile
  • Stop/Restart Server
  • Start/Stop Session Recording: Returns the actual recorded session URI
  • Start/Stop Test: Start returns testrun id, allowing to inject it into Dynatrace agent parameters and use to finish test

Table of Contents

Installation

Prerequisites

  • Dynatrace Application Monitoring version: 7+ (builds that support older AppMon releases can be found on the Releases page)
  • Maven 3+

Manual Installation

Plugin library is available in maven central repository (starting with version 7.0.0).

  • Define properties for the Dynatrace goals as shown in pom.xml from the sample package
  • Invoke your maven goals, e.g.: mvn com.dynatrace.diagnostics.automation:dynatrace-maven-plugin:startRecording

The Dynatrace maven plugin has the following identification: (pluginGroupId:pluginArtifactId:pluginVersion): mvn com.dynatrace.diagnostics.automation:dynatrace-maven-plugin:7.0.0

Building

In order to build the plugin, Maven environment is needed to be configured in your system. Then you should be able to build and install package by executing mvn install. Jar file should be available in target folder

Configuration

A full example can be seen in the pom.xml as part of the project available in examples folder.

Using plugin properties:

<properties>
  <!-- Setting default values for Dynatrace Maven goals that operate on a system profile -->
  <dynaTrace.username>admin</dynaTrace.username>
  <dynaTrace.password>admin</dynaTrace.password>
  <dynaTrace.serverUrl>http://localhost:8020</dynaTrace.serverUrl>
  <dynaTrace.systemProfile>GoSpace</dynaTrace.systemProfile>

  <!-- This property will be used to store the session uri for e.g.: Start/Stop Recording -->
  <dynaTrace.sessionUriProperty>dynaTrace.sessionUri</dynaTrace.sessionUriProperty>

  <!-- Following is a list of properties for goal: startRecording -->
  <dynaTrace.sessionName>My Stored Session</dynaTrace.sessionName>
  <dynaTrace.sessionDescription>My stored Session Description</dynaTrace.sessionDescription>
  <dynaTrace.recordingOption>all</dynaTrace.recordingOption> <!-- other options: violations|timeseries -->
  <dynaTrace.sessionLocked>false</dynaTrace.sessionLocked>
  <dynaTrace.appendTimestamp>false</dynaTrace.appendTimestamp>
</properties>

Now we can call the startRecording goal in the following way: mvn com.dynatrace.diagnostics.automation:dynatrace-maven-plugin:startRecording

You can inject the Dynatrace agent as part of surefire unit testing in Maven pom.xml with settings similar to this:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<argLine>-agentpath:"C:\Program Files\dynaTrace\dynaTrace 6.5.0\agent\lib\dtagent.dll"=name=Maven,server=localhost:9998</argLine>
</configuration>
</plugin>

Available Maven goals

Description of Available Maven Tasks

Server Management

  • enableProfile - Enables or disables a System Profile
  • activateConfiguration - Activates a Configuration of a System Profile
  • restartServer - Restarts a dynaTrace Server

Session Management

  • startRecording - Starts session recording for a specified system profile
  • stopRecording - Stops session recording for a specified system profile

Test Management

  • startTest - Sets meta data information for the Test Automation Feature and provides the DtStartTest.testRunId necessary to support parallel builds. The DtStartTest.testRunId value needs to be passed to the agent instrumenting the JVM that's executing the tests.
  • finishTest - Sets test status of test run to finished. Explicit test run can be marked as finished using dynaTrace.testRunId, if this property is not set then testRunId generated by preceding startTest goal will be used.

Additional Resources

Previous versions:

com.dynatrace.diagnostics.automation

Dynatrace

Dynatrace

Versions

Version
7.0.0