0.0.1 • Published 6 years ago
job-ad-statistics-api v0.0.1
job-ad-statistics-api
This is a simple Node API which allows consumers to fetch statistics for a job ad. It retrieves job ad statistics from the job-ad-statistics DynamoDB table.
Maintained by: Athena Team
Slack Channel: #athena
Known consumers:
- AdCentre - JobAdStatisticsApiBaseUri
- adv-ad-promotion-email-worker - jobStatsApiBaseUrl
- You?
Related Repo: Job Ad Statistics Worker

Table of contents
- Running the API locally
- Steps to Build and Deploy to AWS
- Consuming the API
- Dashboards, Monitoring and Alerting
- Logging
Running the API locally
Build & Test
npm run buildBuild & Publish Docker
./scripts/docker.sh [version] job-ad-statistics-apiPackage Elastic Beanstalk
./scripts/package.sh [version] [environment] [datadog key]Deploy
./scripts/deploy.sh [version] [environment]Smoke Test
npm run smokeDebug (dev environment)
cp dev.env .envnpm startSteps to Build and Deploy to AWS
Steps to build
- Add or adjust environment in
config/eb_deployer.yml
Teamcity
Teamcity builds are here
This requires Job Ad Statistics Infrastructure to be deployed into your AWS Account
For a new environment:
- Copy an existing build config.
- Change the
Environment Variables (env.)forenv.AWS_ACCESS_KEY_IDandenv.AWS_SECRET_ACCESS_KEY.
Consuming the API
Production URL (http only)
http://job-ad-statistics-api.advertiser.prod.outfra.xyzDev URL (http only)
http://job-ad-statistics-api.advertiser.dev.outfra.xyzEndpoint
There's only 1 available endpoint:
/jobs/:jobIdOptional query parameters
source- An identifier for you as a consumer, either repo name, team or product.
Request example
curl http://job-ad-statistics-api.advertiser.prod.outfra.xyz/jobs/87220?source=githubreadmeResponse example
{
"joblistingsviewed": {
"search": {
"standard": 100,
"premium": 10,
"standout": 30,
"jorapromoted": 20,
"promoted": 200
}
},
"jobid": 87220,
"jobdetailsviewed": {
"other": 20
},
"maxtimestamputc": "2016-03-21T03:57:58.9174938Z",
"batch": "20160517_0539",
"version": 1,
"applicationcompleted": {
"search": {
"standard": 0,
"premium": 0,
"standout": 0,
"jorapromoted": 0,
"promoted": 0
},
"other": 10
},
"searchresultselected": {
"search": {
"standard": 10,
"premium": 10,
"standout": 10,
"jorapromoted": 10,
"promoted": 20
}
}
}Dashboards, Monitoring and Alerting
Notifications (Slack)
All automated notifications get published on #athena.
Notifications include:
- API returning > 1100 404s in the last hour
Datadog
Dashboard
API health can be monitored using the dashboard
Monitors
Logging
Error Logs
All exception errors are logged in Job Ad Statistics API Raygun.
To add custom errors see Raygun Node.js Documentation
Request Logs
All requests are logged in CloudWatch
0.0.1
6 years ago