99
1010	"code.cloudfoundry.org/bbs" 
1111	"code.cloudfoundry.org/bbs/models" 
12+ 	"code.cloudfoundry.org/bbs/trace" 
1213	"code.cloudfoundry.org/cfdot/commands/helpers" 
1314	cfhttp "code.cloudfoundry.org/cfhttp/v2" 
1415	"code.cloudfoundry.org/rep" 
@@ -37,7 +38,9 @@ func cellState(cmd *cobra.Command, args []string) error {
3738	if  err  !=  nil  {
3839		return  NewCFDotError (cmd , err )
3940	}
40- 	cellRegistration , err  :=  FetchCellRegistration (bbsClient , args [0 ])
41+ 
42+ 	traceID  :=  trace .GenerateTraceID ()
43+ 	cellRegistration , err  :=  FetchCellRegistration (bbsClient , traceID , args [0 ])
4144	if  err  !=  nil  {
4245		return  NewCFDotError (cmd , err )
4346	}
@@ -62,6 +65,7 @@ func cellState(cmd *cobra.Command, args []string) error {
6265		cmd .OutOrStderr (),
6366		repClientFactory ,
6467		cellRegistration ,
68+ 		traceID ,
6569	)
6670	if  err  !=  nil  {
6771		return  NewCFDotComponentError (cmd , fmt .Errorf ("Rep error: Failed to get cell state for cell %s: %s" , args [0 ], err .Error ()))
@@ -81,10 +85,10 @@ func ValidateCellStateArguments(args []string) error {
8185	}
8286}
8387
84- func  FetchCellRegistration (bbsClient  bbs.Client , cellId  string ) (* models.CellPresence , error ) {
85- 	logger  :=  globalLogger .Session ("fetch-cell-presence" )
88+ func  FetchCellRegistration (bbsClient  bbs.Client , traceID   string ,  cellId  string ) (* models.CellPresence , error ) {
89+ 	logger  :=  trace . LoggerWithTraceInfo ( globalLogger .Session ("fetch-cell-presence" ),  traceID )
8690
87- 	cells , err  :=  bbsClient .Cells (logger )
91+ 	cells , err  :=  bbsClient .Cells (logger ,  traceID )
8892	if  err  !=  nil  {
8993		return  nil , err 
9094	}
@@ -98,13 +102,13 @@ func FetchCellRegistration(bbsClient bbs.Client, cellId string) (*models.CellPre
98102	return  nil , errors .New ("Cell not found" )
99103}
100104
101- func  FetchCellState (stdout , stderr  io.Writer , clientFactory  rep.ClientFactory , registration  * models.CellPresence ) error  {
102- 	repClient , err  :=  clientFactory .CreateClient (registration .RepAddress , registration .RepUrl )
105+ func  FetchCellState (stdout , stderr  io.Writer , clientFactory  rep.ClientFactory , registration  * models.CellPresence ,  traceID   string ) error  {
106+ 	repClient , err  :=  clientFactory .CreateClient (registration .RepAddress , registration .RepUrl ,  traceID )
103107	if  err  !=  nil  {
104108		return  err 
105109	}
106110
107- 	logger  :=  globalLogger .Session ("cell-state" )
111+ 	logger  :=  trace . LoggerWithTraceInfo ( globalLogger .Session ("cell-state" ),  traceID )
108112	encoder  :=  json .NewEncoder (stdout )
109113
110114	state , err  :=  repClient .State (logger )
0 commit comments