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

Commit 87e3e82

Browse files
authored
add and parse the language field in repository.yaml (#2)
* add and parse the language field in repository.yaml * add sevice names in an array fields
1 parent e990e0d commit 87e3e82

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ services:
5151
- Discovery
5252
event_id: web
5353
event_organizer: dev-journeys
54+
language: python
5455
```
5556

5657
Required field:
@@ -60,6 +61,7 @@ Required field:
6061
3. services: Put down all the bluemix services that are used in your journey in a list.
6162
4. event_id: Put down where you will distribute your journey. Default is web.
6263
5. event_organizer: Put down your event organizer if you have one.
64+
6. language: If your journey is not in **python**, please put down the journey's main language in lower case.
6365

6466

6567
## Example app

metrics_tracker_client/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,18 @@ def track(tracker_url=None):
3232

3333
event = dict()
3434
event['date_sent'] = time.strftime("%Y-%m-%dT%H:%M:%S.000Z", time.gmtime())
35-
event['runtime'] = 'python'
3635
event['provider'] = 'others'
3736
try:
3837
event['space_id'] = getpass.getuser()
3938
except:
4039
pass
4140
journey_metric = metrics.getJson()
4241

42+
if (journey_metric is not None) and journey_metric.get("language"):
43+
event['runtime'] = journey_metric['language']
44+
else:
45+
event['runtime'] = 'python'
46+
4347
if env.get('VCAP_APPLICATION') is not None:
4448
vcap_app = json.loads(env['VCAP_APPLICATION'])
4549
if version is not None:
@@ -52,6 +56,7 @@ def track(tracker_url=None):
5256
event['space_id'] = str(vcap_app['space_id'])
5357
event['application_version'] = str(vcap_app['application_version'])
5458
event['application_uris'] = [str(uri) for uri in vcap_app['application_uris']]
59+
event['bound_services'] = []
5560
try:
5661
event['provider'] = str(vcap_app['cf_api'])
5762
except:
@@ -74,6 +79,8 @@ def track(tracker_url=None):
7479
for instance in vcap_services[service]:
7580
if 'plan' in instance.keys():
7681
event['bound_vcap_services'][service]['plans'].append(str(instance['plan']))
82+
if 'name' in instance.keys():
83+
event['bound_services'].append(str(instance['name']))
7784

7885
if len(event['bound_vcap_services'][service]['plans']) == 0:
7986
del event['bound_vcap_services'][service]['plans']
@@ -97,4 +104,3 @@ def DSX(metric=None):
97104
print ('Missing Github organization/repository name')
98105
else:
99106
metrics.DSXtrack(metric)
100-

repository.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# - Mainframe
1010
# - Swift on the Server
1111
# - Hyperledger Composer
12-
# - Hyperledger Fabric v1.0
12+
# - Data Science Experience
1313

1414
# services:
1515
# - IoT Platform
@@ -39,4 +39,6 @@
3939
# - Streaming Analytics for Bluemix
4040
# - Investment Portfolio
4141
# - Predictive Market Scenarios
42-
# - Simulated Instrument Analytics
42+
# - Simulated Instrument Analytics
43+
44+
# language: python

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
setup(
2222
name='metrics-tracker-client',
23-
version='1.0.9',
23+
version='1.1.1',
2424
description='Python client for the deployment tracker',
2525
long_description=long_description,
2626
url='https://github.com/IBM/metrics-collector-client-python',

0 commit comments

Comments
 (0)