From 707ad0772284ef6d4afb2afc0928781da9d8fb50 Mon Sep 17 00:00:00 2001 From: Kristine Kunapuli <49738148+kkunapuli@users.noreply.github.com> Date: Wed, 21 Aug 2024 12:04:03 -0400 Subject: [PATCH] Revert "chore: add tracing info to some backend APIs" (#9843) --- master/internal/api_agents.go | 10 +--------- master/internal/api_job.go | 17 +++++------------ master/internal/job/jobservice/jobservice.go | 9 +-------- master/internal/rm/kubernetesrm/jobs.go | 9 +-------- .../kubernetesrm/kubernetes_resource_manager.go | 6 +----- .../internal/rm/kubernetesrm/resource_pool.go | 8 +------- 6 files changed, 10 insertions(+), 49 deletions(-) diff --git a/master/internal/api_agents.go b/master/internal/api_agents.go index d87b3ee80ab..d88e5245da2 100644 --- a/master/internal/api_agents.go +++ b/master/internal/api_agents.go @@ -2,7 +2,6 @@ package internal import ( "context" - "runtime/trace" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -21,14 +20,7 @@ import ( func (a *apiServer) GetAgents( ctx context.Context, req *apiv1.GetAgentsRequest, ) (*apiv1.GetAgentsResponse, error) { - ctx, task := trace.NewTask(ctx, "GetAgents") - defer task.End() - - var resp *apiv1.GetAgentsResponse - var err error - trace.WithRegion(ctx, "resourceManager.GetAgents", func() { - resp, err = a.m.rm.GetAgents() - }) + resp, err := a.m.rm.GetAgents() if err != nil { return nil, err } diff --git a/master/internal/api_job.go b/master/internal/api_job.go index 9a2d835dfb5..dfedf65e9a0 100644 --- a/master/internal/api_job.go +++ b/master/internal/api_job.go @@ -2,7 +2,6 @@ package internal import ( "context" - "runtime/trace" "github.com/determined-ai/determined/master/internal/api" "github.com/determined-ai/determined/master/internal/job/jobservice" @@ -50,17 +49,11 @@ func (a *apiServer) GetJobs( func (a *apiServer) GetJobsV2( ctx context.Context, req *apiv1.GetJobsV2Request, ) (resp *apiv1.GetJobsV2Response, err error) { - ctx, task := trace.NewTask(ctx, "GetJobsV2") - defer task.End() - - var jobs []*jobv1.Job - trace.WithRegion(ctx, "jobservice.GetJobs", func() { - jobs, err = jobservice.DefaultService.GetJobs( - rm.ResourcePoolName(req.ResourcePool), - req.OrderBy == apiv1.OrderBy_ORDER_BY_DESC, - req.States, - ) - }) + jobs, err := jobservice.DefaultService.GetJobs( + rm.ResourcePoolName(req.ResourcePool), + req.OrderBy == apiv1.OrderBy_ORDER_BY_DESC, + req.States, + ) if err != nil { return nil, err } diff --git a/master/internal/job/jobservice/jobservice.go b/master/internal/job/jobservice/jobservice.go index 1cdf7a03630..e0f7864a214 100644 --- a/master/internal/job/jobservice/jobservice.go +++ b/master/internal/job/jobservice/jobservice.go @@ -1,10 +1,8 @@ package jobservice import ( - "context" "database/sql" "fmt" - "runtime/trace" "sort" "strings" "sync" @@ -98,15 +96,10 @@ func (s *Service) GetJobs( desc bool, states []jobv1.State, ) ([]*jobv1.Job, error) { - // waiting on this lock s.mu.Lock() defer s.mu.Unlock() - var jobQ map[model.JobID]*sproto.RMJobInfo - var err error - trace.WithRegion(context.Background(), "resourceManager.GetJobQ", func() { - jobQ, err = s.rm.GetJobQ(resourcePool) - }) + jobQ, err := s.rm.GetJobQ(resourcePool) if err != nil { s.syslog.WithError(err).Error("getting job queue info from RM") return nil, err diff --git a/master/internal/rm/kubernetesrm/jobs.go b/master/internal/rm/kubernetesrm/jobs.go index a7d7696ad27..83d47909bde 100644 --- a/master/internal/rm/kubernetesrm/jobs.go +++ b/master/internal/rm/kubernetesrm/jobs.go @@ -7,7 +7,6 @@ import ( "math" "os" "path/filepath" - "runtime/trace" "slices" "strconv" "strings" @@ -1050,15 +1049,9 @@ func (j *jobsService) refreshPodStates(allocationID model.AllocationID) error { } func (j *jobsService) GetAgents() (*apiv1.GetAgentsResponse, error) { - // waiting on this lock j.mu.Lock() defer j.mu.Unlock() - var resp *apiv1.GetAgentsResponse - var err error - trace.WithRegion(context.Background(), "jobsService.GetAgents", func() { - resp, err = j.getAgents() - }) - return resp, err + return j.getAgents() } func (j *jobsService) GetAgent(msg *apiv1.GetAgentRequest) *apiv1.GetAgentResponse { diff --git a/master/internal/rm/kubernetesrm/kubernetes_resource_manager.go b/master/internal/rm/kubernetesrm/kubernetes_resource_manager.go index 908893f984e..9ec6065dd66 100644 --- a/master/internal/rm/kubernetesrm/kubernetes_resource_manager.go +++ b/master/internal/rm/kubernetesrm/kubernetes_resource_manager.go @@ -5,7 +5,6 @@ import ( "crypto/tls" "fmt" "maps" - "runtime/trace" "slices" "time" @@ -240,10 +239,7 @@ func (k *ResourceManager) GetJobQ(rpName rm.ResourcePoolName) (map[model.JobID]* if err != nil { return nil, err } - var resp map[model.JobID]*sproto.RMJobInfo - trace.WithRegion(context.Background(), "resourcepool.GetJobQ", func() { - resp = rp.GetJobQ() - }) + resp := rp.GetJobQ() return resp, nil } diff --git a/master/internal/rm/kubernetesrm/resource_pool.go b/master/internal/rm/kubernetesrm/resource_pool.go index 8579aee7976..7ae1d9eaf09 100644 --- a/master/internal/rm/kubernetesrm/resource_pool.go +++ b/master/internal/rm/kubernetesrm/resource_pool.go @@ -4,7 +4,6 @@ import ( "context" "database/sql" "fmt" - "runtime/trace" "sync" "github.com/google/uuid" @@ -128,16 +127,11 @@ func (k *kubernetesResourcePool) PendingPreemption(msg sproto.PendingPreemption) } func (k *kubernetesResourcePool) GetJobQ() map[model.JobID]*sproto.RMJobInfo { - // waiting on this lock k.mu.Lock() defer k.mu.Unlock() k.tryAdmitPendingTasks = true - var resp map[model.JobID]*sproto.RMJobInfo - trace.WithRegion(context.Background(), "resourcepool.k8s.jobQInfo", func() { - resp = k.jobQInfo() - }) - return resp + return k.jobQInfo() } func (k *kubernetesResourcePool) GetJobQStats() *jobv1.QueueStats {