diff --git a/proxy/adminservice.go b/proxy/adminservice.go index 321a7624..4f9d4b44 100644 --- a/proxy/adminservice.go +++ b/proxy/adminservice.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "sync" + "time" "go.temporal.io/api/serviceerror" "go.temporal.io/server/api/adminservice/v1" @@ -159,7 +160,37 @@ func (s *adminServiceProxyServer) GetWorkflowExecutionRawHistory(ctx context.Con } func (s *adminServiceProxyServer) GetWorkflowExecutionRawHistoryV2(ctx context.Context, in0 *adminservice.GetWorkflowExecutionRawHistoryV2Request) (*adminservice.GetWorkflowExecutionRawHistoryV2Response, error) { - return s.adminClient.GetWorkflowExecutionRawHistoryV2(ctx, in0) + start := time.Now() + deadline, ok := ctx.Deadline() + var deadline_duration int64 + if ok { + deadline_duration = deadline.Sub(start).Milliseconds() + } + + resp, err := s.adminClient.GetWorkflowExecutionRawHistoryV2(ctx, in0) + workflowIDsToLog := []string{ + "e-2SeAIiK2Rb3cWtslIqDUV", + "e-1q5kCdPFeN5hp2NnENi0e", + "e-3v5hDixs4DHkhh3wO1wNG", + } + + workflowID := in0.Execution.GetWorkflowId() + for _, wid := range workflowIDsToLog { + if workflowID == wid { + s.logger.Warn(fmt.Sprintf("GetWorkflowExecutionRawHistoryV2 called. is_deadline_set: %v, deadline: %v", ok, deadline), + tag.Timestamp(start), + tag.Error(err), + tag.WorkflowID(wid), + tag.NewInt64("start_event_id", in0.GetStartEventId()), + tag.NewInt64("end_event_id", in0.GetEndEventId()), + tag.NewInt32("max_page_size", in0.MaximumPageSize), + tag.NewInt64("duration_ms", time.Since(start).Milliseconds()), + tag.NewInt64("deadline_duration_ms", deadline_duration), + ) + } + } + + return resp, err } func (s *adminServiceProxyServer) ImportWorkflowExecution(ctx context.Context, in0 *adminservice.ImportWorkflowExecutionRequest) (*adminservice.ImportWorkflowExecutionResponse, error) { diff --git a/proxy/workflowservice.go b/proxy/workflowservice.go index 300f3e9b..358d28d3 100644 --- a/proxy/workflowservice.go +++ b/proxy/workflowservice.go @@ -2,9 +2,12 @@ package proxy import ( "context" + "fmt" + "time" "go.temporal.io/api/workflowservice/v1" "go.temporal.io/server/common/log" + "go.temporal.io/server/common/log/tag" "github.com/temporalio/s2s-proxy/auth" "github.com/temporalio/s2s-proxy/client" @@ -130,7 +133,23 @@ func (s *workflowServiceProxyServer) GetWorkerVersioningRules(ctx context.Contex } func (s *workflowServiceProxyServer) GetWorkflowExecutionHistory(ctx context.Context, in0 *workflowservice.GetWorkflowExecutionHistoryRequest) (*workflowservice.GetWorkflowExecutionHistoryResponse, error) { - return s.workflowServiceClient.GetWorkflowExecutionHistory(ctx, in0) + start := time.Now() + deadline, ok := ctx.Deadline() + var deadline_duration int + if ok { + deadline_duration = int(deadline.Sub(start).Milliseconds()) + } + + resp, err := s.workflowServiceClient.GetWorkflowExecutionHistory(ctx, in0) + + s.logger.Warn(fmt.Sprintf("GetWorkflowExecutionHistory called. is_deadline_set: %v, deadline: %v\n", ok, deadline), + tag.Timestamp(deadline), tag.Error(err), + tag.Timestamp(start), tag.Error(err), + tag.NewInt("duration_ms", int(time.Since(start).Milliseconds())), + tag.NewInt("deadline_duration_ms", deadline_duration), + ) + + return resp, err } func (s *workflowServiceProxyServer) GetWorkflowExecutionHistoryReverse(ctx context.Context, in0 *workflowservice.GetWorkflowExecutionHistoryReverseRequest) (*workflowservice.GetWorkflowExecutionHistoryReverseResponse, error) {