mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Added logging/metrics information, removed hosted thing in main README. (#183)
This commit is contained in:
39
README.md
39
README.md
@@ -1,5 +1,13 @@
|
|||||||
# IronFunctions
|
# IronFunctions
|
||||||
|
|
||||||
|
Welcome to IronFunctions! The open source Functions as a Service platform.
|
||||||
|
|
||||||
|
## Join Our Community
|
||||||
|
|
||||||
|
First off, join the community!
|
||||||
|
|
||||||
|
[](https://open-iron.herokuapp.com)
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
This guide will get you up and running in a few minutes.
|
This guide will get you up and running in a few minutes.
|
||||||
@@ -49,6 +57,8 @@ The app `myapp` that we created above along with the `/hello` route we added wou
|
|||||||
curl http://localhost:8080/r/myapp/hello
|
curl http://localhost:8080/r/myapp/hello
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or just surf to it: http://localhost:8080/r/myapp/hello
|
||||||
|
|
||||||
### Passing data into a function
|
### Passing data into a function
|
||||||
|
|
||||||
Your function will get the body of the HTTP request via STDIN, and the headers of the request will be passed in as env vars. Try this:
|
Your function will get the body of the HTTP request via STDIN, and the headers of the request will be passed in as env vars. Try this:
|
||||||
@@ -98,36 +108,19 @@ You will get a `call_id` in the response:
|
|||||||
{"call_id":"572415fd-e26e-542b-846f-f1f5870034f2"}
|
{"call_id":"572415fd-e26e-542b-846f-f1f5870034f2"}
|
||||||
```
|
```
|
||||||
|
|
||||||
If you watch the logs, you will see the function actually runs in the background.
|
If you watch the logs, you will see the function actually runs in the background:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Read more on [logging](docs/logging.md).
|
||||||
|
|
||||||
## Writing Functions
|
## Writing Functions
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
See examples for now.
|
|
||||||
|
|
||||||
## Using IronFunctions Hosted by Iron.io
|
|
||||||
|
|
||||||
Simply point to https://functions.iron.io instead of localhost and add your Iron.io Authentication header (TODO: link), like this:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
curl -H "Authorization: Bearer IRON_TOKEN" -H "Content-Type: application/json" -X POST -d '{"app": {"name":"myapp"}}' https://functions.iron.io/v1/apps
|
|
||||||
```
|
|
||||||
|
|
||||||
And you'll get an ironfunctions.com host for your app:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
myapp.USER_ID.ironfunctions.com/hello
|
|
||||||
```
|
|
||||||
|
|
||||||
## More Documentation
|
## More Documentation
|
||||||
|
|
||||||
* [IronFunctions Options](api.md)
|
See [docs/](docs/) for full documentation.
|
||||||
* [Running in Production](docs/production.md)
|
|
||||||
* [Triggers](docs/triggers.md)
|
|
||||||
* [Metrics](docs/metrics.md)
|
|
||||||
* [Extending IronFunctions](docs/extending.md)
|
|
||||||
* [API Reference](https://swaggerhub.com/api/iron/functions)
|
|
||||||
|
|
||||||
## Join Our Community
|
## Join Our Community
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
# IronFunctions Documentation
|
# IronFunctions Documentation
|
||||||
|
|
||||||
* [Running IronFunctions](api.md)
|
* [IronFunctions Options](api.md)
|
||||||
|
* [API Reference](https://app.swaggerhub.com/api/iron/functions/)
|
||||||
|
* [Running in Production](production.md)
|
||||||
* [Databases](databases/README.md)
|
* [Databases](databases/README.md)
|
||||||
* [Message Queues](mqs/README.md)
|
* [Message Queues](mqs/README.md)
|
||||||
* [Running in Production](production.md)
|
* [Logging](logging.md)
|
||||||
* [Triggers](triggers.md)
|
|
||||||
* [Metrics](metrics.md)
|
* [Metrics](metrics.md)
|
||||||
|
* [Triggers](triggers.md)
|
||||||
* [Extending IronFunctions](extending.md)
|
* [Extending IronFunctions](extending.md)
|
||||||
|
|||||||
BIN
docs/async-log-full.png
Normal file
BIN
docs/async-log-full.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 229 KiB |
32
docs/logging.md
Normal file
32
docs/logging.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Logging
|
||||||
|
|
||||||
|
There are a few things to note about what IronFunctions logs.
|
||||||
|
|
||||||
|
## Logspout
|
||||||
|
|
||||||
|
We recommend using [logspout](https://github.com/gliderlabs/logspout) to forward your logs to a log aggregator of your choice.
|
||||||
|
|
||||||
|
## Format
|
||||||
|
|
||||||
|
All logs are emitted in [logfmt](https://godoc.org/github.com/kr/logfmt) format for easy parsing.
|
||||||
|
|
||||||
|
## Call ID
|
||||||
|
|
||||||
|
Every function call/request is assigned a `call_id`. If you search your logs, you can track all the activity
|
||||||
|
for each function call and find errors on a call by call basis. For example, these are the log lines for an aynschronous
|
||||||
|
function call:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Note the easily searchable `call_id=x` format.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
call_id=477949e2-922c-5da9-8633-0b2887b79f6e
|
||||||
|
```
|
||||||
|
|
||||||
|
## Metrics
|
||||||
|
|
||||||
|
Metrics are emitted via the logs.
|
||||||
|
|
||||||
|
See [Metrics](metrics.md) doc for more information.
|
||||||
|
|
||||||
@@ -1,10 +1,25 @@
|
|||||||
# Metrics
|
# Metrics
|
||||||
|
|
||||||
TODO: Explain metrics format. Log Metric Format - LMF(AO)
|
Metrics are emitted via the logs for few couple of reasons:
|
||||||
|
|
||||||
|
1) Everything supports STDERR.
|
||||||
|
2) User can optionally use them, if not, they just end up in the logs.
|
||||||
|
3) No particular metrics system required, in other words, all metrics systems can be used via adapters (see below).
|
||||||
|
|
||||||
|
## Metrics
|
||||||
|
|
||||||
|
The metrics format follows logfmt format and looks like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
metric=someevent value=1 type=count
|
metric=someevent value=1 type=count
|
||||||
metric=somegauge value=50 type=gauge
|
metric=somegauge value=50 type=gauge
|
||||||
```
|
```
|
||||||
|
|
||||||
|
It's a very simple format that can be easily parsed by any logfmt parser and passed on to another stats service.
|
||||||
|
|
||||||
TODO: List all metrics we emit to logs.
|
TODO: List all metrics we emit to logs.
|
||||||
|
|
||||||
|
## Statsd
|
||||||
|
|
||||||
|
The [Logspout Statsd Adapter](https://github.com/iron-io/logspout-statsd) adapter can parse the log metrics and forward
|
||||||
|
them to any statsd server.
|
||||||
Reference in New Issue
Block a user