Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

Commit

Permalink
add and parse the language field in repository.yaml (#4)
Browse files Browse the repository at this point in the history
* add and parse the language field in repository.yaml

* add service names in array

* fix minor bug
  • Loading branch information
Tomcli authored Oct 20, 2017
1 parent 8654912 commit e22ebf7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ services:
- Discovery
event_id: web
event_organizer: dev-journeys
language: nodejs
```

Required field:
Expand All @@ -40,15 +41,17 @@ Required field:
3. services: Put down all the bluemix services that are used in your journey in a list.
4. event_id: Put down where you will distribute your journey. Default is **web**.
5. event_organizer: Put down your event organizer if you have one.
6. language: If your journey is not in **nodejs**, please put down the journey's main language in lower case.

# List of runtimes and services
# List of runtimes, services, and languages

Runtimes

- Kubernetes Cluster
- Cloud Foundry
- OpenWhisk
- Mainframe
- Data Science Experience

Services

Expand All @@ -70,6 +73,22 @@ Services
- Compose for MySQL
- Compose for PostgreSQL

Languages

- nodejs
- python
- swift
- java
- go
- javascript
- php
- c/c++
- c#
- objective-c
- r
- scala
- shell

# Example app

To see how to include this into your app please visit [Watson Multimedia Analyzer](https://github.com/IBM/watson-multimedia-analyzer). You will want to pay attention to [package.json](https://github.com/IBM/watson-multimedia-analyzer/blob/master/package.json#L27), and [app.js](https://github.com/IBM/watson-multimedia-analyzer/blob/master/app.js#L39).
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metrics-tracker-client",
"version": "0.2.0",
"version": "0.2.3",
"private": false,
"main": "tracker.js",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion repository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# - Mainframe
# - Swift on the Server
# - Hyperledger Composer
# - Hyperledger Fabric v1.0
# - Data Science Experience

# services:
# - IoT Platform
Expand Down Expand Up @@ -40,3 +40,5 @@
# - Investment Portfolio
# - Predictive Market Scenarios
# - Simulated Instrument Analytics

# language: nodejs
13 changes: 11 additions & 2 deletions tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ function track() {
date_sent: new Date().toJSON()
};

event.runtime = 'nodejs';
if(journey_metric!=null && journey_metric.language){
event.runtime = journey_metric.language;
}else{
event.runtime = 'nodejs';
}

try{
event.space_id = os.userInfo().username
}catch(ex){
Expand Down Expand Up @@ -64,6 +69,7 @@ function track() {
if (vcapApplication.cf_api) {
event.provider = vcapApplication.cf_api;
}
event.bound_services = [];
if (process.env.VCAP_SERVICES) {
// refer to http://docs.cloudfoundry.org/devguide/deploy-apps/environment-variable.html#VCAP-SERVICES
vcapServices = JSON.parse(process.env.VCAP_SERVICES);
Expand All @@ -79,6 +85,9 @@ function track() {
if(serviceInstance.hasOwnProperty('plan')) {
event.bound_vcap_services[service_label].plans.push(serviceInstance.plan);
}
if(serviceInstance.hasOwnProperty('name')) {
event.bound_services.push(serviceInstance.name);
}
});

// Keep plans property only if at least one plan is associated with this service
Expand All @@ -101,4 +110,4 @@ function track() {
});
}

module.exports.track = track;
module.exports.track = track;

0 comments on commit e22ebf7

Please sign in to comment.