diff --git a/api/agent/call.go b/api/agent/call.go index 7869558ea..50dbf3733 100644 --- a/api/agent/call.go +++ b/api/agent/call.go @@ -101,6 +101,7 @@ func FromRequest(appName, path string, req *http.Request) CallOpt { Memory: route.Memory, CPUs: route.CPUs, Config: buildConfig(app, route), + Annotations: buildAnnotations(app, route), Headers: req.Header, CreatedAt: strfmt.DateTime(time.Now()), URL: reqURL(req), @@ -135,6 +136,17 @@ func buildConfig(app *models.App, route *models.Route) models.Config { return conf } +func buildAnnotations(app *models.App, route *models.Route) models.Annotations { + ann := make(models.Annotations) + for k, v := range app.Annotations { + ann[k] = v + } + for k, v := range route.Annotations { + ann[k] = v + } + return ann +} + func reqURL(req *http.Request) string { if req.URL.Scheme == "" { if req.TLS == nil { diff --git a/api/models/call.go b/api/models/call.go index d3e320a62..6a0b4f48a 100644 --- a/api/models/call.go +++ b/api/models/call.go @@ -126,6 +126,9 @@ type Call struct { // Config is the set of configuration variables for the call Config Config `json:"config,omitempty" db:"-"` + // Annotations is the set of annotations for the app/route of the call. + Annotations Annotations `json:"annotations,omitempty" db:"-"` + // Headers are headers from the request that created this call Headers http.Header `json:"headers,omitempty" db:"-"`