-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add analyticsKernelService
with renderer-protocol
#3605
Conversation
After the CI passes:
|
5e55efc
to
44d9a78
Compare
unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/Scene/Main/Main.cs
Outdated
Show resolved
Hide resolved
1af0c38
to
69d6780
Compare
// TODO: remove useBinaryTransform after ECS7 is fully in prod | ||
UseBinaryTransform = true, | ||
}); | ||
|
||
// We trigger the Decentraland logic once everything is initialized. | ||
WebInterface.StartDecentraland(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function, starts the engine calling the web directly. And from the Kernel side, starts everything, including the RPC.
So I had to move the rpc call after this StartDecentraland()
Signed-off-by: Mateo Miccino <mateomiccino@gmail.com>
// this event should be the last one to be executed after initialization | ||
// it is used by the kernel to signal "EngineReady" or something like that | ||
// to prevent race conditions like "SceneController is not an object", | ||
// aka sending events before unity is ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document all this setup process somewhere, what type of signasl are required between kernel/renderer to start decentraland.
Also bear in mind we are aiming to register KernelServices
as IService
in the ServiceLocator, this initialization will be moved (probably to a subsystem in Main
or similar). In the meantime we can have it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this method lacks of cohesion. Why is it called StartRpc
but does an analytics system reports saying that should be the last thing to be called? Perhaps a rename: ReportSystemInfoToAnalytics
22deca6
to
c7ca0e7
Compare
internal void SendToSegment(string eventName, Dictionary<string, string> data) { WebInterface.ReportAnalyticsEvent(eventName, data.Select(x => new WebInterface.AnalyticsPayload.Property(x.Key, x.Value)).ToArray()); } | ||
internal void SendToSegment(string eventName, Dictionary<string, string> data) | ||
{ | ||
ClientAnalyticsKernelService analytics = DCL.Environment.i.serviceLocator.Get<IRPC>().Analytics(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you inject the IRPC
dependency?
}; | ||
|
||
var result = JsonConvert.SerializeObject(performanceReportPayload); | ||
WebInterface.SendPerformanceReport(result); | ||
ClientAnalyticsKernelService analytics = Environment.i.serviceLocator.Get<IRPC>().Analytics(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you inject IRPC
dependency?
// this event should be the last one to be executed after initialization | ||
// it is used by the kernel to signal "EngineReady" or something like that | ||
// to prevent race conditions like "SceneController is not an object", | ||
// aka sending events before unity is ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this method lacks of cohesion. Why is it called StartRpc
but does an analytics system reports saying that should be the last thing to be called? Perhaps a rename: ReportSystemInfoToAnalytics
@@ -210,7 +212,9 @@ public void SetTutorialDisabled() | |||
commonDataStore.isTutorialRunning.Set(false); | |||
tutorialView.tutorialMusicHandler.StopTutorialMusic(); | |||
ShowTeacher3DModel(false); | |||
WebInterface.SetDelightedSurveyEnabled(true); | |||
|
|||
ClientAnalyticsKernelService analytics = DCL.Environment.i.serviceLocator.Get<IRPC>().Analytics(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you inject IRPC
dependency?
}; | ||
|
||
WebInterface.ReportAnalyticsEvent("tutorial step started", properties); | ||
ClientAnalyticsKernelService analytics = DCL.Environment.i.serviceLocator.Get<IRPC>().Analytics(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid singletons coupling if possible
Signed-off-by: Mateo Miccino <mateomiccino@gmail.com>
Samples = encodedSamples, | ||
FpsIsCapped = usingFPSCap, | ||
HiccupsInThousandFrames = hiccupsInThousandFrames, | ||
HiccupsTime = hiccupsTime, | ||
TotalTime = totalTime, | ||
GltfInProgress = gltfloading, | ||
GltfFailed = gltffailed, | ||
GltfCancelled = gltfcancelled, | ||
GltfLoaded = gltfloaded, | ||
AbInProgress = abloading, | ||
AbFailed = abfailed, | ||
AbCancelled = abcancelled, | ||
AbLoaded = abloaded, | ||
GltfTexturesLoaded = gltfTextures, | ||
AbTexturesLoaded = abTextures, | ||
PromiseTexturesLoaded = promiseTextures, | ||
EnqueuedMessages = queuedMessages, | ||
ProcessedMessages = processedMessages, | ||
PlayerCount = playerCount, | ||
LoadRadius = (int) loadRadius, | ||
SceneScores = { scenesMemoryScore }, | ||
DrawCalls = (int) drawCalls!, | ||
MemoryReserved = (long) totalMemoryReserved!, | ||
MemoryUsage = (long) totalMemoryUsage, | ||
TotalGcAlloc = (long) totalGCAlloc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this case change involve a change in the behavior? Can we have the linter ignore these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, it should not change anything. It's sending with the new RPC instead of JSON.
@@ -1,5 +1,9 @@ | |||
fileFormatVersion: 2 | |||
<<<<<<< HEAD:unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/KernelCommunication/RPC/GeneratedCode/Decentraland/renderer/kernel_services/AnalyticsService.gen.cs.meta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong conflict solving
@kuruk-mm Is this still PR valid? What is the status with that? |
Closing. Not more valid |
What does this PR change?
Use
renderer-protocol
instead of JSON-based communicationTest
Our Code Review Standards
https://github.com/decentraland/unity-renderer/blob/master/docs/code-review-standards.md