Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion proxy/adminservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"sync"
"time"

"go.temporal.io/api/serviceerror"
"go.temporal.io/server/api/adminservice/v1"
Expand Down Expand Up @@ -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) {
Expand Down
21 changes: 20 additions & 1 deletion proxy/workflowservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add the remaining deadline time here deadline - time.Now()

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) {
Expand Down