From 24e4981d7d68212b3f52ddd63cb0dcde9a570031 Mon Sep 17 00:00:00 2001 From: MichaelBuessemeyer <39529669+MichaelBuessemeyer@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:20:19 +0100 Subject: [PATCH] Add further debug logging for ds listing (#8247) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add debug logging for dataset list route * add extensive logging to listGrouped method of DatasetController * dont log full objects * restore logging full object except for user objects --------- Co-authored-by: Michael Büßemeyer Co-authored-by: Florian M --- app/controllers/DatasetController.scala | 27 +++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/app/controllers/DatasetController.scala b/app/controllers/DatasetController.scala index 6c77076248..83009b13a6 100755 --- a/app/controllers/DatasetController.scala +++ b/app/controllers/DatasetController.scala @@ -224,16 +224,31 @@ class DatasetController @Inject()(userService: UserService, implicit ctx: DBAccessContext, m: MessagesProvider): Fox[List[JsObject]] = for { + _ <- Fox.successful(()) + _ = logger.info(s"datasets: $datasets, requestingUser: ${requestingUser.map(_._id)}") requestingUserTeamManagerMemberships <- Fox.runOptional(requestingUser)(user => - userService.teamManagerMembershipsFor(user._id)) + userService + .teamManagerMembershipsFor(user._id)) ?~> s"Could not find team manager memberships for user ${requestingUser + .map(_._id)}" + _ = logger.info( + s"requestingUserTeamManagerMemberships: ${requestingUserTeamManagerMemberships.map(_.map(_.toString))}") groupedByOrga = datasets.groupBy(_._organization).toList js <- Fox.serialCombined(groupedByOrga) { byOrgaTuple: (String, List[Dataset]) => for { - organization <- organizationDAO.findOne(byOrgaTuple._1) + _ <- Fox.successful(()) + _ = logger.info(s"byOrgaTuple orga: ${byOrgaTuple._1}, datasets: ${byOrgaTuple._2}") + organization <- organizationDAO.findOne(byOrgaTuple._1) ?~> s"Could not find organization ${byOrgaTuple._1}" groupedByDataStore = byOrgaTuple._2.groupBy(_._dataStore).toList + _ <- Fox.serialCombined(groupedByDataStore) { byDataStoreTuple: (String, List[Dataset]) => + { + logger.info(s"datastore: ${byDataStoreTuple._1}, datasets: ${byDataStoreTuple._2}") + Fox.successful(()) + } + } result <- Fox.serialCombined(groupedByDataStore) { byDataStoreTuple: (String, List[Dataset]) => for { - dataStore <- dataStoreDAO.findOneByName(byDataStoreTuple._1.trim)(GlobalAccessContext) + dataStore <- dataStoreDAO.findOneByName(byDataStoreTuple._1.trim)(GlobalAccessContext) ?~> + s"Could not find data store ${byDataStoreTuple._1}" resultByDataStore: Seq[JsObject] <- Fox.serialCombined(byDataStoreTuple._2) { d => datasetService.publicWrites( d, @@ -241,11 +256,11 @@ class DatasetController @Inject()(userService: UserService, Some(organization), Some(dataStore), requestingUserTeamManagerMemberships) ?~> Messages("dataset.list.writesFailed", d.name) - } + } ?~> "Could not find public writes for datasets" } yield resultByDataStore - } + } ?~> s"Could not group by datastore for datasets ${byOrgaTuple._2.map(_._id)}" } yield result.flatten - } + } ?~> s"Could not group by organization for datasets ${datasets.map(_._id)}" } yield js.flatten def accessList(datasetId: String): Action[AnyContent] = sil.SecuredAction.async { implicit request =>