mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
added request uid
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
ID string
|
||||
Ctx context.Context
|
||||
Route *models.Route
|
||||
Payload string
|
||||
|
||||
@@ -23,7 +23,7 @@ func (t *containerTask) EnvVars() map[string]string {
|
||||
return env
|
||||
}
|
||||
|
||||
func (t *containerTask) Id() string { return "" }
|
||||
func (t *containerTask) Id() string { return t.cfg.ID }
|
||||
func (t *containerTask) Group() string { return "" }
|
||||
func (t *containerTask) Image() string { return t.cfg.Route.Image }
|
||||
func (t *containerTask) Timeout() uint { return uint(t.cfg.Timeout.Seconds()) }
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
"github.com/iron-io/functions/api/runner"
|
||||
"github.com/satori/go.uuid"
|
||||
)
|
||||
|
||||
func handleRunner(c *gin.Context) {
|
||||
@@ -22,6 +23,11 @@ func handleRunner(c *gin.Context) {
|
||||
|
||||
log := c.MustGet("log").(logrus.FieldLogger)
|
||||
|
||||
reqID := uuid.NewV5(uuid.Nil, c.Request.RemoteAddr+c.Request.URL.Path).String()
|
||||
c.Set("reqID", reqID)
|
||||
|
||||
log = log.WithFields(logrus.Fields{"request_id": reqID})
|
||||
|
||||
var err error
|
||||
|
||||
var payload []byte
|
||||
@@ -83,6 +89,7 @@ func handleRunner(c *gin.Context) {
|
||||
Route: el,
|
||||
Payload: string(payload),
|
||||
Timeout: 30 * time.Second,
|
||||
ID: reqID,
|
||||
})
|
||||
|
||||
if err := run.Run(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user