Introduction

On this page you will learn how to add, edit and delete a business metrics definition. The data for a business metric comes from a provider's API. Teevity supports 4 business metrics providers: New Relic, Amazon S3 Flat Files, Amazon CloudWatch Metrics and Google Analytics. To learn more about the feature and how to use those business metrics in reports, please consult this page (link to Google Docs).

Add, edit and delete a business metrics definition

The business metrics definitions are configured in the preferences page 1 under the section "Business Driven Cost Analytics" 2.

You can then see your current business metrics definitions, add a new one 1, edit and even duplicate an existing one 2). The rest of this document will describe the common parameters of a business metrics definiton and the ones specific to each provider.

Common parameters of a business metrics provider

A business metric definition has 5 required parameters regardless of the provider:

  • 1 a name
  • 2 a unit name to be displayed along the values in reports
  • 3 a currency symbol also to be displayed in reports
  • 4 a factored cost multiplicator. If your business metric volumetry is large, the multiplicator will make the cost factored easier to read. Example: instead of having a cost of 0.000005 per request, a cost of 0.05 per 1000 requests will be used.
  • 5 a provider, see the sections below for each provider specific parameters
common Business metric configuration

New Relic

Teevity is using the API v2 of New Relic to collect data.

  • 1 the New Relic API v2 key used to access your data
  • 2 the url of the API server which includes the id of your New Relic app
  • 3 the body of the request to specify the metrics and filters, for example names[]=EndUser&values[]=requests_per_minute&summarize=false
New Relic parameters

Amazon S3 Flat Files

Your business metrics data can come from a flat file where the metric is saved as a predefined format.

Metric files format and location

  • 1 Bucket name, example: appname-metrics
  • 2 Bucket prefix, example: teevity-metrics/businessMetrics_impressions-. The filename suffix shoud be YYYY-MM. The file full name businessMetrics_impressions-2017-12
  • 3 Bucket S3 Region, example: us-east-1

Metrics file content

The file content must be a series of values separated by a comma (,). The first value in the file is for the first hour of the month. When values are missing, you can just type two consecutive commas. You don't have to provide all the values for the hours of the month if it's not over yet (i.e., if we are mid-month, there will only be approximately 15*24 values in the file). A file example is available here.

Access Control to your AWS environment

Regardless of the method described below, you can optionally declare a role to assume for the access to the S3 bucket, if so you will need to enter the id of the account where the role TeevityPollerRole_BusinessMetrics resides5.

If you use the method based on an IAM User, you can enter the Access Key and Secret Key of the user 4

S3 Bucket parameters

Or if you use an "IAM Cross Account External Trust Relationship", you will have to enter the id of the account where the role TeevityCrossAccountTrustRole resides 1. You will need also the External id provided 2

cross account trust relationship method

You can use this AWS CLI based script to configure the access control if you choose the method "IAM Cross Account External Trust Relationship".

Amazon CloudWatch Metrics

You can use the metrics generated by Amazon CloudWatch like the number of requests of an Elastic Load Balancer, an API Gateway or traffic etc.

  • 1 and 2 the credentials to access the Amazon CloudWatch metrics API
  • 3 the metric name, for example RequestCount for an AWS ELB
  • 4 the metric namespace, AWS/ApplicationELB in our ELB example
  • 5 the metric statistic, Sum for example
Amazon CloudWatch metrics parameter

Google Analytics

To use Google Analytics as a business metric provider you will need to link your account to Teevity and set the Id of the View report.

Using OAuth to give access to your Google Analytics data

1 First you will need to give a name to the accout you are going to link.

name of the google analytics account

2 Then an url will be generated. Copy and paste it somewhere, you will need it for the next step.

url for the consent of the google analytics account

3 Go to your Google Cloud Console and create or use an existing project. And then go to the credentials section of the project.

create OAuth credentials

4 Create new credentials and choose "OAuth client ID".

create OAuth credentials

5 Choose "Web application" as application type,. Enter a name and https://cloudcost-app.teevity.com as the "Authorized Javascript origins" 6 and finally the url copied from the previous step in the "Authorized redirect URIs" field 7. Click on "Create".

settings for the OAuth credentials

8 On the details page of the credentials you have just created, click on the "Download json" button

download json file

9 Open the json file with a text editor and copy-paste the entire content in the text aera of 10 the business metrics definition page.

copy and paste json file
paste crendentials settings

Click next and open the link 11 as requested by the instructions.

last step

Give your consent 12.

Give consent

You will be redirected to the homepage of the Teevity website, the process has sucessfully finished, your Google Analytics account is now linked.

Configure the Google Analytics provider

You just have to give the ViewID from Google Analytics 12.

Bset view id of the google analytics account

Advanced Mode

We also provide an advanced mode where you can edit the configuration of your business metric definitions direcly in a json format. You can switch between the normal and advanced modes by clicking the cog button 1

advanced mode

The json editor will display a red indicator if an error is detected in the content of the configuration 2. When you have finished editing the configuration, click on the cog button to return to the basic mode 1 and then click on the "apply modifications" button to save your modifications.

Use the business metrics in your reports

When you consult your cloud spending in the Dynamic Cost Explorer, you can select a business metrics to corrolate:

advanced mode

advanced mode

Then if you click on the submit button, the business metrics and the cost factored (here per 1000 requests) will be displayed:

advanced mode