Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/common metrics api #61

Merged
merged 20 commits into from
Jan 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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