mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
edited logging variable format to fit same standard across all fn related projects (#1350)
This commit is contained in:
committed by
Gerardo Viedma
parent
39ed3b64e7
commit
024fd54392
@@ -386,16 +386,16 @@ func (a *resourceTracker) initializeCPU(cfg *Config) {
|
||||
}
|
||||
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"totalCPU": totalCPU,
|
||||
"availCPU": availCPU,
|
||||
"total_cpu": totalCPU,
|
||||
"avail_cpu": availCPU,
|
||||
}).Info("available cpu")
|
||||
|
||||
a.cpuTotal = availCPU
|
||||
a.cpuAsyncHWMark = availCPU * 8 / 10
|
||||
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"cpu": a.cpuTotal,
|
||||
"cpuAsyncHWMark": a.cpuAsyncHWMark,
|
||||
"cpu": a.cpuTotal,
|
||||
"cpu_async_hw_mark": a.cpuAsyncHWMark,
|
||||
}).Info("cpu reservations")
|
||||
|
||||
if a.cpuTotal == 0 {
|
||||
@@ -437,9 +437,9 @@ func (a *resourceTracker) initializeMemory(cfg *Config) {
|
||||
availMemory = availMemory - headRoom
|
||||
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"totalMemory": totalMemory,
|
||||
"headRoom": headRoom,
|
||||
"cgroupLimit": cGroupLimit,
|
||||
"total_memory": totalMemory,
|
||||
"head_room": headRoom,
|
||||
"cgroup_limit": cGroupLimit,
|
||||
}).Info("available memory")
|
||||
}
|
||||
|
||||
@@ -453,8 +453,8 @@ func (a *resourceTracker) initializeMemory(cfg *Config) {
|
||||
|
||||
// For non-linux OS, we expect these (or their defaults) properly configured from command-line/env
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"availMemory": a.ramTotal,
|
||||
"ramAsyncHWMark": a.ramAsyncHWMark,
|
||||
"avail_memory": a.ramTotal,
|
||||
"ram_async_hw_mark": a.ramAsyncHWMark,
|
||||
}).Info("ram reservations")
|
||||
|
||||
if a.ramTotal == 0 {
|
||||
|
||||
@@ -395,10 +395,10 @@ DataLoop:
|
||||
|
||||
func logCallFinish(log logrus.FieldLogger, msg *pb.RunnerMsg_Finished, headers http.Header, httpStatus int32) {
|
||||
log.WithFields(logrus.Fields{
|
||||
"RunnerSuccess": msg.Finished.GetSuccess(),
|
||||
"RunnerErrorCode": msg.Finished.GetErrorCode(),
|
||||
"RunnerHttpStatus": httpStatus,
|
||||
"FnHttpStatus": headers.Get("Fn-Http-Status"),
|
||||
"runner_success": msg.Finished.GetSuccess(),
|
||||
"runner_error_code": msg.Finished.GetErrorCode(),
|
||||
"runner_http_status": httpStatus,
|
||||
"fn_http_status": headers.Get("Fn-Http-Status"),
|
||||
}).Infof("Call finished Details=%v ErrorStr=%v", msg.Finished.GetDetails(), msg.Finished.GetErrorStr())
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ func (s3StoreProvider) New(ctx context.Context, u *url.URL) (models.LogStore, er
|
||||
return nil, errors.New("must provide non-empty bucket name in path of s3 api url. e.g. s3://s3.com/us-east-1/my_bucket")
|
||||
}
|
||||
|
||||
logrus.WithFields(logrus.Fields{"bucketName": bucketName, "region": region, "endpoint": endpoint, "access_key_id": accessKeyID, "useSSL": useSSL}).Info("checking / creating s3 bucket")
|
||||
logrus.WithFields(logrus.Fields{"bucket_name": bucketName, "region": region, "endpoint": endpoint, "access_key_id": accessKeyID, "use_ssl": useSSL}).Info("checking / creating s3 bucket")
|
||||
store := createStore(bucketName, endpoint, region, accessKeyID, secretAccessKey, useSSL)
|
||||
|
||||
// ensure the bucket exists, creating if it does not
|
||||
@@ -152,7 +152,7 @@ func (s *store) InsertLog(ctx context.Context, call *models.Call, callLog io.Rea
|
||||
ContentType: aws.String("text/plain"),
|
||||
}
|
||||
|
||||
logrus.WithFields(logrus.Fields{"bucketName": s.bucket, "key": objectName}).Debug("Uploading log")
|
||||
logrus.WithFields(logrus.Fields{"bucket_name": s.bucket, "key": objectName}).Debug("Uploading log")
|
||||
_, err := s.uploader.UploadWithContext(ctx, params)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to write log, %v", err)
|
||||
@@ -167,7 +167,7 @@ func (s *store) GetLog(ctx context.Context, appID, callID string) (io.Reader, er
|
||||
defer span.End()
|
||||
|
||||
objectName := logKey(appID, callID)
|
||||
logrus.WithFields(logrus.Fields{"bucketName": s.bucket, "key": objectName}).Debug("Downloading log")
|
||||
logrus.WithFields(logrus.Fields{"bucket_name": s.bucket, "key": objectName}).Debug("Downloading log")
|
||||
|
||||
// stream the logs to an in-memory buffer
|
||||
target := &aws.WriteAtBuffer{}
|
||||
@@ -207,7 +207,7 @@ func (s *store) InsertCall(ctx context.Context, call *models.Call) error {
|
||||
ContentType: aws.String("text/plain"),
|
||||
}
|
||||
|
||||
logrus.WithFields(logrus.Fields{"bucketName": s.bucket, "key": objectName}).Debug("Uploading call")
|
||||
logrus.WithFields(logrus.Fields{"bucket_name": s.bucket, "key": objectName}).Debug("Uploading call")
|
||||
_, err = s.uploader.UploadWithContext(ctx, params)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to insert call, %v", err)
|
||||
@@ -222,7 +222,7 @@ func (s *store) GetCall(ctx context.Context, fnID, callID string) (*models.Call,
|
||||
defer span.End()
|
||||
|
||||
objectName := callKey(fnID, callID)
|
||||
logrus.WithFields(logrus.Fields{"bucketName": s.bucket, "key": objectName}).Debug("Downloading call")
|
||||
logrus.WithFields(logrus.Fields{"bucket_name": s.bucket, "key": objectName}).Debug("Downloading call")
|
||||
|
||||
return s.getCallByKey(ctx, objectName)
|
||||
}
|
||||
@@ -356,7 +356,7 @@ func (s *store) GetCalls(ctx context.Context, filter *models.CallFilter) (*model
|
||||
// TODO we should reuse the buffer to decode these
|
||||
call, err := s.getCallByKey(ctx, objectName)
|
||||
if err != nil {
|
||||
common.Logger(ctx).WithError(err).WithFields(logrus.Fields{"fnID": fnID, "id": id}).Error("error filling call object")
|
||||
common.Logger(ctx).WithError(err).WithFields(logrus.Fields{"fn_id": fnID, "id": id}).Error("error filling call object")
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -152,20 +152,20 @@ func (mq *RedisMQ) processDelayedCalls() {
|
||||
if err == redis.ErrNil {
|
||||
continue
|
||||
} else if err != nil {
|
||||
logrus.WithError(err).WithFields(logrus.Fields{"reservationId": resID}).Error("Error HGET delayed_jobs")
|
||||
logrus.WithError(err).WithFields(logrus.Fields{"reservation_id": resID}).Error("Error HGET delayed_jobs")
|
||||
continue
|
||||
}
|
||||
|
||||
var job models.Call
|
||||
err = json.Unmarshal(buf, &job)
|
||||
if err != nil {
|
||||
logrus.WithError(err).WithFields(logrus.Fields{"buf": buf, "reservationId": resID}).Error("Error unmarshaling job")
|
||||
logrus.WithError(err).WithFields(logrus.Fields{"buf": buf, "reservation_id": resID}).Error("Error unmarshaling job")
|
||||
return
|
||||
}
|
||||
|
||||
_, err = redisPush(conn, mq.queueName, &job)
|
||||
if err != nil {
|
||||
logrus.WithError(err).WithFields(logrus.Fields{"reservationId": resID}).Error("Pushing delayed job")
|
||||
logrus.WithError(err).WithFields(logrus.Fields{"reservation_id": resID}).Error("Pushing delayed job")
|
||||
return
|
||||
}
|
||||
conn.Do("HDEL", mq.k("delayed_jobs"), resID)
|
||||
|
||||
@@ -1059,12 +1059,12 @@ func (s *Server) startGears(ctx context.Context, cancel context.CancelFunc) {
|
||||
nth, recv, wasSend := reflect.Select(cases)
|
||||
if wasSend {
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"ctxNumber": nth,
|
||||
"receivedValue": recv.String(),
|
||||
"ctx_number": nth,
|
||||
"received_value": recv.String(),
|
||||
}).Debug("Stopping because of received value from done context.")
|
||||
} else {
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"ctxNumber": nth,
|
||||
"ctx_number": nth,
|
||||
}).Debug("Stopping because of closed channel from done context.")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user