Skip to content

AnthonyBloomer/github-traffic-insights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

github-traffic-insights

Lambda function to send your Github traffic statistics to New Relic Insights.

For repositories that you have push access to within Github, the Github traffic API provides access to the information provided in the graphs section of the repositories UI.

This information includes referral sources, referral paths, views and clones. The API returns data over the past 14 day period. As the API only returns data over the past 14 day period, this solution aims to give users access to historical Traffic data for their Github repositories within Insights. This Lambda function calls each endpoint every 15 days and creates custom events that you can then query and create visualations within New Relic Insights.

See the New Relic One Dashboard below:

Image

How it works

The function uses Github's token based API authentication to gain access to the user's repository data. For each of the users repostories, the script makes a call to each Traffic API endpoint and records a custom event using the Event API if there has been any Traffic data reported.

Setup

Clone the repository: git clone https://github.com/AnthonyBloomer/github-traffic-insights.git

Update the following environment variables in the template.yml file:

Deploy using the AWS CLI:

aws cloudformation deploy --template template.yml --stack-name github

Sample Dashboard

The project also includes the sample dashboard JSON shown above which you can import into your New Relic account using the Dashboards API.