MartinGoodwell / UserSessionExport

Starts a demo application, a load generator, and an instance with Elasticsearch and Kibana, where user sessions from Dynatrace can be exported to, in AWS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

UserSessionExport

Starts the demo application Sock Shop, a load generator using CasperJS, and an instance with Elasticsearch and Kibana, where user session can be exported to, in AWS. Find an accompanying blog article about Dynatrace user session export here.

Overview

Testbed overview

Prerequisites

  • Make sure you have HashiCorps Terraform installed
  • Have your Dynatrace SaaS (Free trial) environment ID and API token ready (learn more here)
  • Have your AWS credentials and an AWS EC2 keypair ready (learn more here)

Instructions

1. Clone the repository

$ git clone https://github.com/dynatrace-innovationlab/UserSessionExport
$ cd UserSessionExport

2. Provide AWS access

Provide your AWS credentials in a Shared credentials file so Terraform can use it.

$ cat ~/.aws/credentials
[default]
aws_access_key_id=<AWS_ACCES_KEY_ID>
aws_secret_access_key=<AWS_SECRET_ACCESS_KEY>

3. Provide AWS and Dynatrace data

Provide AWS region, the AWS keypair name, the Dynatrace environment ID, Dynatrace API token, and the path to the private key file (e.g. "~/.ssh/key.pem") in terraform/vars.tf. Adapt the recommended AWS instance flavors, if needed.

4. Run Terraform

$ pwd
~/UserSessionExport/terraform
$ terraform init
... (output emitted) ...
$ terraform plan
... (output emitted) ...
$ terraform apply
...
Apply complete! Resources: x added, x changed, x destroyed.

Outputs:

Elastic/Kibana = <PRIVATE_IP>/<PUBLIC_IP>
Load Generator = <PRIVATE_IP>/<PUBLIC_IP>
Sock Shop = <PRIVATE_IP>/<PUBLIC_IP>

5. Finalize Dynatrace configuration

  • In Dynatrace you should see an Application with steady load and user sessions.
  • Follow the instructions here to enable the user session export to Elasticsearch in Dynatrace.

6. Check that there is user session data in Kibana

  • You need to create an index pattern in Kibana to be able to browse the data. The index to which data is sent has been configured in step 5.

User sessions in Kibana

7. Stop demo environment In order to shutdown the demo environment and get rid of all created artefacts you need to manually remove the created AMIs and execute the following Terraform command.

$ pwd
~/TestBed-UserSessionExport/terraform
$ terraform destroy

8. Execute tests

Prerequisites:

  • Make sure you have Ruby installed
  • As in step 3, provide the path to the private key file (e.g. "~/.ssh/key.pem") in terraform/.kitchen.yml
$ pwd
~/UserSessionExport/terraform
$ gem install bundler
... (output omitted) ...
$ bundle install
... (output omitted) ...

// setup test environment using kitchen-terraform
$ bundle exec kitchen converge
... (output omitted) ...

// run tests against said environment (can be repeated several times)
$ bundle exec kitchen verify
... (output omitted) ...

// destroy test environment
$ bundle exec kitchen destroy

About

Starts a demo application, a load generator, and an instance with Elasticsearch and Kibana, where user sessions from Dynatrace can be exported to, in AWS.

License:Apache License 2.0


Languages

Language:HCL 59.0%Language:Ruby 30.6%Language:JavaScript 7.5%Language:Shell 2.8%