Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
make logs elk-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranrg committed Mar 24, 2017
1 parent 0becde9 commit 4cdbe1c
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions services/controllerhost/controllerhost.go
Expand Up @@ -794,7 +794,7 @@ func (mcp *Mcp) CreateDestination(ctx thrift.Context, createRequest *shared.Crea
// create local destination
destDesc, err := mcp.mClient.CreateDestination(ctx, createRequest)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("CreateDestination: local CreateDestination failed")
context.m3Client.IncCounter(metrics.ControllerCreateDestinationScope, metrics.ControllerFailures)
return nil, err
}
Expand All @@ -810,7 +810,7 @@ func (mcp *Mcp) CreateDestination(ctx thrift.Context, createRequest *shared.Crea
localReplicator, replicatorErr := mcp.GetClientFactory().GetReplicatorClient()
lclLg = lclLg.WithField(common.TagDst, common.FmtDst(destUUID))
if replicatorErr != nil {
lclLg.Error(replicatorErr.Error())
lclLg.WithField(common.TagErr, replicatorErr).Error("CreateDestination: GetReplicatorClient failed")
context.m3Client.IncCounter(metrics.ControllerCreateDestinationScope, metrics.ControllerErrCallReplicatorCounter)

// errors in calling replicator doesn't fail this call
Expand All @@ -820,7 +820,7 @@ func (mcp *Mcp) CreateDestination(ctx thrift.Context, createRequest *shared.Crea

replicatorErr = localReplicator.CreateRemoteDestinationUUID(ctx, createDestUUIDRequest)
if replicatorErr != nil {
lclLg.Error(replicatorErr.Error())
lclLg.WithField(common.TagErr, replicatorErr).Error("CreateDestination: CreateRemoteDestinationUUID failed")
context.m3Client.IncCounter(metrics.ControllerCreateDestinationScope, metrics.ControllerErrCallReplicatorCounter)

// errors in calling replicator doesn't fail this call
Expand Down Expand Up @@ -850,7 +850,7 @@ func (mcp *Mcp) UpdateDestination(ctx thrift.Context, updateRequest *shared.Upda
// update local destination
destDesc, err := mcp.mClient.UpdateDestination(ctx, updateRequest)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("UpdateDestination: local UpdateDestination failed")
context.m3Client.IncCounter(metrics.ControllerUpdateDestinationScope, metrics.ControllerFailures)
return nil, err
}
Expand All @@ -860,7 +860,7 @@ func (mcp *Mcp) UpdateDestination(ctx thrift.Context, updateRequest *shared.Upda
localReplicator, replicatorErr := mcp.GetClientFactory().GetReplicatorClient()
lclLg = lclLg.WithField(common.TagDst, common.FmtDst(destDesc.GetDestinationUUID()))
if replicatorErr != nil {
lclLg.Error(replicatorErr.Error())
lclLg.WithField(common.TagErr, replicatorErr).Error("UpdateDestination: GetReplicatorClient failed")
context.m3Client.IncCounter(metrics.ControllerUpdateDestinationScope, metrics.ControllerErrCallReplicatorCounter)

// errors in calling replicator doesn't fail this call
Expand All @@ -870,7 +870,7 @@ func (mcp *Mcp) UpdateDestination(ctx thrift.Context, updateRequest *shared.Upda

replicatorErr = localReplicator.UpdateRemoteDestination(ctx, updateRequest)
if replicatorErr != nil {
lclLg.Error(replicatorErr.Error())
lclLg.WithField(common.TagErr, replicatorErr).Error("UpdateDestination: UpdateRemoteDestination failed")
context.m3Client.IncCounter(metrics.ControllerUpdateDestinationScope, metrics.ControllerErrCallReplicatorCounter)

// errors in calling replicator doesn't fail this call
Expand Down Expand Up @@ -903,7 +903,7 @@ func (mcp *Mcp) DeleteDestination(ctx thrift.Context, deleteRequest *shared.Dele
}
destDesc, err := mcp.mClient.ReadDestination(ctx, readDestinationRequest)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("DeleteDestinationRequest: ReadDestination failed")
context.m3Client.IncCounter(metrics.ControllerDeleteDestinationScope, metrics.ControllerFailures)
return err
}
Expand All @@ -913,7 +913,7 @@ func (mcp *Mcp) DeleteDestination(ctx thrift.Context, deleteRequest *shared.Dele
// delete local destination
err = mcp.mClient.DeleteDestination(ctx, deleteRequest)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("DeleteDestination: local DeleteDestination failed")
context.m3Client.IncCounter(metrics.ControllerDeleteDestinationScope, metrics.ControllerFailures)
return err
}
Expand All @@ -922,7 +922,7 @@ func (mcp *Mcp) DeleteDestination(ctx thrift.Context, deleteRequest *shared.Dele
// send to local replicator to fan out
localReplicator, replicatorErr := mcp.GetClientFactory().GetReplicatorClient()
if replicatorErr != nil {
lclLg.Error(replicatorErr.Error())
lclLg.WithField(common.TagErr, replicatorErr).Error("DeleteDestination: GetReplicatorClient failed")
context.m3Client.IncCounter(metrics.ControllerDeleteDestinationScope, metrics.ControllerErrCallReplicatorCounter)

// errors in calling replicator doesn't fail this call
Expand All @@ -932,7 +932,7 @@ func (mcp *Mcp) DeleteDestination(ctx thrift.Context, deleteRequest *shared.Dele

replicatorErr = localReplicator.DeleteRemoteDestination(ctx, deleteRequest)
if replicatorErr != nil {
lclLg.Error(replicatorErr.Error())
lclLg.WithField(common.TagErr, replicatorErr).Error("DeleteDestination: DeleteRemoteDestination failed")
context.m3Client.IncCounter(metrics.ControllerDeleteDestinationScope, metrics.ControllerErrCallReplicatorCounter)

// errors in calling replicator doesn't fail this call
Expand Down Expand Up @@ -965,7 +965,7 @@ func (mcp *Mcp) CreateConsumerGroup(ctx thrift.Context, createRequest *shared.Cr
// create local consumer group
cgDesc, err := mcp.mClient.CreateConsumerGroup(ctx, createRequest)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("CreateConsumerGroup: local CreateConsumerGroup failed")
context.m3Client.IncCounter(metrics.ControllerCreateConsumerGroupScope, metrics.ControllerFailures)
return nil, err
}
Expand All @@ -981,7 +981,7 @@ func (mcp *Mcp) CreateConsumerGroup(ctx thrift.Context, createRequest *shared.Cr
localReplicator, replicatorErr := mcp.GetClientFactory().GetReplicatorClient()
lclLg = lclLg.WithField(common.TagCnsm, common.FmtCnsm(cgUUID))
if replicatorErr != nil {
lclLg.Error(replicatorErr.Error())
lclLg.WithField(common.TagErr, replicatorErr).Error("CreateConsumerGroup: GetReplicatorClient failed")
context.m3Client.IncCounter(metrics.ControllerCreateConsumerGroupScope, metrics.ControllerErrCallReplicatorCounter)

// errors in calling replicator doesn't fail this call
Expand All @@ -991,7 +991,7 @@ func (mcp *Mcp) CreateConsumerGroup(ctx thrift.Context, createRequest *shared.Cr

replicatorErr = localReplicator.CreateRemoteConsumerGroupUUID(ctx, createCGUUIDRequest)
if replicatorErr != nil {
lclLg.Error(replicatorErr.Error())
lclLg.WithField(common.TagErr, replicatorErr).Error("CreateConsumerGroup: CreateRemoteConsumerGroupUUID error")
context.m3Client.IncCounter(metrics.ControllerCreateConsumerGroupScope, metrics.ControllerErrCallReplicatorCounter)

// errors in calling replicator doesn't fail this call
Expand Down Expand Up @@ -1024,7 +1024,7 @@ func (mcp *Mcp) UpdateConsumerGroup(ctx thrift.Context, updateRequest *shared.Up
// update local consumer group
cgDesc, err := mcp.mClient.UpdateConsumerGroup(ctx, updateRequest)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("UpdateConsumerGroup: local UpdateConsumerGroup failed")
context.m3Client.IncCounter(metrics.ControllerUpdateConsumerGroupScope, metrics.ControllerFailures)
return nil, err
}
Expand All @@ -1033,12 +1033,12 @@ func (mcp *Mcp) UpdateConsumerGroup(ctx thrift.Context, updateRequest *shared.Up
// // send to local replicator to fan out
// localReplicator, err := mcp.GetClientFactory().GetReplicatorClient()
// if err != nil {
// lclLg.Error(err.Error())
// lclLg.WithField(common.TagErr, err).Error("UpdateConsumerGroup: GetReplicatorClient failed")
// }

// err = localReplicator.UpdateRemoteConsumerGroup(ctx, updateRequest)
// if err != nil {
// lclLg.Error(err.Error())
// lclLg.WithField(common.TagErr, err).Error("UpdateConsumerGroup: UpdateRemoteConsumerGroup failed")
// }
// }

Expand Down Expand Up @@ -1069,7 +1069,7 @@ func (mcp *Mcp) DeleteConsumerGroup(ctx thrift.Context, deleteRequest *shared.De
// delete local consumer group
err := mcp.mClient.DeleteConsumerGroup(ctx, deleteRequest)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("DeleteConsumerGroup: local DeleteConsumerGroup failed")
context.m3Client.IncCounter(metrics.ControllerDeleteConsumerGroupScope, metrics.ControllerFailures)
return err
}
Expand All @@ -1078,12 +1078,12 @@ func (mcp *Mcp) DeleteConsumerGroup(ctx thrift.Context, deleteRequest *shared.De
// // send to local replicator to fan out
// localReplicator, err := mcp.GetClientFactory().GetReplicatorClient()
// if err != nil {
// lclLg.Error(err.Error())
// lclLg.WithField(common.TagErr, err).Error("DeleteConsumerGroup: GetReplicatorClient failed")
// }

// err = localReplicator.DeleteRemoteConsumerGroup(ctx, deleteRequest)
// if err != nil {
// lclLg.Error(err.Error())
// lclLg.WithField(common.TagErr, err).Error("DeleteConsumerGroup: DeleteRemoteConsumerGroup failed")
// }
// }

Expand Down Expand Up @@ -1117,7 +1117,7 @@ func (mcp *Mcp) CreateRemoteZoneExtent(ctx thrift.Context, createRequest *shared

storehosts, err := context.placement.PickStoreHosts(nReplicasPerExtent)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("CreateRemoteZoneExtent: PickStoreHosts failed")
context.m3Client.IncCounter(metrics.ControllerCreateRemoteZoneExtentScope, metrics.ControllerErrPickStoreHostCounter)
return nil, &shared.InternalServiceError{Message: err.Error()}
}
Expand All @@ -1135,7 +1135,7 @@ func (mcp *Mcp) CreateRemoteZoneExtent(ctx thrift.Context, createRequest *shared
res, err := context.mm.CreateRemoteZoneExtent(createRequest.GetExtent().GetDestinationUUID(),
createRequest.GetExtent().GetExtentUUID(), inputHost, storeids, createRequest.GetExtent().GetOriginZone(), remoteExtentPrimaryStore)
if err != nil {
lclLg.Error(err.Error())
lclLg.WithField(common.TagErr, err).Error("CreateRemoteZoneExtent: metadata CreateRemoteZoneExtent failed")
context.m3Client.IncCounter(metrics.ControllerCreateRemoteZoneExtentScope, metrics.ControllerErrMetadataUpdateCounter)
return nil, err
}
Expand Down

0 comments on commit 4cdbe1c

Please sign in to comment.