This repository was archived by the owner on Feb 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
feat: add analyticsKernelService with renderer-protocol
#728
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f50fbe5
feat: add `analyticsKernelService` `with renderer-protocol
kuruk-mm 71abc6e
remove waiting for system info report
kuruk-mm 1754de1
Merge branch 'main' into feat/analytics
kuruk-mm 1223a4d
Merge branch 'main' into feat/analytics
kuruk-mm 3455efb
Merge branch 'main' into feat/analytics
kuruk-mm 6b5b088
fix
kuruk-mm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/renderer-protocol/inverseRpc/services/analyticsService.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { RpcServerPort } from '@dcl/rpc' | ||
| import { RendererProtocolContext } from '../context' | ||
| import * as codegen from '@dcl/rpc/dist/codegen' | ||
| import { AnalyticsKernelServiceDefinition } from '@dcl/protocol/out-ts/decentraland/renderer/kernel_services/analytics.gen' | ||
| import { getPerformanceInfo } from '../../../shared/session/getPerformanceInfo' | ||
| import { getUnityInstance } from '../../../unity-interface/IUnityInterface' | ||
| import { trackEvent } from '../../../shared/analytics' | ||
| import { setDelightedSurveyEnabled } from '../../../unity-interface/delightedSurvey' | ||
| import { browserInterface } from '../../..//unity-interface/BrowserInterface' | ||
|
|
||
| type UnityEvent = any | ||
|
|
||
| export function registerAnalyticsKernelService(port: RpcServerPort<RendererProtocolContext>) { | ||
| codegen.registerService(port, AnalyticsKernelServiceDefinition, async () => ({ | ||
| async analyticsEvent(req, _) { | ||
| const properties: Record<string, string> = {} | ||
| if (req.properties) { | ||
| for (const property of req.properties) { | ||
| properties[property.key] = property.value | ||
| } | ||
| } | ||
|
|
||
| trackEvent(req.eventName as UnityEvent, { context: properties.context || 'unity-event', ...properties }) | ||
| return {} | ||
| }, | ||
| async performanceReport(req, _) { | ||
| let estimatedAllocatedMemory = 0 | ||
| let estimatedTotalMemory = 0 | ||
| if (getUnityInstance()?.Module?.asmLibraryArg?._GetDynamicMemorySize) { | ||
| estimatedAllocatedMemory = getUnityInstance().Module.asmLibraryArg._GetDynamicMemorySize() | ||
| estimatedTotalMemory = getUnityInstance().Module.asmLibraryArg._GetTotalMemorySize() | ||
| } | ||
| const perfReport = getPerformanceInfo({ ...(req as any), estimatedAllocatedMemory, estimatedTotalMemory }) | ||
| trackEvent('performance report', perfReport) | ||
| return {} | ||
| }, | ||
| async setDelightedSurveyEnabled(req, _) { | ||
| setDelightedSurveyEnabled(req.enabled) | ||
| return {} | ||
| }, | ||
| async systemInfoReport(req, _) { | ||
| trackEvent('system info report', req) | ||
|
|
||
| // @deprecated | ||
| browserInterface.startedFuture.resolve() | ||
| return {} | ||
| } | ||
| })) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 was preventing the RPC from starting...
this is already being awaited here:
kernel/packages/unity-interface/dcl.ts
Line 48 in e9c174b
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.
Does it still work in desktop? I remember this was a bugfix