Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add loading and teleport logs #3436

Merged
merged 12 commits into from
Feb 27, 2025
5 changes: 5 additions & 0 deletions Explorer/Assets/DCL/Ipfs/SceneEntityDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ namespace DCL.Ipfs
[Serializable]
public class SceneEntityDefinition : EntityDefinitionGeneric<SceneMetadata>
{
private string? logSceneName;

public SceneEntityDefinition() { }

public SceneEntityDefinition(string id, SceneMetadata metadata) : base(id, metadata) { }

public string GetLogSceneName() =>
logSceneName ??= $"{id} @ {metadata.scene.DecodedBase}";
}
}
4 changes: 3 additions & 1 deletion Explorer/Assets/DCL/RealmNavigation/LoadingStatus.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DCL.Utilities;
using DCL.Diagnostics;
using DCL.Utilities;
using System.Collections.Generic;
using Utility;

Expand Down Expand Up @@ -53,6 +54,7 @@ public enum LoadingStage : byte

public float SetCurrentStage(LoadingStage stage)
{
ReportHub.Log(ReportCategory.ALWAYS, $"Current loading stage: {stage}");
CurrentStage.Value = stage;
return PROGRESS[stage];
}
Expand Down
1 change: 1 addition & 0 deletions Explorer/Assets/DCL/RealmNavigation/RealmNavigator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ private async UniTask<EnumResult<TaskError>> ExecuteTeleportOperationsAsync(
CancellationToken ct
)
{
ReportHub.Log(ReportCategory.ALWAYS, $"Trying to teleport to {teleportParams.CurrentDestinationParcel}. Attempt #{attemptsCount}");
EnumResult<TaskError> lastOpResult = await ops.ExecuteAsync(logOpName, attemptsCount, teleportParams, ct);

if (lastOpResult.Success == false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ protected LoadSceneSystemLogicBase(IWebRequestController webRequestController, U

public async UniTask<ISceneFacade> FlowAsync(ISceneFactory sceneFactory, GetSceneFacadeIntention intention, ReportData reportCategory, IPartitionComponent partition, CancellationToken ct)
{
ReportHub.Log(ReportCategory.ALWAYS, $"Loading scene '{intention.DefinitionComponent.Definition.GetLogSceneName()}' began");

var definitionComponent = intention.DefinitionComponent;
var ipfsPath = definitionComponent.IpfsPath;
var definition = definitionComponent.Definition;
Expand Down Expand Up @@ -59,6 +61,7 @@ public async UniTask<ISceneFacade> FlowAsync(ISceneFactory sceneFactory, GetScen
await UniTask.SwitchToMainThread();

sceneFacade.Initialize();
ReportHub.Log(ReportCategory.ALWAYS, $"Loading scene '{intention.DefinitionComponent.Definition.GetLogSceneName()}' ended");
return sceneFacade;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ async UniTaskVoid RunOnThreadPoolAsync()
// Provide basic Thread Pool synchronization context
SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());

ReportHub.Log(ReportCategory.ALWAYS, $"Scene '{scene.SceneData.SceneEntityDefinition.GetLogSceneName()}' started");

// FPS is set by another system
await scene.StartUpdateLoopAsync(fps, destroyCancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Arch.System;
using Arch.SystemGroups;
using Cysharp.Threading.Tasks;
using DCL.Diagnostics;
using ECS.Abstract;
using ECS.Groups;
using ECS.LifeCycle;
Expand Down Expand Up @@ -46,6 +47,8 @@ private void UnloadLoadedScene(in Entity entity, ref SceneDefinitionComponent de
{
sceneFacade.DisposeSceneFacadeAndRemoveFromCache(scenesCache, definitionComponent.Parcels);

ReportHub.Log(ReportCategory.ALWAYS, $"Scene '{definitionComponent.Definition.GetLogSceneName()}' disposed");

// Keep definition so it won't be downloaded again = Cache in ECS itself
if (!localSceneDevelopment)
World.Remove<ISceneFacade, VisualSceneState, DeleteEntityIntention>(entity);
Expand Down
Loading