Skip to content

Commit

Permalink
Merge pull request #61 from telefonicaid/task/common_metrics_api
Browse files Browse the repository at this point in the history
Task/common metrics api
  • Loading branch information
dmoranj authored Jan 26, 2017
2 parents 729de4b + add27e2 commit 0028ae4
Show file tree
Hide file tree
Showing 50 changed files with 1,309 additions and 303 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ CHANGES

1.5.0

FEATURE: Support keystone groups in a Service, including role assignments
FEATURE: Metrics API [#58]
FEATURE: Support keystone groups in a Service, including role assignments [#56]


1.4.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A tipical scenario for IoT Platform can be [scenario_test](https://pdihub.hi.ine
- Assign/unassign roles to users in a service
- Create/List Trust Tokens
- Activate / deactivate IoT Modules
- Retrieve statistics about API usage
- Retrieve statistics and metrics about API usage

Orchestrator is based mainly on:
- Python
Expand Down
80 changes: 80 additions & 0 deletions apiary.apib
Original file line number Diff line number Diff line change
Expand Up @@ -977,3 +977,83 @@ In the cases where "serviceId" is part of URL "SERVICE_NAME" field at body can b
{
"level": "DEBUG"
}

## Metrics [/v1.0/admin/metrics]

The following metrics are collected by the component:
+ incomingTransactions: number of requests consumed by the component.
+ incomingTransactionRequestSize: total size (bytes) in requests associated to incoming transactions
+ incomingTransactionResponseSize: total size (bytes) in responses associated to incoming transactions
+ incomingTransacionError: number of incoming transactions resulting in error.
+ serviceTime: average time to serve a transaction.

### Get current metrics [GET]

+ Parameters
+ reset (optional, `string`) ... ["true", "false"]
+ Response 200 (application/json)
+ Body
{
"service": {
"service1": {
"subservs": {
"subserv1": {},
"subserv2": {}
},
"sum": {}
},
"service2": {
"subservs": {
"subserv1": {},
"subserv2": {}
},
"sum": {}
}
},
"sum": {
"incomingTransactions": 25,
"incomingTransactionRequestSize": 3456,
"incomingTransactionResponseSize": 435,
"incomingTransacionError": 2,
"serviceTime": 0.48,
"outgoingTransactions": 46,
"outgoingTransactionRequestSize": 323361,
"outgoingTransactionResponseSize": 2343,
"outgoingTransacionError": 10
}
}


### Reset current metrics [DELETE]
+ Parameters
+ Response 204 (application/json)
+ Body
{
"service": {
"service1": {
"subservs": {
"subserv1": {},
"subserv2": {}
},
"sum": {}
},
"service2": {
"subservs": {
"subserv1": {},
"subserv2": {}
},
"sum": {}
}
},
"sum": {
"incomingTransactions": 25,
"incomingTransactionRequestSize": 3456,
"incomingTransactionResponseSize": 435,
"incomingTransacionError": 2,
"serviceTime": 0.48,
"outgoingTransactions": 46,
"outgoingTransactionRequestSize": 323361,
"outgoingTransactionResponseSize": 2343,
"outgoingTransacionError": 10
}
}
4 changes: 3 additions & 1 deletion src/orchestrator/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
SubServiceIoTAService_RESTView,
IOTModuleActivation_RESTView,
OrchVersion_RESTView,
OrchLogLevel_RESTView
OrchLogLevel_RESTView,
OrchMetrics_RESTView
)


Expand All @@ -69,4 +70,5 @@
url(r'^service/(?P<service_id>\w+)/trust[/]?$', Trust_RESTView.as_view(), name='new_trust_rest_view'),
url(r'^version[/]?$', OrchVersion_RESTView.as_view(), name='orch_version_rest_view'),
url(r'^admin/log?$', OrchLogLevel_RESTView.as_view(), name='orch_loglevel_rest_view'),
url(r'^admin/metrics?$', OrchMetrics_RESTView.as_view(), name='orch_metrics_rest_view'),
)
Loading

0 comments on commit 0028ae4

Please sign in to comment.