mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Largely a removal job, however many tests, particularly system level ones relied on Routes. These have been migrated to use Fns. * Add 410 response to swagger * No app names in log tags * Adding constraint in GetCall for FnID * Adding test to check FnID is required on call * Add fn_id to call selector * Fix text in docker mem warning * Correct buildConfig func name * Test fix up * Removing CPU setting from Agent test CPU setting has been deprecated, but the code base is still riddled with it. This just removes it from this layer. Really we need to remove it from Call. * Remove fn id check on calls * Reintroduce fn id required on call * Adding fnID to calls for execute test * Correct setting of app id in middleware * Removes root middlewares ability to redirect fun invocations * Add over sized test check * Removing call fn id check
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package metrics
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/fnproject/fn/api/models"
|
|
"go.opencensus.io/trace"
|
|
)
|
|
|
|
func NewLogstore(ls models.LogStore) models.LogStore {
|
|
return &metricls{ls}
|
|
}
|
|
|
|
type metricls struct {
|
|
ls models.LogStore
|
|
}
|
|
|
|
func (m *metricls) InsertCall(ctx context.Context, call *models.Call) error {
|
|
ctx, span := trace.StartSpan(ctx, "ls_insert_call")
|
|
defer span.End()
|
|
return m.ls.InsertCall(ctx, call)
|
|
}
|
|
|
|
func (m *metricls) GetCall(ctx context.Context, fnID, callID string) (*models.Call, error) {
|
|
ctx, span := trace.StartSpan(ctx, "ls_get_call")
|
|
defer span.End()
|
|
return m.ls.GetCall(ctx, fnID, callID)
|
|
}
|
|
|
|
func (m *metricls) GetCalls(ctx context.Context, filter *models.CallFilter) (*models.CallList, error) {
|
|
ctx, span := trace.StartSpan(ctx, "ls_get_calls")
|
|
defer span.End()
|
|
return m.ls.GetCalls(ctx, filter)
|
|
}
|
|
|
|
func (m *metricls) InsertLog(ctx context.Context, call *models.Call, callLog io.Reader) error {
|
|
ctx, span := trace.StartSpan(ctx, "ls_insert_log")
|
|
defer span.End()
|
|
return m.ls.InsertLog(ctx, call, callLog)
|
|
}
|
|
|
|
func (m *metricls) GetLog(ctx context.Context, appName, callID string) (io.Reader, error) {
|
|
ctx, span := trace.StartSpan(ctx, "ls_get_log")
|
|
defer span.End()
|
|
return m.ls.GetLog(ctx, appName, callID)
|
|
}
|
|
|
|
func (m *metricls) Close() error {
|
|
return m.ls.Close()
|
|
}
|