mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
[Feature] Function status
This commit is contained in:
@@ -86,7 +86,7 @@ curl -H "Content-Type: application/json" -X POST -d '{
|
||||
"config": {
|
||||
"key": "value",
|
||||
"key2": "value2",
|
||||
"keyN": "valueN",
|
||||
"keyN": "valueN"
|
||||
},
|
||||
"headers": {
|
||||
"content-type": [
|
||||
@@ -148,6 +148,98 @@ To define the function execution as `hot function` you set it as one of the foll
|
||||
|
||||
This properties are only used if the function is in `hot function` mode
|
||||
|
||||
#### max_concurrency (string)
|
||||
|
||||
This property defines the maximum amount of concurrent hot functions instances the function should have (per Oracle Functions node).
|
||||
## Calls and their statuses
|
||||
|
||||
### Sync/Async Call statuses
|
||||
|
||||
With each function call, no matter would that be sync or async server makes a record of this it.
|
||||
While execution async function server returns `call_id`:
|
||||
|
||||
```json
|
||||
{
|
||||
"call_id": "f5621e8b-725a-4ba9-8323-b8cdc02ce37e"
|
||||
}
|
||||
```
|
||||
that can be used to track call status using following command:
|
||||
|
||||
```sh
|
||||
|
||||
curl -v -X GET ${API_URL}/v1/calls/f5621e8b-725a-4ba9-8323-b8cdc02ce37
|
||||
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "Successfully loaded call",
|
||||
"call": {
|
||||
"id": "f5621e8b-725a-4ba9-8323-b8cdc02ce37e",
|
||||
"status": "success",
|
||||
"completed_at": "2017-06-02T15:31:30.887+03:00",
|
||||
"created_at": "2017-06-02T15:31:30.597+03:00",
|
||||
"started_at": "2017-06-02T15:31:30.597+03:00",
|
||||
"app_name": "newapp",
|
||||
"path": "/envsync"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Server response contains timestamps(created, started, completed) and execution status for this call.
|
||||
|
||||
For sync call `call_id` can be retrieved from HTTP headers:
|
||||
```sh
|
||||
curl -v localhost:8080/r/newapp/envsync
|
||||
* Trying ::1...
|
||||
* TCP_NODELAY set
|
||||
* Connected to localhost (::1) port 8080 (#0)
|
||||
> GET /r/newapp/envsync HTTP/1.1
|
||||
> Host: localhost:8080
|
||||
> User-Agent: curl/7.51.0
|
||||
> Accept: */*
|
||||
>
|
||||
< HTTP/1.1 200 OK
|
||||
< Fn_call_id: f5621e8b-725a-4ba9-8323-b8cdc02ce37e
|
||||
< Date: Fri, 02 Jun 2017 12:31:30 GMT
|
||||
< Content-Length: 489
|
||||
< Content-Type: text/plain; charset=utf-8
|
||||
<
|
||||
...
|
||||
```
|
||||
Corresponding HTTP header is `Fn_call_id`.
|
||||
|
||||
### Per-route calls
|
||||
|
||||
In order get list of per-route calls please use following command:
|
||||
|
||||
```sh
|
||||
curl -X GET ${API_URL}/v1/app/{app}/calls/{route}
|
||||
|
||||
```
|
||||
Server will replay with following JSON response:
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "Successfully listed calls",
|
||||
"calls": [
|
||||
{
|
||||
"id": "80b12325-4c0c-5fc1-b7d3-dccf234b48fc",
|
||||
"status": "success",
|
||||
"completed_at": "2017-06-02T15:31:22.976+03:00",
|
||||
"created_at": "2017-06-02T15:31:22.691+03:00",
|
||||
"started_at": "2017-06-02T15:31:22.691+03:00",
|
||||
"app_name": "newapp",
|
||||
"path": "/envsync"
|
||||
},
|
||||
{
|
||||
"id": "beec888b-3868-59e3-878d-281f6b6f0cbc",
|
||||
"status": "success",
|
||||
"completed_at": "2017-06-02T15:31:30.887+03:00",
|
||||
"created_at": "2017-06-02T15:31:30.597+03:00",
|
||||
"started_at": "2017-06-02T15:31:30.597+03:00",
|
||||
"app_name": "newapp",
|
||||
"path": "/envsync"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
113
docs/swagger.yml
113
docs/swagger.yml
@@ -6,7 +6,7 @@ swagger: '2.0'
|
||||
info:
|
||||
title: Oracle Functions
|
||||
description: The open source serverless platform.
|
||||
version: "0.1.29"
|
||||
version: "0.1.30"
|
||||
# the domain of the service
|
||||
host: "127.0.0.1:8080"
|
||||
# array of all schemes that your API supports
|
||||
@@ -317,6 +317,55 @@ paths:
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
|
||||
/calls/{call}:
|
||||
get:
|
||||
summary: Get call information
|
||||
description: Get call information
|
||||
tags:
|
||||
- Call
|
||||
parameters:
|
||||
- name: call
|
||||
description: Call ID.
|
||||
required: true
|
||||
type: string
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: Call found
|
||||
schema:
|
||||
$ref: '#/definitions/CallWrapper'
|
||||
404:
|
||||
description: Call not found.
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
|
||||
/apps/{app}/calls/{route}:
|
||||
get:
|
||||
summary: Get route-bound calls.
|
||||
description: Get route-bound calls.
|
||||
tags:
|
||||
- Call
|
||||
parameters:
|
||||
- name: app
|
||||
description: App name.
|
||||
required: true
|
||||
type: string
|
||||
in: path
|
||||
- name: route
|
||||
description: App route.
|
||||
required: true
|
||||
type: string
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: Calls found
|
||||
schema:
|
||||
$ref: '#/definitions/CallsWrapper'
|
||||
404:
|
||||
description: Calls not found.
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
|
||||
/tasks:
|
||||
get:
|
||||
summary: Get next task.
|
||||
@@ -451,6 +500,68 @@ definitions:
|
||||
error:
|
||||
$ref: '#/definitions/ErrorBody'
|
||||
|
||||
CallsWrapper:
|
||||
type: object
|
||||
required:
|
||||
- app
|
||||
- route
|
||||
properties:
|
||||
app:
|
||||
type: string
|
||||
description: "Name of this app."
|
||||
readOnly: true
|
||||
route:
|
||||
type: string
|
||||
description: "Name of this app."
|
||||
readOnly: true
|
||||
|
||||
CallWrapper:
|
||||
type: object
|
||||
required:
|
||||
- call
|
||||
properties:
|
||||
call:
|
||||
type: string
|
||||
description: "Call ID."
|
||||
readOnly: true
|
||||
|
||||
|
||||
Call:
|
||||
allOf:
|
||||
- type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: Call UUID ID.
|
||||
readOnly: true
|
||||
status:
|
||||
type: string
|
||||
description: Call execution status.
|
||||
readOnly: true
|
||||
app_name:
|
||||
type: string
|
||||
description: App name that is assigned to a route that is being executed.
|
||||
readOnly: true
|
||||
path:
|
||||
type: string
|
||||
description: App route that is being executed.
|
||||
readOnly: true
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Time when call was submitted. Always in UTC.
|
||||
readOnly: true
|
||||
started_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Time when call started execution. Always in UTC.
|
||||
readOnly: true
|
||||
completed_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Time when call completed, whether it was successul or failed. Always in UTC.
|
||||
readOnly: true
|
||||
|
||||
Task:
|
||||
allOf:
|
||||
- $ref: "#/definitions/NewTask"
|
||||
|
||||
Reference in New Issue
Block a user