@@ -13,6 +13,7 @@ import (
1313 "time"
1414
1515 "github.com/argoproj/gitops-engine/pkg/health"
16+ "go.opentelemetry.io/otel"
1617
1718 cacheutil "github.com/argoproj/argo-cd/v3/util/cache"
1819
@@ -412,6 +413,9 @@ func (s *Server) queryRepoServer(ctx context.Context, proj *v1alpha1.AppProject,
412413 enabledSourceTypes map [string ]bool ,
413414) error ,
414415) error {
416+ ctx , span := otel .GetTracerProvider ().Tracer ("argocd-server" ).Start (ctx , "queryRepoServer" )
417+ defer span .End ()
418+
415419 closer , client , err := s .repoClientset .NewRepoServerClient ()
416420 if err != nil {
417421 return fmt .Errorf ("error creating repo server client: %w" , err )
@@ -448,6 +452,9 @@ func (s *Server) queryRepoServer(ctx context.Context, proj *v1alpha1.AppProject,
448452
449453// GetManifests returns application manifests
450454func (s * Server ) GetManifests (ctx context.Context , q * application.ApplicationManifestQuery ) (* apiclient.ManifestResponse , error ) {
455+ ctx , span := otel .GetTracerProvider ().Tracer ("argocd-server" ).Start (ctx , "Server.GetManifests" )
456+ defer span .End ()
457+
451458 if q .Name == nil || * q .Name == "" {
452459 return nil , errors .New ("invalid request: application name is missing" )
453460 }
@@ -485,7 +492,9 @@ func (s *Server) GetManifests(ctx context.Context, q *application.ApplicationMan
485492 }
486493 serverVersion := ci .ServerVersion
487494
495+ _ , kubectlSpan := otel .GetTracerProvider ().Tracer ("argocd-server" ).Start (ctx , "kubectl.GetAPIResources" )
488496 apiResources , err := s .kubectl .GetAPIResources (config , false , kubecache .NewNoopSettings ())
497+ kubectlSpan .End ()
489498 if err != nil {
490499 return fmt .Errorf ("error getting API resources: %w" , err )
491500 }
@@ -1364,6 +1373,9 @@ func (s *Server) getCachedAppState(ctx context.Context, a *v1alpha1.Application,
13641373}
13651374
13661375func (s * Server ) getAppResources (ctx context.Context , a * v1alpha1.Application ) (* v1alpha1.ApplicationTree , error ) {
1376+ ctx , span := otel .GetTracerProvider ().Tracer ("argocd-server" ).Start (ctx , "Server.getAppResources" )
1377+ defer span .End ()
1378+
13671379 var tree v1alpha1.ApplicationTree
13681380 err := s .getCachedAppState (ctx , a , func () error {
13691381 return s .cache .GetAppResourcesTree (a .InstanceName (s .ns ), & tree )
@@ -1378,6 +1390,9 @@ func (s *Server) getAppResources(ctx context.Context, a *v1alpha1.Application) (
13781390}
13791391
13801392func (s * Server ) getAppLiveResource (ctx context.Context , action string , q * application.ApplicationResourceRequest ) (* v1alpha1.ResourceNode , * rest.Config , * v1alpha1.Application , error ) {
1393+ ctx , span := otel .GetTracerProvider ().Tracer ("argocd-server" ).Start (ctx , "Server.getAppLiveResource" )
1394+ defer span .End ()
1395+
13811396 fineGrainedInheritanceDisabled , err := s .settingsMgr .ApplicationFineGrainedRBACInheritanceDisabled ()
13821397 if err != nil {
13831398 return nil , nil , nil , err
@@ -1412,6 +1427,9 @@ func (s *Server) getAppLiveResource(ctx context.Context, action string, q *appli
14121427}
14131428
14141429func (s * Server ) GetResource (ctx context.Context , q * application.ApplicationResourceRequest ) (* application.ApplicationResourceResponse , error ) {
1430+ ctx , span := otel .GetTracerProvider ().Tracer ("argocd-server" ).Start (ctx , "Server.GetResource" )
1431+ defer span .End ()
1432+
14151433 res , config , _ , err := s .getAppLiveResource (ctx , rbac .ActionGet , q )
14161434 if err != nil {
14171435 return nil , err
@@ -1421,7 +1439,10 @@ func (s *Server) GetResource(ctx context.Context, q *application.ApplicationReso
14211439 if q .GetVersion () != "" {
14221440 res .Version = q .GetVersion ()
14231441 }
1442+
1443+ _ , kubectlSpan := otel .GetTracerProvider ().Tracer ("argocd-server" ).Start (ctx , "kbuectl.GetResource" )
14241444 obj , err := s .kubectl .GetResource (ctx , config , res .GroupKindVersion (), res .Name , res .Namespace )
1445+ kubectlSpan .End ()
14251446 if err != nil {
14261447 return nil , fmt .Errorf ("error getting resource: %w" , err )
14271448 }
0 commit comments